[CALCITE-1045][CALCITE-5127] Support correlation variables in project

To some extend correlation in project was already supported even before
this change. However, the fact that the correlation variables were not
explicitly present (and returned by the operator) creates problems
cause we cannot safely deduce if a column/field is used and thus we may
wrongly remove those fields when using the RelFieldTrimmer, when
merging projections, etc.; see queries and discussion under the
respective JIRAs.

The addition of correlation variables in project also aligns the code
with Filter, Join; the latter explicitly set correlation variables.

Co-authored-by: korlov42 <korlov@gridgain.com>

Close apache/calcite#2813
Close apache/calcite#2623
46 files changed
tree: 91d9e04c5f1b41cba7417d400d069cf920e51eda
  1. .github/
  2. .idea/
  3. babel/
  4. bom/
  5. buildSrc/
  6. cassandra/
  7. core/
  8. druid/
  9. elasticsearch/
  10. example/
  11. file/
  12. geode/
  13. gradle/
  14. innodb/
  15. kafka/
  16. linq4j/
  17. mongodb/
  18. pig/
  19. piglet/
  20. plus/
  21. redis/
  22. release/
  23. server/
  24. site/
  25. spark/
  26. splunk/
  27. src/
  28. testkit/
  29. ubenchmark/
  30. .asf.yaml
  31. .editorconfig
  32. .gitattributes
  33. .gitignore
  34. .ratignore
  35. .travis.yml
  36. appveyor.yml
  37. build.gradle.kts
  38. gradle.properties
  39. gradlew
  40. gradlew.bat
  41. LICENSE
  42. NOTICE
  43. README
  44. README.md
  45. settings.gradle.kts
  46. sqlline
  47. sqlline.bat
  48. sqlsh
  49. sqlsh.bat
README.md

Maven Central Travis Build Status CI Status AppVeyor Build Status

Apache Calcite

Apache Calcite is a dynamic data management framework.

It contains many of the pieces that comprise a typical database management system but omits the storage primitives. It provides an industry standard SQL parser and validator, a customisable optimizer with pluggable rules and cost functions, logical and physical algebraic operators, various transformation algorithms from SQL to algebra (and the opposite), and many adapters for executing SQL queries over Cassandra, Druid, Elasticsearch, MongoDB, Kafka, and others, with minimal configuration.

For more details, see the home page.