@Override public Table load(@Nonnull String tableName) throws Exception { final Map<String, SqlTypeName> fieldMap = new LinkedHashMap<>(); final Set<String> metricNameSet = new LinkedHashSet<>(); final Map<String, List<ComplexMetric>> complexMetrics = new HashMap<>(); connection.metadata(tableName, DruidTable.DEFAULT_TIMESTAMP_COLUMN, null, fieldMap, metricNameSet, complexMetrics); return DruidTable.create(DruidSchema.this, tableName, null, fieldMap, metricNameSet, DruidTable.DEFAULT_TIMESTAMP_COLUMN, complexMetrics); } }));
private Table table(String tableName, DruidConnectionImpl connection) { final Map<String, SqlTypeName> fieldMap = new LinkedHashMap<>(); final Set<String> metricNameSet = new LinkedHashSet<>(); final Map<String, List<ComplexMetric>> complexMetrics = new HashMap<>(); connection.metadata(tableName, DruidTable.DEFAULT_TIMESTAMP_COLUMN, null, fieldMap, metricNameSet, complexMetrics); return DruidTable.create(DruidSchema.this, tableName, null, fieldMap, metricNameSet, DruidTable.DEFAULT_TIMESTAMP_COLUMN, complexMetrics); } }
/** Creates a {@link DruidTable} by using the given {@link DruidConnectionImpl} * to populate the other parameters. The parameters may be partially populated. * * @param druidSchema Druid schema * @param dataSourceName Data source name in Druid, also table name * @param intervals Intervals, or null to use default * @param fieldMap Partially populated map of fields (dimensions plus metrics) * @param metricNameSet Partially populated set of metric names * @param timestampColumnName Name of timestamp column, or null * @param connection Connection used to find column definitions; Must be non-null * @param complexMetrics List of complex metrics in Druid (thetaSketch, hyperUnique) * * @return A table */ static Table create(DruidSchema druidSchema, String dataSourceName, List<Interval> intervals, Map<String, SqlTypeName> fieldMap, Set<String> metricNameSet, String timestampColumnName, DruidConnectionImpl connection, Map<String, List<ComplexMetric>> complexMetrics) { assert connection != null; connection.metadata(dataSourceName, timestampColumnName, intervals, fieldMap, metricNameSet, complexMetrics); return DruidTable.create(druidSchema, dataSourceName, intervals, fieldMap, metricNameSet, timestampColumnName, complexMetrics); }
/** Creates a {@link DruidTable} by using the given {@link DruidConnectionImpl} * to populate the other parameters. The parameters may be partially populated. * * @param druidSchema Druid schema * @param dataSourceName Data source name in Druid, also table name * @param intervals Intervals, or null to use default * @param fieldMap Partially populated map of fields (dimensions plus metrics) * @param metricNameSet Partially populated set of metric names * @param timestampColumnName Name of timestamp column, or null * @param connection Connection used to find column definitions; Must be non-null * @param complexMetrics List of complex metrics in Druid (thetaSketch, hyperUnique) * * @return A table */ static Table create(DruidSchema druidSchema, String dataSourceName, List<Interval> intervals, Map<String, SqlTypeName> fieldMap, Set<String> metricNameSet, String timestampColumnName, DruidConnectionImpl connection, Map<String, List<ComplexMetric>> complexMetrics) { assert connection != null; connection.metadata(dataSourceName, timestampColumnName, intervals, fieldMap, metricNameSet, complexMetrics); return DruidTable.create(druidSchema, dataSourceName, intervals, fieldMap, metricNameSet, timestampColumnName, complexMetrics); }
DruidConnectionImpl connection = new DruidConnectionImpl(druidSchema.url, druidSchema.url.replace(":8082", ":8081")); return DruidTable.create(druidSchema, dataSourceName, intervals, fieldBuilder, metricNameBuilder, timestampColumnName, connection, complexMetrics); } else { return DruidTable.create(druidSchema, dataSourceName, intervals, fieldBuilder, metricNameBuilder, timestampColumnName, complexMetrics);
DruidConnectionImpl connection = new DruidConnectionImpl(druidSchema.url, druidSchema.url.replace(":8082", ":8081")); return DruidTable.create(druidSchema, dataSourceName, intervals, fieldBuilder, metricNameBuilder, timestampColumnName, connection, complexMetrics); } else { return DruidTable.create(druidSchema, dataSourceName, intervals, fieldBuilder, metricNameBuilder, timestampColumnName, complexMetrics);