Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-16947

Support type coercion and foldable expression for inline tables

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1.0
    • 2.0.1, 2.1.0
    • SQL
    • None

    Description

      Inline tables were added in to Spark SQL in 2.0, e.g.: select * from values (1, 'A'), (2, 'B') as tbl(a, b)

      This is currently implemented using a LocalRelation and this relation is created during parsing. This has several weaknesses: you can only use simple expressions in such a plan, and type coercion is based on the first row in the relation, and all subsequent values are cast in to this type. The latter violates the principle of least surprise.

      I would like to rewrite this into a union of projects; each of these projects would contain a single table row. We apply better type coercion rules to a union, and we should be able to rewrite this into a local relation during optimization.

      Attachments

        Issue Links

          Activity

            People

              petermaxlee Peter Lee
              hvanhovell Herman van Hövell
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: