public class DruidTable extends AbstractTable implements TranslatableTable
| Modifier and Type | Class and Description |
|---|---|
private static class |
DruidTable.MapRelProtoDataType
Creates a
RelDataType from a map of
field names and types. |
| Modifier and Type | Field and Description |
|---|---|
(package private) com.google.common.collect.ImmutableMap<String,SqlTypeName> |
allFields |
(package private) com.google.common.collect.ImmutableMap<String,List<ComplexMetric>> |
complexMetrics |
(package private) String |
dataSource |
static org.joda.time.Interval |
DEFAULT_INTERVAL |
static String |
DEFAULT_TIMESTAMP_COLUMN |
(package private) com.google.common.collect.ImmutableList<org.joda.time.Interval> |
intervals |
(package private) com.google.common.collect.ImmutableSet<String> |
metricFieldNames |
(package private) RelProtoDataType |
protoRowType |
(package private) DruidSchema |
schema |
(package private) String |
timestampFieldName |
| Constructor and Description |
|---|
DruidTable(DruidSchema schema,
String dataSource,
RelProtoDataType protoRowType,
Set<String> metricFieldNames,
String timestampFieldName,
List<org.joda.time.Interval> intervals,
Map<String,List<ComplexMetric>> complexMetrics,
Map<String,SqlTypeName> allFields)
Creates a Druid table.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) static Table |
create(DruidSchema druidSchema,
String dataSourceName,
List<org.joda.time.Interval> intervals,
Map<String,SqlTypeName> fieldMap,
Set<String> metricNameSet,
String timestampColumnName,
DruidConnectionImpl connection,
Map<String,List<ComplexMetric>> complexMetrics)
Creates a
DruidTable by using the given DruidConnectionImpl
to populate the other parameters. |
(package private) static Table |
create(DruidSchema druidSchema,
String dataSourceName,
List<org.joda.time.Interval> intervals,
Map<String,SqlTypeName> fieldMap,
Set<String> metricNameSet,
String timestampColumnName,
Map<String,List<ComplexMetric>> complexMetrics)
Creates a
DruidTable by copying the given parameters. |
List<ComplexMetric> |
getComplexMetricsFrom(String alias)
Returns the list of
ComplexMetric that match the given alias if it exists,
otherwise returns an empty list, never null |
RelDataType |
getRowType(RelDataTypeFactory typeFactory) |
boolean |
isComplexMetric(String alias)
Returns true if and only if the given
alias is a reference to a registered
ComplexMetric |
private boolean |
isCountDistinct(SqlCall call) |
boolean |
isMetric(String name) |
boolean |
isRolledUp(String column) |
private boolean |
isSupportedPostAggOperation(SqlKind kind) |
private boolean |
isValidParentKind(SqlNode node) |
ComplexMetric |
resolveComplexMetric(String alias,
AggregateCall call)
Returns the appropriate
ComplexMetric that is mapped from the given alias
if it exists, and is used in the expected context with the given AggregateCall. |
boolean |
rolledUpColumnValidInsideAgg(String column,
SqlCall call,
SqlNode parent,
CalciteConnectionConfig config) |
RelNode |
toRel(RelOptTable.ToRelContext context,
RelOptTable relOptTable) |
getJdbcTableType, getStatistic, unwrapclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetJdbcTableType, getStatisticpublic static final String DEFAULT_TIMESTAMP_COLUMN
public static final org.joda.time.Interval DEFAULT_INTERVAL
final DruidSchema schema
final String dataSource
final RelProtoDataType protoRowType
final com.google.common.collect.ImmutableSet<String> metricFieldNames
final com.google.common.collect.ImmutableList<org.joda.time.Interval> intervals
final String timestampFieldName
final com.google.common.collect.ImmutableMap<String,List<ComplexMetric>> complexMetrics
final com.google.common.collect.ImmutableMap<String,SqlTypeName> allFields
public DruidTable(DruidSchema schema, String dataSource, RelProtoDataType protoRowType, Set<String> metricFieldNames, String timestampFieldName, List<org.joda.time.Interval> intervals, Map<String,List<ComplexMetric>> complexMetrics, Map<String,SqlTypeName> allFields)
schema - Druid schema that contains this tabledataSource - Druid data source nameprotoRowType - Field names and typesmetricFieldNames - Names of fields that are metricsintervals - Default interval if query does not constrain the time, or nulltimestampFieldName - Name of the column that contains the timestatic Table create(DruidSchema druidSchema, String dataSourceName, List<org.joda.time.Interval> intervals, Map<String,SqlTypeName> fieldMap, Set<String> metricNameSet, String timestampColumnName, DruidConnectionImpl connection, Map<String,List<ComplexMetric>> complexMetrics)
DruidTable by using the given DruidConnectionImpl
to populate the other parameters. The parameters may be partially populated.druidSchema - Druid schemadataSourceName - Data source name in Druid, also table nameintervals - Intervals, or null to use defaultfieldMap - Partially populated map of fields (dimensions plus metrics)metricNameSet - Partially populated set of metric namestimestampColumnName - Name of timestamp column, or nullconnection - Connection used to find column definitions; Must be non-nullcomplexMetrics - List of complex metrics in Druid (thetaSketch, hyperUnique)static Table create(DruidSchema druidSchema, String dataSourceName, List<org.joda.time.Interval> intervals, Map<String,SqlTypeName> fieldMap, Set<String> metricNameSet, String timestampColumnName, Map<String,List<ComplexMetric>> complexMetrics)
DruidTable by copying the given parameters.druidSchema - Druid schemadataSourceName - Data source name in Druid, also table nameintervals - Intervals, or null to use defaultfieldMap - Fully populated map of fields (dimensions plus metrics)metricNameSet - Fully populated set of metric namestimestampColumnName - Name of timestamp column, or nullcomplexMetrics - List of complex metrics in Druid (thetaSketch, hyperUnique)public ComplexMetric resolveComplexMetric(String alias, AggregateCall call)
ComplexMetric that is mapped from the given alias
if it exists, and is used in the expected context with the given AggregateCall.
Otherwise returns null.public boolean isRolledUp(String column)
isRolledUp in interface TableisRolledUp in class AbstractTablepublic boolean rolledUpColumnValidInsideAgg(String column, SqlCall call, SqlNode parent, CalciteConnectionConfig config)
rolledUpColumnValidInsideAgg in interface TablerolledUpColumnValidInsideAgg in class AbstractTableprivate boolean isValidParentKind(SqlNode node)
private boolean isCountDistinct(SqlCall call)
private boolean isSupportedPostAggOperation(SqlKind kind)
public List<ComplexMetric> getComplexMetricsFrom(String alias)
ComplexMetric that match the given alias if it exists,
otherwise returns an empty list, never nullpublic boolean isComplexMetric(String alias)
alias is a reference to a registered
ComplexMetricpublic RelDataType getRowType(RelDataTypeFactory typeFactory)
getRowType in interface Tablepublic RelNode toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable)
toRel in interface TranslatableTablepublic boolean isMetric(String name)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.