Package org.apache.calcite.adapter.druid
Class DruidTable
java.lang.Object
org.apache.calcite.schema.impl.AbstractTable
org.apache.calcite.adapter.druid.DruidTable
- All Implemented Interfaces:
Table,TranslatableTable,Wrapper
Table mapped onto a Druid table.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDruidTable(DruidSchema schema, String dataSource, @Nullable RelProtoDataType protoRowType, Set<String> metricFieldNames, String timestampFieldName, @Nullable List<org.joda.time.Interval> intervals, @Nullable Map<String, List<ComplexMetric>> complexMetrics, @Nullable Map<String, SqlTypeName> allFields) Creates a Druid table. -
Method Summary
Modifier and TypeMethodDescriptiongetComplexMetricsFrom(String alias) Returns the list ofComplexMetricthat match the givenaliasif it exists, otherwise returns an empty list, nevernull.getRowType(RelDataTypeFactory typeFactory) Returns this table's row type.booleanisComplexMetric(String alias) Returns whether the givenaliasis a reference to a registeredComplexMetric.booleanbooleanisRolledUp(String column) Determines whether the givencolumnhas been rolled up.@Nullable ComplexMetricresolveComplexMetric(String alias, AggregateCall call) Returns the appropriateComplexMetricthat is mapped from the givenaliasif it exists, and is used in the expected context with the givenAggregateCall.booleanrolledUpColumnValidInsideAgg(String column, SqlCall call, @Nullable SqlNode parent, @Nullable CalciteConnectionConfig config) Determines whether the given rolled up column can be used inside the given aggregate function.toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable) Converts this table into arelational expression.Methods inherited from class org.apache.calcite.schema.impl.AbstractTable
getJdbcTableType, getStatistic, unwrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.schema.Table
getJdbcTableType, getStatisticMethods inherited from interface org.apache.calcite.schema.Wrapper
maybeUnwrap, unwrapOrThrow
-
Field Details
-
DEFAULT_TIMESTAMP_COLUMN
- See Also:
-
DEFAULT_INTERVAL
public static final org.joda.time.Interval DEFAULT_INTERVAL
-
-
Constructor Details
-
DruidTable
public DruidTable(DruidSchema schema, String dataSource, @Nullable RelProtoDataType protoRowType, Set<String> metricFieldNames, String timestampFieldName, @Nullable List<org.joda.time.Interval> intervals, @Nullable Map<String, List<ComplexMetric>> complexMetrics, @Nullable Map<String, SqlTypeName> allFields) Creates a Druid table.- Parameters:
schema- Druid schema that contains this tabledataSource- Druid data source nameprotoRowType- Field names and typesmetricFieldNames- Names of fields that are metricstimestampFieldName- Name of the column that contains the timeintervals- Default interval if query does not constrain the time, or null
-
-
Method Details
-
resolveComplexMetric
Returns the appropriateComplexMetricthat is mapped from the givenaliasif it exists, and is used in the expected context with the givenAggregateCall. Otherwise, returnsnull. -
isRolledUp
Description copied from interface:TableDetermines whether the givencolumnhas been rolled up.- Specified by:
isRolledUpin interfaceTable- Overrides:
isRolledUpin classAbstractTable
-
rolledUpColumnValidInsideAgg
public boolean rolledUpColumnValidInsideAgg(String column, SqlCall call, @Nullable SqlNode parent, @Nullable CalciteConnectionConfig config) Description copied from interface:TableDetermines whether the given rolled up column can be used inside the given aggregate function. You can assume thatisRolledUp(column)istrue.- Specified by:
rolledUpColumnValidInsideAggin interfaceTable- Overrides:
rolledUpColumnValidInsideAggin classAbstractTable- Parameters:
column- The column name for whichisRolledUpis truecall- The aggregate callparent- Parent node ofcallin theSqlNodetreeconfig- Config settings. May be null- Returns:
- true iff the given aggregate call is valid
-
getComplexMetricsFrom
Returns the list ofComplexMetricthat match the givenaliasif it exists, otherwise returns an empty list, nevernull. -
isComplexMetric
Returns whether the givenaliasis a reference to a registeredComplexMetric. -
getRowType
Description copied from interface:TableReturns this table's row type.This is a struct type whose fields describe the names and types of the columns in this table.
The implementer must use the type factory provided. This ensures that the type is converted into a canonical form; other equal types in the same query will use the same object.
- Specified by:
getRowTypein interfaceTable- Parameters:
typeFactory- Type factory with which to create the type- Returns:
- Row type
-
toRel
Description copied from interface:TranslatableTableConverts this table into arelational expression.- Specified by:
toRelin interfaceTranslatableTable
-
isMetric
-