Class DruidTableMacro

java.lang.Object
org.apache.druid.sql.calcite.external.DruidTableMacro
All Implemented Interfaces:
org.apache.calcite.schema.Function, org.apache.calcite.schema.TableMacro, SchemaAwareUserDefinedTableMacro.ExtendedTableMacro

public class DruidTableMacro extends Object implements SchemaAwareUserDefinedTableMacro.ExtendedTableMacro
Table macro which wraps a catalog table function and which accepts a schema from an EXTENDS clause. This macro is wrapped by the DruidUserDefinedTableMacro operator that itself extends SchemaAwareUserDefinedTableMacro which interfaces with the extend operator to pass the schema via a "back channel." The plumbing is complex because we're adding functionality a bit outside the SQL standard, and we have to fit our logic into the Calcite stack.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DruidTableMacro(String name, TableFunction fn, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.calcite.schema.TranslatableTable
    apply(List<?> arguments)
    Called when the function is used without an EXTEND clause.
    org.apache.calcite.schema.TranslatableTable
    apply(List<?> arguments, org.apache.calcite.sql.SqlNodeList schema)
     
    com.fasterxml.jackson.databind.ObjectMapper
     
    List<org.apache.calcite.schema.FunctionParameter>
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • name

      protected final String name
  • Constructor Details

    • DruidTableMacro

      public DruidTableMacro(String name, TableFunction fn, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
  • Method Details

    • apply

      public org.apache.calcite.schema.TranslatableTable apply(List<?> arguments)
      Called when the function is used without an EXTEND clause. EXTERN allows this, most others do not.
      Specified by:
      apply in interface org.apache.calcite.schema.TableMacro
    • apply

      public org.apache.calcite.schema.TranslatableTable apply(List<?> arguments, org.apache.calcite.sql.SqlNodeList schema)
      Specified by:
      apply in interface SchemaAwareUserDefinedTableMacro.ExtendedTableMacro
    • getParameters

      public List<org.apache.calcite.schema.FunctionParameter> getParameters()
      Specified by:
      getParameters in interface org.apache.calcite.schema.Function
    • getJsonMapper

      public com.fasterxml.jackson.databind.ObjectMapper getJsonMapper()