Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-57

Add a logical operator that returns a constant result, similar to VALUES operator in SQL

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.1.0-m1
    • Component/s: None
    • Labels:
      None

      Description

      Add a logical operator that returns a constant result. This is necessary to be able to create values out of thin air, if you don't know what tables exist.

      This operator is analogous to the VALUES operator in SQL. For example,

      VALUES (1, 'a'), (2, 'b'), (3, 'c')

      returns 3 rows with 2 columns and

      VALUES (1, 'a'), (2, 'b'), (3, 'c') AS t(c1, c2)

      allows you to name those columns "c1" and "c2". VALUES is useful for evaluating expressions that don't belong in a table, for example

      VALUES 10 + 3

      (Some databases would express this "SELECT 10 + 3". Same idea, and same underlying relational operator.)

      The JSON for this new operator might look like this:

      {
      op: "constant",
      content: { [

      {c1: 1, c2: "a"}

      ,

      {c1: 2, c3: ["x", "y", "z"]}

      ] }
      }

      This operator is necessary in order to implement the SQL VALUES clause.

        Attachments

        1. types_meeting_6_5_13.txt
          4 kB
          Jason Altekruse
        2. constant.patch
          16 kB
          Jason Altekruse

          Activity

            People

            • Assignee:
              jaltekruse Jason Altekruse
              Reporter:
              julianhyde Julian Hyde
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: