mirror of https://github.com/apache/druid.git
parent
c49fc2796b
commit
0d03cc5587
|
@ -5895,7 +5895,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
|
|||
public void testUnnestWithNotFiltersOnUnnestedColumn()
|
||||
{
|
||||
testQuery(
|
||||
"SELECT d3,MV_TO_ARRAY(dim3) FROM druid.numfoo, UNNEST(MV_TO_ARRAY(dim3)) as unnested (d3) where d3!='d' ",
|
||||
"SELECT d3 FROM druid.numfoo, UNNEST(MV_TO_ARRAY(dim3)) as unnested (d3) where d3!='d' ",
|
||||
QUERY_CONTEXT_UNNEST,
|
||||
ImmutableList.of(
|
||||
Druids.newScanQueryBuilder()
|
||||
|
|
|
@ -1058,7 +1058,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
public void testAnyAggregatorsOnHeapNumericNulls()
|
||||
{
|
||||
testQuery(
|
||||
"SELECT ANY_VALUE(l1), ANY_VALUE(dbl1), ANY_VALUE(f1) FROM druid.numfoo",
|
||||
"SELECT ANY_VALUE(l1), ANY_VALUE(d1), ANY_VALUE(f1) FROM druid.numfoo",
|
||||
ImmutableList.of(
|
||||
Druids.newTimeseriesQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
|
@ -1119,17 +1119,17 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
public void testAnyAggregatorsOffHeapNumericNulls()
|
||||
{
|
||||
testQuery(
|
||||
"SELECT ANY_VALUE(l1), ANY_VALUE(dbl1), ANY_VALUE(f1) FROM druid.numfoo GROUP BY dim2",
|
||||
"SELECT ANY_VALUE(l1), ANY_VALUE(d1), ANY_VALUE(f1) FROM druid.numfoo GROUP BY dim2",
|
||||
ImmutableList.of(
|
||||
GroupByQuery.builder()
|
||||
.setDataSource(CalciteTests.DATASOURCE3)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("dim2", "d0")))
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("dim2", "_d0")))
|
||||
.setAggregatorSpecs(
|
||||
aggregators(
|
||||
new LongAnyAggregatorFactory("a0", "l1"),
|
||||
new DoubleAnyAggregatorFactory("a1", "dbl1"),
|
||||
new DoubleAnyAggregatorFactory("a1", "d1"),
|
||||
new FloatAnyAggregatorFactory("a2", "f1")
|
||||
)
|
||||
)
|
||||
|
@ -1246,7 +1246,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setDataSource(CalciteTests.DATASOURCE3)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("dim2", "d0")))
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("dim2", "_d0")))
|
||||
.setAggregatorSpecs(aggregators(
|
||||
new StringLastAggregatorFactory("a0", "dim4", null, 10)
|
||||
)
|
||||
|
@ -1712,7 +1712,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
public void testEarliestAggregatorsNumericNulls()
|
||||
{
|
||||
testQuery(
|
||||
"SELECT EARLIEST(l1), EARLIEST(dbl1), EARLIEST(f1) FROM druid.numfoo",
|
||||
"SELECT EARLIEST(l1), EARLIEST(d1), EARLIEST(f1) FROM druid.numfoo",
|
||||
ImmutableList.of(
|
||||
Druids.newTimeseriesQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
|
@ -1739,7 +1739,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
{
|
||||
msqIncompatible();
|
||||
testQuery(
|
||||
"SELECT LATEST(l1), LATEST(dbl1), LATEST(f1) FROM druid.numfoo",
|
||||
"SELECT LATEST(l1), LATEST(d1), LATEST(f1) FROM druid.numfoo",
|
||||
ImmutableList.of(
|
||||
Druids.newTimeseriesQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
|
@ -1780,7 +1780,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
);
|
||||
}
|
||||
testQuery(
|
||||
"SELECT EARLIEST(dim1, 32), LATEST(l1), LATEST(dbl1), LATEST(f1) "
|
||||
"SELECT EARLIEST(dim1, 32), LATEST(l1), LATEST(d1), LATEST(f1) "
|
||||
+ "FROM druid.numfoo "
|
||||
+ "WHERE dim1 IS NOT NULL AND l1 IS NOT NULL AND d1 IS NOT NULL AND f1 is NOT NULL",
|
||||
ImmutableList.of(
|
||||
|
@ -1907,7 +1907,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new FloatFirstAggregatorFactory("a0", "f1", null)
|
||||
|
@ -1946,13 +1946,13 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
);
|
||||
}
|
||||
testQuery(
|
||||
"SELECT dim1, EARLIEST(dbl1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
|
||||
"SELECT dim1, EARLIEST(d1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
|
||||
ImmutableList.of(
|
||||
new TopNQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new DoubleFirstAggregatorFactory("a0", "d1", null)
|
||||
|
@ -1997,7 +1997,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new LongFirstAggregatorFactory("a0", "l1", null)
|
||||
|
@ -2044,7 +2044,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new FloatLastAggregatorFactory("a0", "f1", null)
|
||||
|
@ -2084,16 +2084,16 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
);
|
||||
}
|
||||
testQuery(
|
||||
"SELECT dim1, LATEST(dbl1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
|
||||
"SELECT dim1, LATEST(d1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
|
||||
ImmutableList.of(
|
||||
new TopNQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new DoubleLastAggregatorFactory("a0", "dbl1", null)
|
||||
new DoubleLastAggregatorFactory("a0", "d1", null)
|
||||
)
|
||||
)
|
||||
.metric(new InvertedTopNMetricSpec(new NumericTopNMetricSpec("a0")))
|
||||
|
@ -2136,7 +2136,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new LongLastAggregatorFactory("a0", "l1", null)
|
||||
|
@ -2187,7 +2187,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new FloatAnyAggregatorFactory("a0", "f1")
|
||||
|
@ -2231,13 +2231,13 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
);
|
||||
}
|
||||
testQuery(
|
||||
"SELECT dim1, ANY_VALUE(dbl1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
|
||||
"SELECT dim1, ANY_VALUE(d1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
|
||||
ImmutableList.of(
|
||||
new TopNQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new DoubleAnyAggregatorFactory("a0", "d1")
|
||||
|
@ -2287,7 +2287,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.granularity(Granularities.ALL)
|
||||
.dimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.dimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.aggregators(
|
||||
aggregators(
|
||||
new LongAnyAggregatorFactory("a0", "l1")
|
||||
|
@ -2703,7 +2703,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("d0", "d0", ColumnType.STRING)))
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("d0", "_d0", ColumnType.STRING)))
|
||||
.setAggregatorSpecs(
|
||||
aggregators(
|
||||
useDefault
|
||||
|
@ -3703,7 +3703,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
new TopNQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.dimension(new DefaultDimensionSpec("d1", "d0", ColumnType.DOUBLE))
|
||||
.dimension(new DefaultDimensionSpec("d1", "_d0", ColumnType.DOUBLE))
|
||||
.threshold(10)
|
||||
.aggregators(aggregators(new CountAggregatorFactory("a0")))
|
||||
.metric(
|
||||
|
@ -3747,7 +3747,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
new TopNQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.dimension(new DefaultDimensionSpec("f1", "d0", ColumnType.FLOAT))
|
||||
.dimension(new DefaultDimensionSpec("f1", "_d0", ColumnType.FLOAT))
|
||||
.threshold(10)
|
||||
.aggregators(aggregators(new CountAggregatorFactory("a0")))
|
||||
.metric(
|
||||
|
@ -3791,7 +3791,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
new TopNQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.dimension(new DefaultDimensionSpec("l1", "d0", ColumnType.LONG))
|
||||
.dimension(new DefaultDimensionSpec("l1", "_d0", ColumnType.LONG))
|
||||
.threshold(10)
|
||||
.aggregators(aggregators(new CountAggregatorFactory("a0")))
|
||||
.metric(
|
||||
|
@ -3873,7 +3873,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
testQuery(
|
||||
"SELECT COUNT(*)\n"
|
||||
+ "FROM druid.numfoo\n"
|
||||
+ "WHERE dbl1 > 0",
|
||||
+ "WHERE d1 > 0",
|
||||
ImmutableList.of(
|
||||
Druids.newTimeseriesQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
|
@ -4907,7 +4907,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
public void testSimpleDoubleAggregations()
|
||||
{
|
||||
testQuery(
|
||||
"SELECT MIN(dbl1), MAX(dbl1) FROM druid.numfoo",
|
||||
"SELECT MIN(d1), MAX(d1) FROM druid.numfoo",
|
||||
ImmutableList.of(
|
||||
Druids.newTimeseriesQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
|
@ -4953,7 +4953,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
public void testSimpleAggregations()
|
||||
{
|
||||
testQuery(
|
||||
"SELECT COUNT(*), COUNT(cnt), COUNT(dim1), AVG(cnt), SUM(cnt), SUM(cnt) + MIN(cnt) + MAX(cnt), COUNT(dim2), COUNT(dbl1), AVG(dbl1) FROM druid.numfoo",
|
||||
"SELECT COUNT(*), COUNT(cnt), COUNT(dim1), AVG(cnt), SUM(cnt), SUM(cnt) + MIN(cnt) + MAX(cnt), COUNT(dim2), COUNT(d1), AVG(d1) FROM druid.numfoo",
|
||||
ImmutableList.of(
|
||||
|
||||
Druids.newTimeseriesQueryBuilder()
|
||||
|
@ -7656,7 +7656,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("d0", "d0")))
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("d0", "_d0")))
|
||||
.setAggregatorSpecs(aggregators(
|
||||
new LongSumAggregatorFactory("_a0", "a0"),
|
||||
new FilteredAggregatorFactory(
|
||||
|
@ -7726,7 +7726,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setDimensions(new DefaultDimensionSpec("d0", "d0", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("d0", "_d0", ColumnType.STRING))
|
||||
.setAggregatorSpecs(
|
||||
new FilteredAggregatorFactory(
|
||||
new CountAggregatorFactory("a0"),
|
||||
|
@ -7757,7 +7757,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setDimensions(new DefaultDimensionSpec("d0", "d0", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("d0", "_d0", ColumnType.STRING))
|
||||
.setAggregatorSpecs(
|
||||
NullHandling.sqlCompatible()
|
||||
? new FilteredAggregatorFactory(
|
||||
|
@ -7898,7 +7898,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("d0", "d0", ColumnType.LONG)))
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("d0", "_d0", ColumnType.LONG)))
|
||||
.setAggregatorSpecs(aggregators(
|
||||
new FilteredAggregatorFactory(
|
||||
new CountAggregatorFactory("_a0"),
|
||||
|
@ -8086,8 +8086,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
)
|
||||
.setDimensions(dimensions(
|
||||
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG),
|
||||
new DefaultDimensionSpec("d0", "d1", ColumnType.STRING)
|
||||
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG),
|
||||
new DefaultDimensionSpec("d0", "_d1", ColumnType.STRING)
|
||||
))
|
||||
.setAggregatorSpecs(
|
||||
aggregators(
|
||||
|
@ -8143,7 +8143,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("d1", "d0")))
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("d1", "_d0")))
|
||||
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("_a0", "a0")))
|
||||
.setContext(QUERY_CONTEXT_DEFAULT)
|
||||
.build()
|
||||
|
@ -8200,7 +8200,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(new DefaultDimensionSpec("d1", "d0"))
|
||||
.setDimensions(new DefaultDimensionSpec("d1", "_d0"))
|
||||
.setAggregatorSpecs(new LongMaxAggregatorFactory("_a0", "a0"))
|
||||
.setContext(QUERY_CONTEXT_DEFAULT)
|
||||
.build()
|
||||
|
@ -8539,7 +8539,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("a0", "d0")))
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("a0", "_d0")))
|
||||
.setAggregatorSpecs(aggregators(
|
||||
new CountAggregatorFactory("_a0")
|
||||
))
|
||||
|
@ -8584,14 +8584,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("a0", "d0")))
|
||||
.setDimensions(dimensions(new DefaultDimensionSpec("a0", "_d0")))
|
||||
.setAggregatorSpecs(aggregators(
|
||||
new CountAggregatorFactory("_a0")
|
||||
))
|
||||
.setLimitSpec(
|
||||
new DefaultLimitSpec(
|
||||
ImmutableList.of(new OrderByColumnSpec(
|
||||
"d0",
|
||||
"_d0",
|
||||
OrderByColumnSpec.Direction.ASCENDING,
|
||||
StringComparators.LEXICOGRAPHIC
|
||||
)),
|
||||
|
@ -9038,8 +9038,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(
|
||||
dimensions(
|
||||
new DefaultDimensionSpec("v0", "d0"),
|
||||
new ExtractionDimensionSpec("dim5", "d1", new SubstringDimExtractionFn(0, 1))
|
||||
new DefaultDimensionSpec("v0", "_d0"),
|
||||
new ExtractionDimensionSpec("dim5", "_d1", new SubstringDimExtractionFn(0, 1))
|
||||
)
|
||||
)
|
||||
.setVirtualColumns(expressionVirtualColumn("v0", "'a'", ColumnType.STRING))
|
||||
|
@ -10367,14 +10367,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
+ " count(*),\n"
|
||||
+ " COUNT(DISTINCT dim1),\n"
|
||||
+ " APPROX_COUNT_DISTINCT(distinct dim1),\n"
|
||||
+ " sum(dbl1),\n"
|
||||
+ " max(dbl1),\n"
|
||||
+ " min(dbl1),\n"
|
||||
+ " sum(d1),\n"
|
||||
+ " max(d1),\n"
|
||||
+ " min(d1),\n"
|
||||
+ " sum(l1),\n"
|
||||
+ " max(l1),\n"
|
||||
+ " min(l1),\n"
|
||||
+ " avg(l1),\n"
|
||||
+ " avg(dbl1)\n"
|
||||
+ " avg(d1)\n"
|
||||
+ "FROM druid.numfoo WHERE dim2 = 0",
|
||||
ImmutableList.of(
|
||||
Druids.newTimeseriesQueryBuilder()
|
||||
|
@ -10634,14 +10634,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
+ " count(*) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " COUNT(DISTINCT dim1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " APPROX_COUNT_DISTINCT(distinct dim1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " sum(dbl1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " max(dbl1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " min(dbl1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " sum(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " max(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " min(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " sum(l1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " max(l1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " min(l1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " avg(l1) FILTER(WHERE dim1 = 'nonexistent'),\n"
|
||||
+ " avg(dbl1) FILTER(WHERE dim1 = 'nonexistent')\n"
|
||||
+ " avg(d1) FILTER(WHERE dim1 = 'nonexistent')\n"
|
||||
+ "FROM druid.numfoo WHERE dim2 = 'a' GROUP BY dim2",
|
||||
ImmutableList.of(
|
||||
GroupByQuery.builder()
|
||||
|
@ -10650,7 +10650,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setDimFilter(equality("dim2", "a", ColumnType.STRING))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setVirtualColumns(expressionVirtualColumn("v0", "'a'", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("v0", "d0", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING))
|
||||
.setAggregatorSpecs(
|
||||
aggregators(
|
||||
new FilteredAggregatorFactory(
|
||||
|
@ -10807,7 +10807,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setDimFilter(equality("dim2", "a", ColumnType.STRING))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setVirtualColumns(expressionVirtualColumn("v0", "'a'", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("v0", "d0", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING))
|
||||
.setAggregatorSpecs(
|
||||
aggregators(
|
||||
new FilteredAggregatorFactory(
|
||||
|
@ -11458,17 +11458,17 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(
|
||||
dimensions(
|
||||
new DefaultDimensionSpec("d1", "d0"),
|
||||
new DefaultDimensionSpec("p0", "d1", ColumnType.LONG)
|
||||
new DefaultDimensionSpec("d1", "_d0"),
|
||||
new DefaultDimensionSpec("p0", "_d1", ColumnType.LONG)
|
||||
)
|
||||
)
|
||||
.setAggregatorSpecs(aggregators(new DoubleSumAggregatorFactory("_a0", "a0")))
|
||||
.setLimitSpec(
|
||||
new DefaultLimitSpec(
|
||||
ImmutableList.of(
|
||||
new OrderByColumnSpec("d0", OrderByColumnSpec.Direction.ASCENDING),
|
||||
new OrderByColumnSpec("_d0", OrderByColumnSpec.Direction.ASCENDING),
|
||||
new OrderByColumnSpec(
|
||||
"d1",
|
||||
"_d1",
|
||||
Direction.DESCENDING,
|
||||
StringComparators.NUMERIC
|
||||
)
|
||||
|
@ -12521,8 +12521,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(
|
||||
dimensions(
|
||||
new DefaultDimensionSpec("d0", "d0", ColumnType.LONG),
|
||||
new DefaultDimensionSpec("d1", "d1", ColumnType.STRING)
|
||||
new DefaultDimensionSpec("d0", "_d0", ColumnType.LONG),
|
||||
new DefaultDimensionSpec("d1", "_d1", ColumnType.STRING)
|
||||
)
|
||||
)
|
||||
.setAggregatorSpecs(
|
||||
|
@ -13536,7 +13536,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setDataSource(CalciteTests.DATASOURCE3)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(new DefaultDimensionSpec("dim4", "d0", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("dim4", "_d0", ColumnType.STRING))
|
||||
.setContext(QUERY_CONTEXT_DEFAULT)
|
||||
.build()
|
||||
)
|
||||
|
@ -13548,15 +13548,15 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
),
|
||||
expressionVirtualColumn(
|
||||
"v1",
|
||||
"case_searched((\"d0\" == 'b'),\"d0\",null)",
|
||||
"case_searched((\"_d0\" == 'b'),\"_d0\",null)",
|
||||
ColumnType.STRING
|
||||
)
|
||||
)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setDimensions(
|
||||
dimensions(
|
||||
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING),
|
||||
new DefaultDimensionSpec("v1", "_d1", ColumnType.STRING)
|
||||
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING),
|
||||
new DefaultDimensionSpec("v1", "d1", ColumnType.STRING)
|
||||
)
|
||||
)
|
||||
.setGranularity(Granularities.ALL)
|
||||
|
@ -14129,7 +14129,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setVirtualColumns(VirtualColumns.create(virtualColumns))
|
||||
.setDimensions(new DefaultDimensionSpec("dim5", "d0", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("dim5", "_d0", ColumnType.STRING))
|
||||
.setAggregatorSpecs(aggs)
|
||||
.setPostAggregatorSpecs(
|
||||
ImmutableList.of(
|
||||
|
@ -14304,7 +14304,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setDataSource(CalciteTests.DATASOURCE3)
|
||||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(new DefaultDimensionSpec("dim2", "d0", ColumnType.STRING))
|
||||
.setDimensions(new DefaultDimensionSpec("dim2", "_d0", ColumnType.STRING))
|
||||
.setAggregatorSpecs(
|
||||
aggregators(
|
||||
new FilteredAggregatorFactory(
|
||||
|
@ -14551,7 +14551,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
{
|
||||
cannotVectorize();
|
||||
testQuery(
|
||||
"SELECT STRING_AGG(l1, ','), STRING_AGG(DISTINCT l1, ','), STRING_AGG(dbl1, ','), STRING_AGG(DISTINCT d1, ','), STRING_AGG(f1, ','), STRING_AGG(DISTINCT f1, ',') FROM numfoo",
|
||||
"SELECT STRING_AGG(l1, ','), STRING_AGG(DISTINCT l1, ','), STRING_AGG(d1, ','), STRING_AGG(DISTINCT d1, ','), STRING_AGG(f1, ','), STRING_AGG(DISTINCT f1, ',') FROM numfoo",
|
||||
ImmutableList.of(
|
||||
Druids.newTimeseriesQueryBuilder()
|
||||
.dataSource(CalciteTests.DATASOURCE3)
|
||||
|
@ -15173,7 +15173,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setDataSource(CalciteTests.DATASOURCE3)
|
||||
.setInterval(querySegmentSpec(Intervals.ETERNITY))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.addDimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.addDimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.setPostAggregatorSpecs(ImmutableList.of(
|
||||
expressionPostAgg("p0", "0", ColumnType.LONG)
|
||||
))
|
||||
|
@ -15200,7 +15200,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
)
|
||||
.setGranularity(Granularities.ALL)
|
||||
.addDimension(new DefaultDimensionSpec("dim1", "d0"))
|
||||
.addDimension(new DefaultDimensionSpec("dim1", "_d0"))
|
||||
.addAggregator(new LongMaxAggregatorFactory("a0", "v0"))
|
||||
.setPostAggregatorSpecs(ImmutableList.of(
|
||||
expressionPostAgg("p0", "isnull(\"a0\")", ColumnType.LONG)
|
||||
|
@ -15238,7 +15238,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
)
|
||||
)
|
||||
.setGranularity(Granularities.ALL)
|
||||
.addDimension(new DefaultDimensionSpec("l1", "d0", ColumnType.LONG))
|
||||
.addDimension(new DefaultDimensionSpec("l1", "_d0", ColumnType.LONG))
|
||||
.addAggregator(new StringLastAggregatorFactory("a0", "v0", null, 1024))
|
||||
.setPostAggregatorSpecs(ImmutableList.of(
|
||||
expressionPostAgg("p0", "isnull(\"a0\")", ColumnType.LONG)
|
||||
|
@ -15280,7 +15280,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setDataSource(CalciteTests.DATASOURCE3)
|
||||
.setInterval(querySegmentSpec(Intervals.ETERNITY))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.addDimension(new DefaultDimensionSpec("dim1", "d0", ColumnType.STRING))
|
||||
.addDimension(new DefaultDimensionSpec("dim1", "_d0", ColumnType.STRING))
|
||||
.addAggregator(new LongSumAggregatorFactory("a0", "l1"))
|
||||
.setPostAggregatorSpecs(ImmutableList.of(
|
||||
expressionPostAgg("p0", "case_searched((\"a0\" == 0),1,0)", ColumnType.LONG)))
|
||||
|
@ -16273,8 +16273,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||
.setGranularity(Granularities.ALL)
|
||||
.setDimensions(
|
||||
new DefaultDimensionSpec("__time", "d0", ColumnType.LONG),
|
||||
new DefaultDimensionSpec("m1", "d1", ColumnType.FLOAT)
|
||||
new DefaultDimensionSpec("__time", "_d0", ColumnType.LONG),
|
||||
new DefaultDimensionSpec("m1", "_d1", ColumnType.FLOAT)
|
||||
)
|
||||
.setAggregatorSpecs(aggregators(new FloatLastAggregatorFactory("a0", "m1", "m2")))
|
||||
.setContext(OUTER_LIMIT_CONTEXT)
|
||||
|
|
|
@ -115,9 +115,6 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class TestDataBuilder
|
||||
{
|
||||
private static final String D1 = "dbl1";
|
||||
private static final String D2 = "dbl2";
|
||||
|
||||
private static final ObjectMapper MAPPER = new DefaultObjectMapper();
|
||||
|
||||
public static final String TIMESTAMP_COLUMN = "t";
|
||||
|
@ -174,8 +171,8 @@ public class TestDataBuilder
|
|||
"dim5",
|
||||
"dim6"
|
||||
)))
|
||||
.add(new DoubleDimensionSchema(D1))
|
||||
.add(new DoubleDimensionSchema(D2))
|
||||
.add(new DoubleDimensionSchema("d1"))
|
||||
.add(new DoubleDimensionSchema("d2"))
|
||||
.add(new FloatDimensionSchema("f1"))
|
||||
.add(new FloatDimensionSchema("f2"))
|
||||
.add(new LongDimensionSchema("l1"))
|
||||
|
@ -393,7 +390,7 @@ public class TestDataBuilder
|
|||
.put("t", "2000-01-01")
|
||||
.put("m1", "1.0")
|
||||
.put("m2", "1.0")
|
||||
.put(D1, 1.0)
|
||||
.put("d1", 1.0)
|
||||
.put("f1", 1.0f)
|
||||
.put("l1", 7L)
|
||||
.put("dim1", "")
|
||||
|
@ -407,8 +404,8 @@ public class TestDataBuilder
|
|||
.put("t", "2000-01-02")
|
||||
.put("m1", "2.0")
|
||||
.put("m2", "2.0")
|
||||
.put(D1, 1.7)
|
||||
.put(D2, 1.7)
|
||||
.put("d1", 1.7)
|
||||
.put("d2", 1.7)
|
||||
.put("f1", 0.1f)
|
||||
.put("f2", 0.1f)
|
||||
.put("l1", 325323L)
|
||||
|
@ -424,8 +421,8 @@ public class TestDataBuilder
|
|||
.put("t", "2000-01-03")
|
||||
.put("m1", "3.0")
|
||||
.put("m2", "3.0")
|
||||
.put(D1, 0.0)
|
||||
.put(D2, 0.0)
|
||||
.put("d1", 0.0)
|
||||
.put("d2", 0.0)
|
||||
.put("f1", 0.0)
|
||||
.put("f2", 0.0)
|
||||
.put("l1", 0)
|
||||
|
@ -597,8 +594,8 @@ public class TestDataBuilder
|
|||
x.get("dim3"),
|
||||
x.get("dim4"),
|
||||
x.get("dim5"),
|
||||
x.get(D1),
|
||||
x.get(D2),
|
||||
x.get("d1"),
|
||||
x.get("d2"),
|
||||
x.get("f1"),
|
||||
x.get("f2"),
|
||||
x.get("l1"),
|
||||
|
@ -610,8 +607,8 @@ public class TestDataBuilder
|
|||
.add("dim3", ColumnType.STRING)
|
||||
.add("dim4", ColumnType.STRING)
|
||||
.add("dim5", ColumnType.STRING)
|
||||
.add(D1, ColumnType.DOUBLE)
|
||||
.add(D2, ColumnType.DOUBLE)
|
||||
.add("d1", ColumnType.DOUBLE)
|
||||
.add("d2", ColumnType.DOUBLE)
|
||||
.add("f1", ColumnType.FLOAT)
|
||||
.add("f2", ColumnType.FLOAT)
|
||||
.add("l1", ColumnType.LONG)
|
||||
|
|
Loading…
Reference in New Issue