[ 
https://issues.apache.org/jira/browse/CALCITE-5658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guillaume Massé updated CALCITE-5658:
-------------------------------------
    Description: 
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}
 

Update: Map was resolved in https://issues.apache.org/jira/browse/CALCITE-5570

  was:
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}


> 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é
>            Priority: Minor
>
> 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}
>  
> Update: Map was resolved in https://issues.apache.org/jira/browse/CALCITE-5570



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

Reply via email to