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/05/15 18:48:00 UTC

[jira] [Created] (CALCITE-5701) Implement Apache Spark named_struct

Guillaume Massé created CALCITE-5701:
----------------------------------------

             Summary: Implement Apache Spark named_struct
                 Key: CALCITE-5701
                 URL: https://issues.apache.org/jira/browse/CALCITE-5701
             Project: Calcite
          Issue Type: New Feature
          Components: core
            Reporter: Guillaume Massé


[https://spark.apache.org/docs/3.4.0/api/sql/index.html#named_struct]

 
{code:java}
spark.sql("""select named_struct("a", 1, "b", 2)""")
res4: org.apache.spark.sql.DataFrame = [named_struct(a, 1, b, 2): struct<a: int, b: int>]{code}
 

It's also possible to be nested:
{code:java}
spark.sql("""select named_struct("a", 1, "b", named_struct("c", 2))""")
res5: org.apache.spark.sql.DataFrame = [named_struct(a, 1, b, named_struct(c, 2)): struct<a: int, b: struct<c: int>>] {code}



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