[CALCITE-5607] Serialize return type during RelJson.toJson(RexNode node) for SqlKind.MINUS

Uncovered a bug in RelJson#toRex for the TIMESTAMP_DIFF call for Big Query dialect.
MINUS_DATE uses an ARG2_NULLABLE return type inference which requires 3 operands, however there are only 2 operands for BQ.
The solution here is to do something similar to how we handle CAST and to add in "type" when serializing to JSON in RelJson.toJson(RexNode node) for SqlKind.MINUS so that jsonType will be defined in toRex.

Co-authored-by: TJ Banghart <tjbanghart@gmail.com>
2 files changed
tree: 58482113383382b9b68ff3a621d29ace13dac354
  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. build.gradle.kts
  36. gradle.properties
  37. gradlew
  38. gradlew.bat
  39. Jenkinsfile
  40. LICENSE
  41. NOTICE
  42. README
  43. README.md
  44. settings.gradle.kts
  45. sqlline
  46. sqlline.bat
  47. sqlsh
  48. sqlsh.bat
README.md

Maven Central CI 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.

The project uses JIRA for issue tracking. For further information, please see the JIRA accounts guide.