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

Extend Optiq's SqlOperatorTable to support Drill's custom functions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.4.0
    • None
    • None

    Description

      One approach is to implement DrillSqlOperatorTable which extends Optiq's ReflectiveSqlOperatorTable. Optiq has a notion of chained operator table with which we can simply add our specific operator table (DrillSqlOperatorTable) to its existing operator tables such that Optiq recognizes all functions defined in DrillSqlOperatorTable.

      The main requirement of this task is to not have yet another set of declaration of functions, we want to automatically declare Drill's custom functions in a format understood by Optiq.

      Below is the task breakdown:

      1. Registering of drill functions should take place before we register Optiq's functions. (This can be done as part of the "thinning out the JDBC client" task)

      2. Once we have a set of registered functions in Drill, we need to go through them and define them using Optiq's syntax (using SqlFunction() for example)

      3. Plugin DrillSqlOperatorTable into Optiq's ChainedSqlOperatorTable.

      One minor challenge might be to get around the way ReflectiveSqlOperatorTable works. ReflectiveSqlOperatorTable gets all the fields defined in the derived class (all fields in the derived class are operators or functions that need to be registered, eg: SqlStdOperatorTable) and adds it to a Map which it uses later to verify if the function/ operator exists. We need to come up with a way to automatically define these fields so that ReflectiveSqlOperatorTable picks them up.

      Attachments

        Activity

          People

            mehant Mehant Baid
            mehant Mehant Baid
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: