You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Guillaume Massé (Jira)" <ji...@apache.org> on 2023/04/18 16:39:00 UTC

[jira] [Created] (CALCITE-5658) Collection types are un-parsed incorrectly for Apache Spark

Guillaume Massé created CALCITE-5658:
----------------------------------------

             Summary: Collection types are un-parsed incorrectly for Apache Spark
                 Key: CALCITE-5658
                 URL: https://issues.apache.org/jira/browse/CALCITE-5658
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.34.0
            Reporter: Guillaume Massé


See
https://spark.apache.org/docs/latest/sql-ref-datatypes.html

Complex types

Struct / Row:
{code:java}
SELECT CAST(NULL AS ROW(a INT, b INT)) t    -- Obtained
SELECT CAST(NULL AS struct<a:int, b:int>) t -- Expected{code}
Array:
{code:java}
SELECT CAST(NULL AS int array) t  -- Obtained
SELECT CAST(NULL AS array<int>) t -- Expected{code}
Map
{code:java}
SELECT CAST(NULL AS (INT, INT) MAP) -- This is unsupported in Calcite
SELECT CAST(NULL AS map<int, int>)  -- Expected{code}

This is probably another bug by itself:
{code:java}

java.lang.UnsupportedOperationException: Unsupported type when convertTypeToSpec: MAP
at org.apache.calcite.sql.type.SqlTypeUtil.convertTypeToSpec(SqlTypeUtil.java:1120)
at org.apache.calcite.sql.SqlDialect.getCastSpec(SqlDialect.java:848)
at org.apache.calcite.rel.rel2sql.RelToSqlConverter2.castNullType(RelToSqlConverter2.java:472)
at org.apache.calcite.rel.rel2sql.RelToSqlConverter2.visit(RelToSqlConverter2.java:454)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:532)
at org.apache.calcite.rel.rel2sql.RelToSqlConverter2.dispatch(RelToSqlConverter2.java:138){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)