Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5701

Add NAMED_STRUCT function (enabled in Spark library)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • core

    Description

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

       

      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>]
      
      
      Calcite:
      SELECT named_struct('a', 1, 'b", 2);
      type: row(a int not null, b int not null)

       

      It's also possible to be nested:

      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>>] 
      Calcite:
      SELECT named_struct('a', 1, 'b', named_struct('c', 2));
      type: row(a int not null, b row(c int not null) not null)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              MasseGuillaume Guillaume Massé
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: