Caican Cai created CALCITE-6522:
-----------------------------------

             Summary: MAP_KEYS and MAP_VALUES   function should throw if a key 
value is null
                 Key: CALCITE-6522
                 URL: https://issues.apache.org/jira/browse/CALCITE-6522
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.37.0
            Reporter: Caican Cai
             Fix For: 1.38.0


cala> val df = spark.sql("select map_keys(map(null,0))");
df: org.apache.spark.sql.DataFrame = [map_keys(map(NULL, 0)): array<void>]

scala> df.show();
org.apache.spark.SparkRuntimeException: [NULL_MAP_KEY] Cannot use null as map 
key.
  at 
org.apache.spark.sql.errors.QueryExecutionErrors$.nullAsMapKeyNotAllowedError(QueryExecutionErrors.scala:445)
  at 
org.apache.spark.sql.catalyst.util.ArrayBasedMapBuilder.put(ArrayBasedMapBuilder.scala:56)
  at 
org.apache.spark.sql.catalyst.expressions.CreateMap.eval(complexTypeCreator.scala:248)




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

Reply via email to