Calcite's parser has an extension point to let you add your custom types[1].
I know that Flink has done the similar thing using this ability[2], which you can take a look at. [1] https://github.com/apache/calcite/blob/defea67b80fe432c5a8f776718169a3595b222a8/core/src/main/codegen/templates/Parser.jj#L5465 [2] https://github.com/apache/flink/blob/1c0534481c705c29b0e8eed3bdb421c188618b7a/flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl#L1455 Will Noble <wno...@google.com.invalid> 于2022年10月26日周三 05:38写道: > I filed CALCITE-5346 <https://issues.apache.org/jira/browse/CALCITE-5346> > but was hoping to get some input on the idea before looking into the > implementation myself. > > Some dialects of SQL, like BigQuery, use non-standard type names, e.g. > STRING instead of VARCHAR. We would like to easily support type aliases for > basic ones with a clear mapping to ISO types, so that an expression like > CAST(x AS STRING) is equivalent to CAST(x AS VARCHAR). Does anybody > currently use Calcite in such a way or have any opinions on how the > solution should look? > > Will > -- Best, Benchao Li