xiong duan created CALCITE-6419:
-----------------------------------
Summary: Invalid unparse for VARCHAR without precision in
HiveSqlDialect And SparkSqlDialect
Key: CALCITE-6419
URL: https://issues.apache.org/jira/browse/CALCITE-6419
Project: Calcite
Issue Type: Improvement
Components: core
Affects Versions: 1.37.0
Reporter: xiong duan
Assignee: xiong duan
Fix For: 1.38.0
When we execute SQL in Calcite:
{code:java}
select cast(product_id as varchar) from product;
{code}
Generage the HiveSQL\SparkSQL:
{code:java}
select cast(product_id as varchar) from product;
{code}
According to the
[https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-VarcharvarcharVarchar].
In Hive, the varchar must have a precision.So when unpare VARCHAR without
precision, I will convert VARCHAR to String. VARCHAR with precison do nothing.
According to the [https://spark.apache.org/docs/latest/sql-ref-datatypes.html].
In Spark, Same as Hive. But as note, It can only be used in table schema, not
functions/operators. So I will convert VARCHAR with or without precision to
String;
--
This message was sent by Atlassian Jira
(v8.20.10#820010)