1. select id, cast(score as int), 'hello' from T where id < ?

SqlNode子类

  • SqlIdentifier
  • SqlCall
  • SqlDataTypeSpec
  • SqlLiteral
  • SqlDynamicParam

image.png

  • id, score, T 等为SqlIdentifier
  • cast()为SqlCall
  • int 为SqlDataTypeSpec
  • ‘hello’ 为SqlLiteral
  • ‘?’ 为SqlDynamicParam

image.png

SqlNode常见的的类型

  • SELECT
  • FROM
  • AS
  • UNION
  • JOIN

优化器

参考资料

https://www.querifylabs.com/blog/assembling-a-query-optimizer-with-apache-calcite

参考资料

https://www.jianshu.com/p/1b7e7aaeb19f

Calcite总体流程

https://blog.csdn.net/Baron_ND/article/details/109199195