Mihai Budiu created CALCITE-5987: ------------------------------------ Summary: SqlImplementor loses type information for literals Key: CALCITE-5987 URL: https://issues.apache.org/jira/browse/CALCITE-5987 Project: Calcite Issue Type: Improvement Components: core Affects Versions: 1.35.0 Reporter: Mihai Budiu
When converting a SqlNode to a String query, the conversion can produce SQL that computes different results. This happens because literals do not carry type information in the result string. For example, this plan: {code} rel#7:LogicalValues.(type=RecordType(VARCHAR(3) EXPR$0),tuples=[{ 'A' }]) {code} will generate a SQL query: {code} SELECT 'A' {code} While the type of the former result is VARCHAR(3), the latter query produces a CHAR(1) result. It would be nice if SqlImplementor had an option to produce a query that preserves the output type, e.g.: {code} SELECT (CAST 'A' as VARCHAR(3)) {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)