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

Builder for relational expressions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.4.0-incubating
    • None
    • None

    Description

      Creating relational expressions currently involves calling the "create" method of the relevant sub-class of RelNode, often with a lot of obscure parameters. This might be appropriate for someone writing a rule, but is not particularly friendly to someone who wants to write queries using an API.

      We propose instead a builder. It would have a method for each core type of relational expression; for example a filter method that returns a Filter. For a given type, there might be overloads that allow you more control.

      Inside the builder is a factory for each operator type. Thus a builder could be configured to create logical rels (LogicalFilter, LogicalProject) or rels of a different convention (HiveFilter, HiveProject).

      Two particular areas that the builder can help. First, it can deduce the names and types of output columns. (You can override types, and optionally also names, or maybe just some names, using other APIs.)

      Second, it can help you build RexNode expressions. It knows the type and names of the input, it will let you build expressions in terms of column ordinals or names, which are easier than RexInputRefs.

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            julianhyde Julian Hyde
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: