Rename d1/d2 columns in tests (#17471)

This commit is contained in:
Zoltan Haindrich 2024-11-22 14:58:56 +01:00 committed by GitHub
parent 74422b58f5
commit 20aea29a51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 391 additions and 396 deletions

View File

@ -289,7 +289,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
new HllSketchBuildAggregatorFactory("hllsketch_m1", "m1", null, null, null, false, ROUND),
new HllSketchBuildAggregatorFactory("hllsketch_f1", "f1", null, null, null, false, ROUND),
new HllSketchBuildAggregatorFactory("hllsketch_l1", "l1", null, null, null, false, ROUND),
new HllSketchBuildAggregatorFactory("hllsketch_d1", "d1", null, null, null, false, ROUND)
new HllSketchBuildAggregatorFactory("hllsketch_dbl1", "dbl1", null, null, null, false, ROUND)
)
.withRollup(false)
.build()
@ -502,7 +502,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
GroupByQuery.builder()
.setInterval(querySegmentSpec(Filtration.eternity()))
.setDataSource(CalciteTests.DATASOURCE1)
.setDimensions(dimensions(new DefaultDimensionSpec("dim2", "_d0")))
.setDimensions(dimensions(new DefaultDimensionSpec("dim2", "d0")))
.setGranularity(Granularities.ALL)
.setAggregatorSpecs(
aggregators(
@ -574,7 +574,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
.setInterval(new MultipleIntervalSegmentSpec(Collections.singletonList(Filtration.eternity())))
.setGranularity(Granularities.ALL)
.setVirtualColumns(VirtualColumns.create(EXPECTED_PA_VIRTUAL_COLUMNS))
.setDimensions(new DefaultDimensionSpec("cnt", "_d0", ColumnType.LONG))
.setDimensions(new DefaultDimensionSpec("cnt", "d0", ColumnType.LONG))
.setAggregatorSpecs(EXPECTED_FILTERED_AGGREGATORS)
.setPostAggregatorSpecs(EXPECTED_FILTERED_POST_AGGREGATORS)
.setContext(QUERY_CONTEXT_DEFAULT)
@ -669,7 +669,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
.setInterval(new MultipleIntervalSegmentSpec(Collections.singletonList(Filtration.eternity())))
.setGranularity(Granularities.ALL)
.setVirtualColumns(VirtualColumns.create(EXPECTED_PA_VIRTUAL_COLUMNS))
.setDimensions(new DefaultDimensionSpec("cnt", "_d0", ColumnType.LONG))
.setDimensions(new DefaultDimensionSpec("cnt", "d0", ColumnType.LONG))
.setAggregatorSpecs(EXPECTED_PA_AGGREGATORS)
.setPostAggregatorSpecs(EXPECTED_PA_POST_AGGREGATORS)
.setContext(QUERY_CONTEXT_DEFAULT)
@ -950,7 +950,7 @@ public class HllSketchSqlAggregatorTest 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(
@ -1009,7 +1009,7 @@ public class HllSketchSqlAggregatorTest 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(
@ -1035,7 +1035,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
testQuery(
"SELECT"
+ " HLL_SKETCH_ESTIMATE(hllsketch_dim1),"
+ " HLL_SKETCH_ESTIMATE(hllsketch_d1),"
+ " HLL_SKETCH_ESTIMATE(hllsketch_dbl1),"
+ " HLL_SKETCH_ESTIMATE(hllsketch_l1),"
+ " HLL_SKETCH_ESTIMATE(hllsketch_f1)"
+ " FROM druid.foo",
@ -1045,7 +1045,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
.intervals(querySegmentSpec(Filtration.eternity()))
.virtualColumns(
makeSketchEstimateExpression("v0", "hllsketch_dim1"),
makeSketchEstimateExpression("v1", "hllsketch_d1"),
makeSketchEstimateExpression("v1", "hllsketch_dbl1"),
makeSketchEstimateExpression("v2", "hllsketch_l1"),
makeSketchEstimateExpression("v3", "hllsketch_f1")
)
@ -1155,7 +1155,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
.setGranularity(Granularities.ALL)
.setVirtualColumns(makeSketchEstimateExpression("v0", "hllsketch_dim1"))
.setDimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.DOUBLE))
new DefaultDimensionSpec("v0", "d0", ColumnType.DOUBLE))
.setAggregatorSpecs(
aggregators(
new CountAggregatorFactory("a0")
@ -1197,7 +1197,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
.dataSource(CalciteTests.DATASOURCE1)
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.dimension(new DefaultDimensionSpec("v0", "_d0", ColumnType.DOUBLE))
.dimension(new DefaultDimensionSpec("v0", "d0", ColumnType.DOUBLE))
.virtualColumns(makeSketchEstimateExpression("v0", "hllsketch_dim1"))
.metric(new InvertedTopNMetricSpec(new NumericTopNMetricSpec("a0")))
.threshold(2)
@ -1266,9 +1266,9 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
/**
* This is an extremely subtle test, so we explain with a comment. The `m1` column in the input data looks like
* `["1.0", "2.0", "3.0", "4.0", "5.0", "6.0"]` while the `d1` column looks like
* `[1.0, 1.7, 0.0]`. That is, "m1" is numbers-as-strings, while d1 is numbers-as-numbers. If you take the
* uniques across both columns, you expect no overlap, so 9 entries. However, if the `1.0` from `d1` gets
* `["1.0", "2.0", "3.0", "4.0", "5.0", "6.0"]` while the `dbl1` column looks like
* `[1.0, 1.7, 0.0]`. That is, "m1" is numbers-as-strings, while dbl1 is numbers-as-numbers. If you take the
* uniques across both columns, you expect no overlap, so 9 entries. However, if the `1.0` from `dbl1` gets
* converted into `"1.0"` or vice-versa, the result can become 8 because then the sketch will hash the same
* value multiple times considering them duplicates. This test validates that the aggregator properly builds
* the sketches preserving the initial type of the data as it came in. Specifically, the test was added when
@ -1280,7 +1280,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
{
testQuery(
"SELECT"
+ " HLL_SKETCH_ESTIMATE(HLL_SKETCH_UNION(DS_HLL(hllsketch_d1), DS_HLL(hllsketch_m1)), true)"
+ " HLL_SKETCH_ESTIMATE(HLL_SKETCH_UNION(DS_HLL(hllsketch_dbl1), DS_HLL(hllsketch_m1)), true)"
+ " FROM druid.foo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
@ -1288,7 +1288,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.aggregators(
new HllSketchMergeAggregatorFactory("a0", "hllsketch_d1", null, null, null, false, true),
new HllSketchMergeAggregatorFactory("a0", "hllsketch_dbl1", null, null, null, false, true),
new HllSketchMergeAggregatorFactory("a1", "hllsketch_m1", null, null, null, false, true)
)
.postAggregators(
@ -1320,7 +1320,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
* This is a test in a similar vein to {@link #testEstimateStringAndDoubleAreDifferent()} except here we are
* ensuring that float values and doubles values are considered equivalent. The expected initial inputs were
* <p>
* 1. d1 -> [1.0, 1.7, 0.0]
* 1. dbl1 -> [1.0, 1.7, 0.0]
* 2. f1 -> [1.0f, 0.1f, 0.0f]
* <p>
* If we assume that doubles and floats are the same, that means that there are 4 unique values, not 6
@ -1331,7 +1331,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
// This is a test in a similar vein to testEstimateStringAndDoubleAreDifferent above
testQuery(
"SELECT"
+ " HLL_SKETCH_ESTIMATE(HLL_SKETCH_UNION(DS_HLL(hllsketch_d1), DS_HLL(hllsketch_f1)), true)"
+ " HLL_SKETCH_ESTIMATE(HLL_SKETCH_UNION(DS_HLL(hllsketch_dbl1), DS_HLL(hllsketch_f1)), true)"
+ " FROM druid.foo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
@ -1339,7 +1339,7 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.aggregators(
new HllSketchMergeAggregatorFactory("a0", "hllsketch_d1", null, null, null, false, true),
new HllSketchMergeAggregatorFactory("a0", "hllsketch_dbl1", null, null, null, false, true),
new HllSketchMergeAggregatorFactory("a1", "hllsketch_f1", null, null, null, false, true)
)
.postAggregators(
@ -1372,8 +1372,8 @@ public class HllSketchSqlAggregatorTest extends BaseCalciteQueryTest
// this query was not planable: https://github.com/apache/druid/issues/15353
testBuilder()
.sql(
"SELECT d1,dim2,APPROX_COUNT_DISTINCT_DS_HLL(dim2, 18) as val"
+ " FROM (select d1,dim1,dim2 from druid.foo group by d1,dim1,dim2 order by dim1 limit 3) t "
"SELECT dbl1,dim2,APPROX_COUNT_DISTINCT_DS_HLL(dim2, 18) as val"
+ " FROM (select dbl1,dim1,dim2 from druid.foo group by dbl1,dim1,dim2 order by dim1 limit 3) t "
+ " group by 1,2"
)
.expectedResults(

View File

@ -125,13 +125,13 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
{
cannotVectorize();
BloomKFilter expected1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expectedbl1 = new BloomKFilter(TEST_NUM_ENTRIES);
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
String raw = NullHandling.emptyToNullIfNeeded((String) row.getRaw("dim1"));
if (raw == null) {
expected1.addBytes(null, 0, 0);
expectedbl1.addBytes(null, 0, 0);
} else {
expected1.addString(raw);
expectedbl1.addString(raw);
}
}
@ -159,8 +159,8 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
),
ImmutableList.of(
new Object[]{
queryFramework().queryJsonMapper().writeValueAsString(expected1),
queryFramework().queryJsonMapper().writeValueAsString(expected1)
queryFramework().queryJsonMapper().writeValueAsString(expectedbl1),
queryFramework().queryJsonMapper().writeValueAsString(expectedbl1)
}
)
);
@ -171,14 +171,14 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
{
cannotVectorize();
BloomKFilter expected1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expectedbl1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expected2 = new BloomKFilter(TEST_NUM_ENTRIES);
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
String raw = NullHandling.emptyToNullIfNeeded((String) row.getRaw("dim1"));
if (raw == null) {
expected1.addBytes(null, 0, 0);
expectedbl1.addBytes(null, 0, 0);
} else {
expected1.addString(raw);
expectedbl1.addString(raw);
}
List<String> lst = row.getDimension("dim2");
if (lst.size() == 0) {
@ -223,7 +223,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
),
ImmutableList.of(
new Object[] {
jsonMapper.writeValueAsString(expected1),
jsonMapper.writeValueAsString(expectedbl1),
jsonMapper.writeValueAsString(expected2)
}
)
@ -235,14 +235,14 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
{
cannotVectorize();
BloomKFilter expected1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expectedbl1 = new BloomKFilter(TEST_NUM_ENTRIES);
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
String raw = NullHandling.emptyToNullIfNeeded((String) row.getRaw("dim1"));
// empty string extractionFn produces null
if (raw == null || "".equals(raw)) {
expected1.addBytes(null, 0, 0);
expectedbl1.addBytes(null, 0, 0);
} else {
expected1.addString(raw.substring(0, 1));
expectedbl1.addString(raw.substring(0, 1));
}
}
@ -272,7 +272,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
.build()
),
ImmutableList.of(
new Object[]{queryFramework().queryJsonMapper().writeValueAsString(expected1)}
new Object[]{queryFramework().queryJsonMapper().writeValueAsString(expectedbl1)}
)
);
}
@ -327,17 +327,17 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
public void testBloomFilterAggLongVirtualColumn() throws Exception
{
cannotVectorize();
BloomKFilter expected1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expectedbl1 = new BloomKFilter(TEST_NUM_ENTRIES);
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
Object raw = row.getRaw("l1");
if (raw == null) {
if (NullHandling.replaceWithDefault()) {
expected1.addLong(NullHandling.defaultLongValue());
expectedbl1.addLong(NullHandling.defaultLongValue());
} else {
expected1.addBytes(null, 0, 0);
expectedbl1.addBytes(null, 0, 0);
}
} else {
expected1.addLong(2 * ((Number) raw).longValue());
expectedbl1.addLong(2 * ((Number) raw).longValue());
}
}
@ -371,7 +371,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
.build()
),
ImmutableList.of(
new Object[]{queryFramework().queryJsonMapper().writeValueAsString(expected1)}
new Object[]{queryFramework().queryJsonMapper().writeValueAsString(expectedbl1)}
)
);
}
@ -381,17 +381,17 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
{
cannotVectorize();
BloomKFilter expected1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expectedbl1 = new BloomKFilter(TEST_NUM_ENTRIES);
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
Object raw = row.getRaw("f1");
if (raw == null) {
if (NullHandling.replaceWithDefault()) {
expected1.addFloat(NullHandling.defaultFloatValue());
expectedbl1.addFloat(NullHandling.defaultFloatValue());
} else {
expected1.addBytes(null, 0, 0);
expectedbl1.addBytes(null, 0, 0);
}
} else {
expected1.addFloat(2 * ((Number) raw).floatValue());
expectedbl1.addFloat(2 * ((Number) raw).floatValue());
}
}
@ -425,7 +425,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
.build()
),
ImmutableList.of(
new Object[]{queryFramework().queryJsonMapper().writeValueAsString(expected1)}
new Object[]{queryFramework().queryJsonMapper().writeValueAsString(expectedbl1)}
)
);
}
@ -435,23 +435,23 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
{
cannotVectorize();
BloomKFilter expected1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expectedbl1 = new BloomKFilter(TEST_NUM_ENTRIES);
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
Object raw = row.getRaw("d1");
Object raw = row.getRaw("dbl1");
if (raw == null) {
if (NullHandling.replaceWithDefault()) {
expected1.addDouble(NullHandling.defaultDoubleValue());
expectedbl1.addDouble(NullHandling.defaultDoubleValue());
} else {
expected1.addBytes(null, 0, 0);
expectedbl1.addBytes(null, 0, 0);
}
} else {
expected1.addDouble(2 * ((Number) raw).doubleValue());
expectedbl1.addDouble(2 * ((Number) raw).doubleValue());
}
}
testQuery(
"SELECT\n"
+ "BLOOM_FILTER(d1 * 2, 1000)\n"
+ "BLOOM_FILTER(dbl1 * 2, 1000)\n"
+ "FROM numfoo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
@ -461,7 +461,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
.virtualColumns(
new ExpressionVirtualColumn(
"v0",
"(\"d1\" * 2)",
"(\"dbl1\" * 2)",
ColumnType.DOUBLE,
TestExprMacroTable.INSTANCE
)
@ -479,7 +479,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
.build()
),
ImmutableList.of(
new Object[]{queryFramework().queryJsonMapper().writeValueAsString(expected1)}
new Object[]{queryFramework().queryJsonMapper().writeValueAsString(expectedbl1)}
)
);
}
@ -490,7 +490,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
// makes empty bloom filters
cannotVectorize();
BloomKFilter expected1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expectedbl1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expected2 = new BloomKFilter(TEST_NUM_ENTRIES);
ObjectMapper jsonMapper = queryFramework().queryJsonMapper();
@ -524,7 +524,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
),
ImmutableList.of(
new Object[] {
jsonMapper.writeValueAsString(expected1),
jsonMapper.writeValueAsString(expectedbl1),
jsonMapper.writeValueAsString(expected2)
}
)
@ -537,7 +537,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
// makes empty bloom filters
cannotVectorize();
BloomKFilter expected1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expectedbl1 = new BloomKFilter(TEST_NUM_ENTRIES);
BloomKFilter expected2 = new BloomKFilter(TEST_NUM_ENTRIES);
ObjectMapper jsonMapper = queryFramework().queryJsonMapper();
@ -554,7 +554,7 @@ public class BloomFilterSqlAggregatorTest 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(
@ -581,7 +581,7 @@ public class BloomFilterSqlAggregatorTest extends BaseCalciteQueryTest
ImmutableList.of(
new Object[] {
"a",
jsonMapper.writeValueAsString(expected1),
jsonMapper.writeValueAsString(expectedbl1),
jsonMapper.writeValueAsString(expected2)
}
)

View File

@ -111,7 +111,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
new DimensionsSpec(
ImmutableList.<DimensionSchema>builder()
.addAll(DimensionsSpec.getDefaultSchemas(ImmutableList.of("dim1", "dim2", "dim3")))
.add(new DoubleDimensionSchema("d1"))
.add(new DoubleDimensionSchema("dbl1"))
.add(new FloatDimensionSchema("f1"))
.add(new LongDimensionSchema("l1"))
.build()
@ -176,7 +176,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
VarianceAggregatorCollector holder2 = new VarianceAggregatorCollector();
VarianceAggregatorCollector holder3 = new VarianceAggregatorCollector();
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
Object raw1 = row.getRaw("d1");
Object raw1 = row.getRaw("dbl1");
Object raw2 = row.getRaw("f1");
Object raw3 = row.getRaw("l1");
addToHolder(holder1, raw1);
@ -193,7 +193,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
);
testQuery(
"SELECT\n"
+ "VAR_POP(d1),\n"
+ "VAR_POP(dbl1),\n"
+ "VAR_POP(f1),\n"
+ "VAR_POP(l1)\n"
+ "FROM numfoo",
@ -204,7 +204,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
.granularity(Granularities.ALL)
.aggregators(
ImmutableList.of(
new VarianceAggregatorFactory("a0", "d1", "population", "double"),
new VarianceAggregatorFactory("a0", "dbl1", "population", "double"),
new VarianceAggregatorFactory("a1", "f1", "population", "float"),
new VarianceAggregatorFactory("a2", "l1", "population", "long")
)
@ -224,7 +224,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
VarianceAggregatorCollector holder2 = new VarianceAggregatorCollector();
VarianceAggregatorCollector holder3 = new VarianceAggregatorCollector();
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
Object raw1 = row.getRaw("d1");
Object raw1 = row.getRaw("dbl1");
Object raw2 = row.getRaw("f1");
Object raw3 = row.getRaw("l1");
addToHolder(holder1, raw1);
@ -241,7 +241,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
);
testQuery(
"SELECT\n"
+ "VAR_SAMP(d1),\n"
+ "VAR_SAMP(dbl1),\n"
+ "VAR_SAMP(f1),\n"
+ "VAR_SAMP(l1)\n"
+ "FROM numfoo",
@ -252,7 +252,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
.granularity(Granularities.ALL)
.aggregators(
ImmutableList.of(
new VarianceAggregatorFactory("a0", "d1", "sample", "double"),
new VarianceAggregatorFactory("a0", "dbl1", "sample", "double"),
new VarianceAggregatorFactory("a1", "f1", "sample", "float"),
new VarianceAggregatorFactory("a2", "l1", "sample", "long")
)
@ -272,7 +272,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
VarianceAggregatorCollector holder2 = new VarianceAggregatorCollector();
VarianceAggregatorCollector holder3 = new VarianceAggregatorCollector();
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
Object raw1 = row.getRaw("d1");
Object raw1 = row.getRaw("dbl1");
Object raw2 = row.getRaw("f1");
Object raw3 = row.getRaw("l1");
addToHolder(holder1, raw1);
@ -290,7 +290,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
testQuery(
"SELECT\n"
+ "STDDEV_POP(d1),\n"
+ "STDDEV_POP(dbl1),\n"
+ "STDDEV_POP(f1),\n"
+ "STDDEV_POP(l1)\n"
+ "FROM numfoo",
@ -301,7 +301,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
.granularity(Granularities.ALL)
.aggregators(
ImmutableList.of(
new VarianceAggregatorFactory("a0:agg", "d1", "population", "double"),
new VarianceAggregatorFactory("a0:agg", "dbl1", "population", "double"),
new VarianceAggregatorFactory("a1:agg", "f1", "population", "float"),
new VarianceAggregatorFactory("a2:agg", "l1", "population", "long")
)
@ -328,7 +328,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
VarianceAggregatorCollector holder2 = new VarianceAggregatorCollector();
VarianceAggregatorCollector holder3 = new VarianceAggregatorCollector();
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
Object raw1 = row.getRaw("d1");
Object raw1 = row.getRaw("dbl1");
Object raw2 = row.getRaw("f1");
Object raw3 = row.getRaw("l1");
addToHolder(holder1, raw1);
@ -346,7 +346,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
testQuery(
"SELECT\n"
+ "STDDEV_SAMP(d1),\n"
+ "STDDEV_SAMP(dbl1),\n"
+ "STDDEV_SAMP(f1),\n"
+ "STDDEV_SAMP(l1)\n"
+ "FROM numfoo",
@ -357,7 +357,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
.granularity(Granularities.ALL)
.aggregators(
ImmutableList.of(
new VarianceAggregatorFactory("a0:agg", "d1", "sample", "double"),
new VarianceAggregatorFactory("a0:agg", "dbl1", "sample", "double"),
new VarianceAggregatorFactory("a1:agg", "f1", "sample", "float"),
new VarianceAggregatorFactory("a2:agg", "l1", "sample", "long")
)
@ -382,7 +382,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
VarianceAggregatorCollector holder2 = new VarianceAggregatorCollector();
VarianceAggregatorCollector holder3 = new VarianceAggregatorCollector();
for (InputRow row : TestDataBuilder.ROWS1_WITH_NUMERIC_DIMS) {
Object raw1 = row.getRaw("d1");
Object raw1 = row.getRaw("dbl1");
Object raw2 = row.getRaw("f1");
Object raw3 = row.getRaw("l1");
addToHolder(holder1, raw1, 7);
@ -400,7 +400,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
testQuery(
"SELECT\n"
+ "STDDEV(d1*7),\n"
+ "STDDEV(dbl1*7),\n"
+ "STDDEV(f1*7),\n"
+ "STDDEV(l1*7)\n"
+ "FROM numfoo",
@ -410,7 +410,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
.intervals(new MultipleIntervalSegmentSpec(ImmutableList.of(Filtration.eternity())))
.granularity(Granularities.ALL)
.virtualColumns(
BaseCalciteQueryTest.expressionVirtualColumn("v0", "(\"d1\" * 7)", ColumnType.DOUBLE),
BaseCalciteQueryTest.expressionVirtualColumn("v0", "(\"dbl1\" * 7)", ColumnType.DOUBLE),
BaseCalciteQueryTest.expressionVirtualColumn("v1", "(\"f1\" * 7)", ColumnType.FLOAT),
BaseCalciteQueryTest.expressionVirtualColumn("v2", "(\"l1\" * 7)", ColumnType.LONG)
)
@ -457,7 +457,7 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
.setDataSource(CalciteTests.DATASOURCE3)
.setInterval(new MultipleIntervalSegmentSpec(ImmutableList.of(Filtration.eternity())))
.setGranularity(Granularities.ALL)
.setDimensions(new DefaultDimensionSpec("dim2", "_d0"))
.setDimensions(new DefaultDimensionSpec("dim2", "d0"))
.setAggregatorSpecs(
new VarianceAggregatorFactory("a0", "f1", "sample", "float")
)
@ -527,10 +527,10 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
{
testQuery(
"SELECT\n"
+ "STDDEV_POP(d1),\n"
+ "STDDEV_SAMP(d1),\n"
+ "STDDEV(d1),\n"
+ "VARIANCE(d1),\n"
+ "STDDEV_POP(dbl1),\n"
+ "STDDEV_SAMP(dbl1),\n"
+ "STDDEV(dbl1),\n"
+ "VARIANCE(dbl1),\n"
+ "STDDEV_POP(l1),\n"
+ "STDDEV_SAMP(l1),\n"
+ "STDDEV(l1),\n"
@ -543,10 +543,10 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
.granularity(Granularities.ALL)
.filters(numericEquality("dim2", 0L, ColumnType.LONG))
.aggregators(
new VarianceAggregatorFactory("a0:agg", "d1", "population", "double"),
new VarianceAggregatorFactory("a1:agg", "d1", "sample", "double"),
new VarianceAggregatorFactory("a2:agg", "d1", "sample", "double"),
new VarianceAggregatorFactory("a3", "d1", "sample", "double"),
new VarianceAggregatorFactory("a0:agg", "dbl1", "population", "double"),
new VarianceAggregatorFactory("a1:agg", "dbl1", "sample", "double"),
new VarianceAggregatorFactory("a2:agg", "dbl1", "sample", "double"),
new VarianceAggregatorFactory("a3", "dbl1", "sample", "double"),
new VarianceAggregatorFactory("a4:agg", "l1", "population", "long"),
new VarianceAggregatorFactory("a5:agg", "l1", "sample", "long"),
new VarianceAggregatorFactory("a6:agg", "l1", "sample", "long"),
@ -579,10 +579,10 @@ public class VarianceSqlAggregatorTest extends BaseCalciteQueryTest
testQuery(
"SELECT\n"
+ "dim2,\n"
+ "STDDEV_POP(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "STDDEV_SAMP(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "STDDEV(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "VARIANCE(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "STDDEV_POP(dbl1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "STDDEV_SAMP(dbl1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "STDDEV(dbl1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "VARIANCE(dbl1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "STDDEV_POP(l1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "STDDEV_SAMP(l1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ "STDDEV(l1) FILTER(WHERE dim1 = 'nonexistent'),\n"
@ -595,23 +595,23 @@ public class VarianceSqlAggregatorTest 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(
new VarianceAggregatorFactory("a0:agg", "d1", "population", "double"),
new VarianceAggregatorFactory("a0:agg", "dbl1", "population", "double"),
equality("dim1", "nonexistent", ColumnType.STRING)
),
new FilteredAggregatorFactory(
new VarianceAggregatorFactory("a1:agg", "d1", "sample", "double"),
new VarianceAggregatorFactory("a1:agg", "dbl1", "sample", "double"),
equality("dim1", "nonexistent", ColumnType.STRING)
),
new FilteredAggregatorFactory(
new VarianceAggregatorFactory("a2:agg", "d1", "sample", "double"),
new VarianceAggregatorFactory("a2:agg", "dbl1", "sample", "double"),
equality("dim1", "nonexistent", ColumnType.STRING)
),
new FilteredAggregatorFactory(
new VarianceAggregatorFactory("a3", "d1", "sample", "double"),
new VarianceAggregatorFactory("a3", "dbl1", "sample", "double"),
equality("dim1", "nonexistent", ColumnType.STRING)
),
new FilteredAggregatorFactory(

View File

@ -3,30 +3,30 @@
!set outputformat mysql
select * from numfoo;
+-------------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+
| __time | dim1 | dim2 | dim3 | dim4 | dim5 | dim6 | d1 | d2 | f1 | f2 | l1 | l2 | cnt | m1 | m2 | unique_dim1 |
+-------------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+
| 2000-01-01 00:00:00.000 | | a | ["a","b"] | a | aa | 1 | 1.0 | | 1.0 | | 7 | | 1 | 1.0 | 1.0 | "AQAAAEAAAA==" |
| 2000-01-02 00:00:00.000 | 10.1 | | ["b","c"] | a | ab | 2 | 1.7 | 1.7 | 0.1 | 0.1 | 325323 | 325323 | 1 | 2.0 | 2.0 | "AQAAAQAAAAHNBA==" |
| 2000-01-03 00:00:00.000 | 2 | | d | a | ba | 3 | 0.0 | 0.0 | 0.0 | 0.0 | 0 | 0 | 1 | 3.0 | 3.0 | "AQAAAQAAAAOzAg==" |
| 2001-01-01 00:00:00.000 | 1 | a | | b | ad | 4 | | | | | | | 1 | 4.0 | 4.0 | "AQAAAQAAAAFREA==" |
| 2001-01-02 00:00:00.000 | def | abc | | b | aa | 5 | | | | | | | 1 | 5.0 | 5.0 | "AQAAAQAAAACyEA==" |
| 2001-01-03 00:00:00.000 | abc | | | b | ab | 6 | | | | | | | 1 | 6.0 | 6.0 | "AQAAAQAAAAEkAQ==" |
+-------------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+
+-------------------------+------+------+-----------+------+------+------+------+------+-----+-----+--------+--------+-----+-----+-----+--------------------+
| __time | dim1 | dim2 | dim3 | dim4 | dim5 | dim6 | dbl1 | dbl2 | f1 | f2 | l1 | l2 | cnt | m1 | m2 | unique_dim1 |
+-------------------------+------+------+-----------+------+------+------+------+------+-----+-----+--------+--------+-----+-----+-----+--------------------+
| 2000-01-01 00:00:00.000 | | a | ["a","b"] | a | aa | 1 | 1.0 | | 1.0 | | 7 | | 1 | 1.0 | 1.0 | "AQAAAEAAAA==" |
| 2000-01-02 00:00:00.000 | 10.1 | | ["b","c"] | a | ab | 2 | 1.7 | 1.7 | 0.1 | 0.1 | 325323 | 325323 | 1 | 2.0 | 2.0 | "AQAAAQAAAAHNBA==" |
| 2000-01-03 00:00:00.000 | 2 | | d | a | ba | 3 | 0.0 | 0.0 | 0.0 | 0.0 | 0 | 0 | 1 | 3.0 | 3.0 | "AQAAAQAAAAOzAg==" |
| 2001-01-01 00:00:00.000 | 1 | a | | b | ad | 4 | | | | | | | 1 | 4.0 | 4.0 | "AQAAAQAAAAFREA==" |
| 2001-01-02 00:00:00.000 | def | abc | | b | aa | 5 | | | | | | | 1 | 5.0 | 5.0 | "AQAAAQAAAACyEA==" |
| 2001-01-03 00:00:00.000 | abc | | | b | ab | 6 | | | | | | | 1 | 6.0 | 6.0 | "AQAAAQAAAAEkAQ==" |
+-------------------------+------+------+-----------+------+------+------+------+------+-----+-----+--------+--------+-----+-----+-----+--------------------+
(6 rows)
!ok
select * from numfoo;
+-------------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+
| __time | dim1 | dim2 | dim3 | dim4 | dim5 | dim6 | d1 | d2 | f1 | f2 | l1 | l2 | cnt | m1 | m2 | unique_dim1 |
+-------------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+
| 2000-01-01 00:00:00.000 | | a | ["a","b"] | a | aa | 1 | 1.0 | | 1.0 | | 7 | | 1 | 1.0 | 1.0 | "AQAAAEAAAA==" |
| 2000-01-02 00:00:00.000 | 10.1 | | ["b","c"] | a | ab | 2 | 1.7 | 1.7 | 0.1 | 0.1 | 325323 | 325323 | 1 | 2.0 | 2.0 | "AQAAAQAAAAHNBA==" |
| 2000-01-03 00:00:00.000 | 2 | | d | a | ba | 3 | 0.0 | 0.0 | 0.0 | 0.0 | 0 | 0 | 1 | 3.0 | 3.0 | "AQAAAQAAAAOzAg==" |
| 2001-01-01 00:00:00.000 | 1 | a | | b | ad | 4 | | | | | | | 1 | 4.0 | 4.0 | "AQAAAQAAAAFREA==" |
| 2001-01-02 00:00:00.000 | def | abc | | b | aa | 5 | | | | | | | 1 | 5.0 | 5.0 | "AQAAAQAAAACyEA==" |
| 2001-01-03 00:00:00.000 | abc | | | b | ab | 6 | | | | | | | 1 | 6.0 | 6.0 | "AQAAAQAAAAEkAQ==" |
+-------------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+
+-------------------------+------+------+-----------+------+------+------+------+------+-----+-----+--------+--------+-----+-----+-----+--------------------+
| __time | dim1 | dim2 | dim3 | dim4 | dim5 | dim6 | dbl1 | dbl2 | f1 | f2 | l1 | l2 | cnt | m1 | m2 | unique_dim1 |
+-------------------------+------+------+-----------+------+------+------+------+------+-----+-----+--------+--------+-----+-----+-----+--------------------+
| 2000-01-01 00:00:00.000 | | a | ["a","b"] | a | aa | 1 | 1.0 | | 1.0 | | 7 | | 1 | 1.0 | 1.0 | "AQAAAEAAAA==" |
| 2000-01-02 00:00:00.000 | 10.1 | | ["b","c"] | a | ab | 2 | 1.7 | 1.7 | 0.1 | 0.1 | 325323 | 325323 | 1 | 2.0 | 2.0 | "AQAAAQAAAAHNBA==" |
| 2000-01-03 00:00:00.000 | 2 | | d | a | ba | 3 | 0.0 | 0.0 | 0.0 | 0.0 | 0 | 0 | 1 | 3.0 | 3.0 | "AQAAAQAAAAOzAg==" |
| 2001-01-01 00:00:00.000 | 1 | a | | b | ad | 4 | | | | | | | 1 | 4.0 | 4.0 | "AQAAAQAAAAFREA==" |
| 2001-01-02 00:00:00.000 | def | abc | | b | aa | 5 | | | | | | | 1 | 5.0 | 5.0 | "AQAAAQAAAACyEA==" |
| 2001-01-03 00:00:00.000 | abc | | | b | ab | 6 | | | | | | | 1 | 6.0 | 6.0 | "AQAAAQAAAAEkAQ==" |
+-------------------------+------+------+-----------+------+------+------+------+------+-----+-----+--------+--------+-----+-----+-----+--------------------+
(6 rows)
!ok

View File

@ -1600,7 +1600,7 @@ public class DruidAvaticaHandlerTest extends CalciteTestBase
public void testArrayStuff() throws SQLException
{
try (PreparedStatement statement = client.prepareStatement(
"SELECT ARRAY_AGG(dim2) AS arr1, ARRAY_AGG(l1) AS arr2, ARRAY_AGG(d1) AS arr3, ARRAY_AGG(f1) AS arr4 FROM druid.numfoo")) {
"SELECT ARRAY_AGG(dim2) AS arr1, ARRAY_AGG(l1) AS arr2, ARRAY_AGG(dbl1) AS arr3, ARRAY_AGG(f1) AS arr4 FROM druid.numfoo")) {
final ResultSet resultSet = statement.executeQuery();
final List<Map<String, Object>> rows = getRows(resultSet);
Assert.assertEquals(1, rows.size());

View File

@ -158,7 +158,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
"case_searched((\"dim4\" == 'a'),array('foo','bar','baz'),null)",
ColumnType.STRING_ARRAY
))
.setDimensions(new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING_ARRAY))
.setDimensions(new DefaultDimensionSpec("v0", "d0", ColumnType.STRING_ARRAY))
.setGranularity(Granularities.ALL)
.setAggregatorSpecs(new CountAggregatorFactory("a0"))
.setContext(QUERY_CONTEXT_DEFAULT)
@ -338,8 +338,8 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.add("dim3", ColumnType.STRING)
.add("l1", ColumnType.LONG)
.add("l2", ColumnType.LONG)
.add("d1", ColumnType.DOUBLE)
.add("d2", ColumnType.DOUBLE)
.add("dbl1", ColumnType.DOUBLE)
.add("dbl2", ColumnType.DOUBLE)
.add("EXPR$7", ColumnType.STRING_ARRAY)
.add("EXPR$8", ColumnType.LONG_ARRAY)
.add("EXPR$9", ColumnType.DOUBLE_ARRAY)
@ -364,8 +364,8 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
+ " dim3,"
+ " l1,"
+ " l2,"
+ " d1,"
+ " d2,"
+ " dbl1,"
+ " dbl2,"
+ " ARRAY['a', 'b', 'c'],"
+ " ARRAY[1,2,3],"
+ " ARRAY[1.9, 2.2, 4.3],"
@ -373,15 +373,15 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
+ " ARRAY_PREPEND('foo', ARRAY[dim2]),"
+ " ARRAY_APPEND(ARRAY[1,2], l1),"
+ " ARRAY_PREPEND(l2, ARRAY[1,2]),"
+ " ARRAY_APPEND(ARRAY[1.2,2.2], d1),"
+ " ARRAY_PREPEND(d2, ARRAY[1.1,2.2]),"
+ " ARRAY_APPEND(ARRAY[1.2,2.2], dbl1),"
+ " ARRAY_PREPEND(dbl2, ARRAY[1.1,2.2]),"
+ " ARRAY_CONCAT(dim2,dim3),"
+ " ARRAY_CONCAT(ARRAY[l1],ARRAY[l2]),"
+ " ARRAY_CONCAT(ARRAY[d1],ARRAY[d2]),"
+ " ARRAY_CONCAT(ARRAY[dbl1],ARRAY[dbl2]),"
+ " ARRAY_OFFSET(ARRAY[l1],0),"
+ " ARRAY_OFFSET(ARRAY[d1],0),"
+ " ARRAY_OFFSET(ARRAY[dbl1],0),"
+ " ARRAY_ORDINAL(ARRAY[l1],1),"
+ " ARRAY_ORDINAL(ARRAY[d1],1)"
+ " ARRAY_ORDINAL(ARRAY[dbl1],1)"
+ " FROM druid.numfoo"
+ " LIMIT 1",
ImmutableList.of(
@ -395,20 +395,20 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
expressionVirtualColumn("v10", "array_concat(array(\"l1\"),array(\"l2\"))", ColumnType.LONG_ARRAY),
expressionVirtualColumn(
"v11",
"array_concat(array(\"d1\"),array(\"d2\"))",
"array_concat(array(\"dbl1\"),array(\"dbl2\"))",
ColumnType.DOUBLE_ARRAY
),
expressionVirtualColumn("v12", "array_offset(array(\"l1\"),0)", ColumnType.LONG),
expressionVirtualColumn("v13", "array_offset(array(\"d1\"),0)", ColumnType.DOUBLE),
expressionVirtualColumn("v13", "array_offset(array(\"dbl1\"),0)", ColumnType.DOUBLE),
expressionVirtualColumn("v14", "array_ordinal(array(\"l1\"),1)", ColumnType.LONG),
expressionVirtualColumn("v15", "array_ordinal(array(\"d1\"),1)", ColumnType.DOUBLE),
expressionVirtualColumn("v15", "array_ordinal(array(\"dbl1\"),1)", ColumnType.DOUBLE),
expressionVirtualColumn("v2", "array(1.9,2.2,4.3)", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v3", "array_append(\"dim3\",'foo')", ColumnType.STRING_ARRAY),
expressionVirtualColumn("v4", "array_prepend('foo',array(\"dim2\"))", ColumnType.STRING_ARRAY),
expressionVirtualColumn("v5", "array_append(array(1,2),\"l1\")", ColumnType.LONG_ARRAY),
expressionVirtualColumn("v6", "array_prepend(\"l2\",array(1,2))", ColumnType.LONG_ARRAY),
expressionVirtualColumn("v7", "array_append(array(1.2,2.2),\"d1\")", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v8", "array_prepend(\"d2\",array(1.1,2.2))", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v7", "array_append(array(1.2,2.2),\"dbl1\")", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v8", "array_prepend(\"dbl2\",array(1.1,2.2))", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v9", "array_concat(\"dim2\",\"dim3\")", ColumnType.STRING_ARRAY)
)
.columns(
@ -417,8 +417,8 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
"dim3",
"l1",
"l2",
"d1",
"d2",
"dbl1",
"dbl2",
"v0",
"v1",
"v2",
@ -641,11 +641,11 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
+ " ARRAY_PREPEND('foo', ARRAY[dim2]),"
+ " ARRAY_APPEND(ARRAY[1,2], l1),"
+ " ARRAY_PREPEND(l2, ARRAY[1,2]),"
+ " ARRAY_APPEND(ARRAY[1.2,2.2], d1),"
+ " ARRAY_PREPEND(d2, ARRAY[1.1,2.2]),"
+ " ARRAY_APPEND(ARRAY[1.2,2.2], dbl1),"
+ " ARRAY_PREPEND(dbl2, ARRAY[1.1,2.2]),"
+ " ARRAY_CONCAT(dim2,dim3),"
+ " ARRAY_CONCAT(ARRAY[l1],ARRAY[l2]),"
+ " ARRAY_CONCAT(ARRAY[d1],ARRAY[d2])"
+ " ARRAY_CONCAT(ARRAY[dbl1],ARRAY[dbl2])"
+ " FROM druid.numfoo"
+ " LIMIT 1",
QUERY_CONTEXT_NO_STRINGIFY_ARRAY,
@ -659,7 +659,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
expressionVirtualColumn("v10", "array_concat(array(\"l1\"),array(\"l2\"))", ColumnType.LONG_ARRAY),
expressionVirtualColumn(
"v11",
"array_concat(array(\"d1\"),array(\"d2\"))",
"array_concat(array(\"dbl1\"),array(\"dbl2\"))",
ColumnType.DOUBLE_ARRAY
),
expressionVirtualColumn("v2", "array(1.9,2.2,4.3)", ColumnType.DOUBLE_ARRAY),
@ -667,8 +667,8 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
expressionVirtualColumn("v4", "array_prepend('foo',array(\"dim2\"))", ColumnType.STRING_ARRAY),
expressionVirtualColumn("v5", "array_append(array(1,2),\"l1\")", ColumnType.LONG_ARRAY),
expressionVirtualColumn("v6", "array_prepend(\"l2\",array(1,2))", ColumnType.LONG_ARRAY),
expressionVirtualColumn("v7", "array_append(array(1.2,2.2),\"d1\")", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v8", "array_prepend(\"d2\",array(1.1,2.2))", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v7", "array_append(array(1.2,2.2),\"dbl1\")", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v8", "array_prepend(\"dbl2\",array(1.1,2.2))", ColumnType.DOUBLE_ARRAY),
expressionVirtualColumn("v9", "array_concat(\"dim2\",\"dim3\")", ColumnType.STRING_ARRAY)
)
.columns(
@ -953,7 +953,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
Druids.ScanQueryBuilder builder = newScanQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
.intervals(querySegmentSpec(Filtration.eternity()))
.filters(expressionFilter("array_overlap(array(1.0,1.7,null),array(\"d1\"))"))
.filters(expressionFilter("array_overlap(array(1.0,1.7,null),array(\"dbl1\"))"))
.columns("dim3")
.columnTypes(ColumnType.STRING)
.resultFormat(ScanQuery.ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
@ -966,7 +966,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
ImmutableList.of(
new SqlParameter(SqlType.ARRAY, Arrays.asList(1.0, 1.7, null))
),
"SELECT dim3 FROM druid.numfoo WHERE ARRAY_OVERLAP(?, ARRAY[d1]) LIMIT 5",
"SELECT dim3 FROM druid.numfoo WHERE ARRAY_OVERLAP(?, ARRAY[dbl1]) LIMIT 5",
CalciteTests.REGULAR_USER_AUTH_RESULT,
ImmutableList.of(builder.build()),
NullHandling.sqlCompatible() ? ImmutableList.of(
@ -1337,7 +1337,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
Druids.ScanQueryBuilder builder = newScanQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
.intervals(querySegmentSpec(Filtration.eternity()))
.filters(expressionFilter("array_contains(array(1,null),array((\"d1\" > 1)))"))
.filters(expressionFilter("array_contains(array(1,null),array((\"dbl1\" > 1)))"))
.columns("dim3")
.columnTypes(ColumnType.STRING)
.resultFormat(ScanQuery.ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
@ -1350,7 +1350,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
ImmutableList.of(
new SqlParameter(SqlType.ARRAY, Arrays.asList(true, null))
),
"SELECT dim3 FROM druid.numfoo WHERE ARRAY_CONTAINS(?, ARRAY[d1>1]) LIMIT 5",
"SELECT dim3 FROM druid.numfoo WHERE ARRAY_CONTAINS(?, ARRAY[dbl1>1]) LIMIT 5",
CalciteTests.REGULAR_USER_AUTH_RESULT,
ImmutableList.of(builder.build()),
NullHandling.sqlCompatible() ? ImmutableList.of(
@ -1576,14 +1576,14 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.setVirtualColumns(expressionVirtualColumn("v0", "array_length(\"dim3\")", ColumnType.LONG))
.setDimensions(
dimensions(
new DefaultDimensionSpec("dim1", "_d0", ColumnType.STRING),
new DefaultDimensionSpec("v0", "_d1", ColumnType.LONG)
new DefaultDimensionSpec("dim1", "d0", ColumnType.STRING),
new DefaultDimensionSpec("v0", "d1", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
.setLimitSpec(new DefaultLimitSpec(
ImmutableList.of(new OrderByColumnSpec(
"_d1",
"d1",
OrderByColumnSpec.Direction.DESCENDING,
StringComparators.NUMERIC
)),
@ -1699,7 +1699,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1756,7 +1756,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1817,8 +1817,8 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
)
.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)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1875,7 +1875,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1908,7 +1908,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.setVirtualColumns(expressionVirtualColumn("v0", "array_offset(\"dim3\",1)", ColumnType.STRING))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1951,7 +1951,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2033,7 +2033,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
// Cannot vectorize as we donot have support in native query subsytem for grouping on arrays as keys
cannotVectorize();
testQuery(
"SELECT ARRAY[d1], SUM(cnt) FROM druid.numfoo GROUP BY 1 ORDER BY 2 DESC",
"SELECT ARRAY[dbl1], SUM(cnt) FROM druid.numfoo GROUP BY 1 ORDER BY 2 DESC",
QUERY_CONTEXT_NO_STRINGIFY_ARRAY,
ImmutableList.of(
GroupByQuery.builder()
@ -2042,12 +2042,12 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.setGranularity(Granularities.ALL)
.setVirtualColumns(expressionVirtualColumn(
"v0",
"array(\"d1\")",
"array(\"dbl1\")",
ColumnType.DOUBLE_ARRAY
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.DOUBLE_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.DOUBLE_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2143,7 +2143,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.ofArray(ColumnType.FLOAT))
new DefaultDimensionSpec("v0", "d0", ColumnType.ofArray(ColumnType.FLOAT))
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2192,7 +2192,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2234,7 +2234,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2275,7 +2275,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG)
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2322,7 +2322,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG)
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2387,7 +2387,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2446,7 +2446,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.setDimFilter(range("v0", ColumnType.LONG, 0L, null, true, false))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v1", "_d0", ColumnType.STRING_ARRAY)
new DefaultDimensionSpec("v1", "d0", ColumnType.STRING_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2610,7 +2610,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
{
cannotVectorize();
testQuery(
"SELECT ARRAY_AGG(l1), ARRAY_AGG(DISTINCT l1), ARRAY_AGG(d1), ARRAY_AGG(DISTINCT d1), ARRAY_AGG(f1), ARRAY_AGG(DISTINCT f1) FROM numfoo",
"SELECT ARRAY_AGG(l1), ARRAY_AGG(DISTINCT l1), ARRAY_AGG(dbl1), ARRAY_AGG(DISTINCT dbl1), ARRAY_AGG(f1), ARRAY_AGG(DISTINCT f1) FROM numfoo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
@ -2652,14 +2652,14 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
),
new ExpressionLambdaAggregatorFactory(
"a2",
ImmutableSet.of("d1"),
ImmutableSet.of("dbl1"),
"__acc",
"ARRAY<DOUBLE>[]",
"ARRAY<DOUBLE>[]",
true,
true,
false,
"array_append(\"__acc\", \"d1\")",
"array_append(\"__acc\", \"dbl1\")",
"array_concat(\"__acc\", \"a2\")",
null,
null,
@ -2668,14 +2668,14 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
),
new ExpressionLambdaAggregatorFactory(
"a3",
ImmutableSet.of("d1"),
ImmutableSet.of("dbl1"),
"__acc",
"ARRAY<DOUBLE>[]",
"ARRAY<DOUBLE>[]",
true,
true,
false,
"array_set_add(\"__acc\", \"d1\")",
"array_set_add(\"__acc\", \"dbl1\")",
"array_set_add_all(\"__acc\", \"a3\")",
null,
null,
@ -3460,7 +3460,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.setInterval(querySegmentSpec(Filtration.eternity()))
.setGranularity(Granularities.ALL)
.setDimFilter(notNull("dim1"))
.setDimensions(new DefaultDimensionSpec("dim4", "_d0"))
.setDimensions(new DefaultDimensionSpec("dim4", "d0"))
.setAggregatorSpecs(
aggregators(
new ExpressionLambdaAggregatorFactory(
@ -3485,7 +3485,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.build()
),
"j0.",
"(\"dim4\" == \"j0._d0\")",
"(\"dim4\" == \"j0.d0\")",
JoinType.INNER,
null
)
@ -3594,14 +3594,8 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
querySegmentSpec(Filtration.eternity()))
.setGranularity(Granularities.ALL)
.setDimensions(
new DefaultDimensionSpec(
"d0",
"_d0"
),
new DefaultDimensionSpec(
"d1",
"_d1"
)
new DefaultDimensionSpec("d0", "_d0"),
new DefaultDimensionSpec("d1", "_d1")
)
.setAggregatorSpecs(new ExpressionLambdaAggregatorFactory(
"_a0",
@ -3657,11 +3651,9 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.setDimensions(
new DefaultDimensionSpec("dim1", "d0"),
new DefaultDimensionSpec("dim2", "d1"),
new DefaultDimensionSpec("dim3", "d2"
)
new DefaultDimensionSpec("dim3", "d2")
)
.setAggregatorSpecs(
new CountAggregatorFactory("a0"))
.setAggregatorSpecs(new CountAggregatorFactory("a0"))
.build()))
.setQuerySegmentSpec(querySegmentSpec(Filtration.eternity()))
.setGranularity(Granularities.ALL)
@ -3724,11 +3716,9 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
.setDimensions(
new DefaultDimensionSpec("dim1", "d0"),
new DefaultDimensionSpec("dim2", "d1"),
new DefaultDimensionSpec("dim3", "d2"
)
new DefaultDimensionSpec("dim3", "d2")
)
.setAggregatorSpecs(
new CountAggregatorFactory("a0"))
.setAggregatorSpecs(new CountAggregatorFactory("a0"))
.build()))
.setQuerySegmentSpec(querySegmentSpec(Filtration.eternity()))
.setGranularity(Granularities.ALL)
@ -4989,7 +4979,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setInterval(querySegmentSpec(Filtration.eternity()))
.setContext(QUERY_CONTEXT_UNNEST)
.setDimensions(new DefaultDimensionSpec("j0.unnest", "_d0", ColumnType.STRING))
.setDimensions(new DefaultDimensionSpec("j0.unnest", "d0", ColumnType.STRING))
.setGranularity(Granularities.ALL)
.setContext(QUERY_CONTEXT_UNNEST)
.build()
@ -5060,13 +5050,13 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setInterval(querySegmentSpec(Filtration.eternity()))
.setContext(QUERY_CONTEXT_UNNEST)
.setDimensions(new DefaultDimensionSpec("j0.unnest", "_d0", ColumnType.STRING))
.setDimensions(new DefaultDimensionSpec("j0.unnest", "d0", ColumnType.STRING))
.setGranularity(Granularities.ALL)
.setLimitSpec(
DefaultLimitSpec
.builder()
.orderBy(new OrderByColumnSpec(
"_d0",
"d0",
OrderByColumnSpec.Direction.DESCENDING,
StringComparators.LEXICOGRAPHIC
))
@ -5110,7 +5100,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
null
))
.intervals(querySegmentSpec(Filtration.eternity()))
.dimension(new DefaultDimensionSpec("j0.unnest", "_d0", ColumnType.STRING))
.dimension(new DefaultDimensionSpec("j0.unnest", "d0", ColumnType.STRING))
.metric(new DimensionTopNMetricSpec(null, StringComparators.LEXICOGRAPHIC))
.threshold(4)
.aggregators(aggregators(new CountAggregatorFactory("a0")))
@ -5149,7 +5139,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setInterval(querySegmentSpec(Filtration.eternity()))
.setContext(QUERY_CONTEXT_UNNEST)
.setDimensions(new DefaultDimensionSpec("j0.unnest", "_d0", ColumnType.STRING))
.setDimensions(new DefaultDimensionSpec("j0.unnest", "d0", ColumnType.STRING))
.setGranularity(Granularities.ALL)
.setAggregatorSpecs(new CountAggregatorFactory("a0"))
.setHavingSpec(new DimFilterHavingSpec(equality("a0", 1L, ColumnType.LONG), true))
@ -5681,13 +5671,13 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
)
.setInterval(querySegmentSpec(Filtration.eternity()))
.setContext(QUERY_CONTEXT_UNNEST)
.setDimensions(new DefaultDimensionSpec("j0.unnest", "_d0", ColumnType.STRING))
.setDimensions(new DefaultDimensionSpec("j0.unnest", "d0", ColumnType.STRING))
.setGranularity(Granularities.ALL)
.setLimitSpec(
DefaultLimitSpec
.builder()
.orderBy(new OrderByColumnSpec(
"_d0",
"d0",
OrderByColumnSpec.Direction.DESCENDING,
StringComparators.LEXICOGRAPHIC
))
@ -6442,7 +6432,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setInterval(querySegmentSpec(Filtration.eternity()))
.setContext(QUERY_CONTEXT_UNNEST)
.setDimensions(new DefaultDimensionSpec("j0.unnest", "_d0", ColumnType.STRING))
.setDimensions(new DefaultDimensionSpec("j0.unnest", "d0", ColumnType.STRING))
.setGranularity(Granularities.ALL)
.setDimFilter(equality("j0.unnest", "b", ColumnType.STRING))
.setAggregatorSpecs(new CountAggregatorFactory("a0"))
@ -6551,7 +6541,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setInterval(querySegmentSpec(Filtration.eternity()))
.setContext(QUERY_CONTEXT_UNNEST)
.setDimensions(new DefaultDimensionSpec("j0.unnest", "_d0", ColumnType.STRING))
.setDimensions(new DefaultDimensionSpec("j0.unnest", "d0", ColumnType.STRING))
.setGranularity(Granularities.ALL)
.setAggregatorSpecs(new CountAggregatorFactory("a0"))
.setHavingSpec(new DimFilterHavingSpec(equality("a0", 1L, ColumnType.LONG), true))
@ -6581,7 +6571,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
))
.setInterval(querySegmentSpec(Filtration.eternity()))
.setContext(QUERY_CONTEXT_UNNEST)
.setDimensions(new DefaultDimensionSpec("j0.unnest", "_d0", ColumnType.STRING))
.setDimensions(new DefaultDimensionSpec("j0.unnest", "d0", ColumnType.STRING))
.setGranularity(Granularities.ALL)
.setAggregatorSpecs(new CountAggregatorFactory("a0"))
.setDimFilter(equality("j0.unnest", "a", ColumnType.STRING))

View File

@ -145,7 +145,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
.setInterval(querySegmentSpec(Filtration.eternity()))
.setGranularity(Granularities.ALL)
.setDataSource(new TableDataSource("numfoo"))
.setDimensions(new DefaultDimensionSpec("__time", "_d0", ColumnType.LONG))
.setDimensions(new DefaultDimensionSpec("__time", "d0", ColumnType.LONG))
.setContext(context)
.build()
),
@ -159,14 +159,14 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
.build()
),
"j0.",
"(\"_d0\" == \"j0.d0\")",
"(\"d0\" == \"j0.d0\")",
JoinType.INNER,
null,
ExprMacroTable.nil(),
CalciteTests.createJoinableFactoryWrapper()
)
)
.columns("_d0")
.columns("d0")
.columnTypes(ColumnType.LONG)
.context(context)
.build()
@ -200,7 +200,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
new TopNQueryBuilder()
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.dimension(new DefaultDimensionSpec("dim4", "_d0"))
.dimension(new DefaultDimensionSpec("dim4", "d0"))
.aggregators(new DoubleSumAggregatorFactory("a0", "m1"))
.metric(new DimensionTopNMetricSpec(null, StringComparators.LEXICOGRAPHIC))
.threshold(1)
@ -213,12 +213,12 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
.setGranularity(Granularities.ALL)
.setDimFilter(not(equality("dim4", "a", ColumnType.STRING)))
.setDataSource(new TableDataSource("numfoo"))
.setDimensions(new DefaultDimensionSpec("dim4", "_d0"))
.setDimensions(new DefaultDimensionSpec("dim4", "d0"))
.setContext(context)
.build()
),
"j0.",
"(\"dim4\" == \"j0._d0\")",
"(\"dim4\" == \"j0.d0\")",
JoinType.INNER,
null,
ExprMacroTable.nil(),
@ -5264,7 +5264,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
)
)
.intervals(querySegmentSpec(Filtration.eternity()))
.dimension(new DefaultDimensionSpec("j0.dim4", "_d0", ColumnType.STRING))
.dimension(new DefaultDimensionSpec("j0.dim4", "d0", ColumnType.STRING))
.threshold(4)
.aggregators(aggregators(new CountAggregatorFactory("a0")))
.context(queryContext)
@ -5305,7 +5305,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
)
)
.intervals(querySegmentSpec(Filtration.eternity()))
.dimension(new DefaultDimensionSpec("j0.dim4", "_d0", ColumnType.STRING))
.dimension(new DefaultDimensionSpec("j0.dim4", "d0", ColumnType.STRING))
.threshold(4)
.aggregators(aggregators(new CountAggregatorFactory("a0")))
.context(queryContext)

View File

@ -100,7 +100,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
.setVirtualColumns(expressionVirtualColumn("v0", "concat(\"dim3\",'foo')", ColumnType.STRING))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -159,7 +159,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
.setGranularity(Granularities.ALL)
.setVirtualColumns(
expressionVirtualColumn("v0", "concat(\"dim3\",'','foo')", ColumnType.STRING))
.setDimensions(dimensions(new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)))
.setDimensions(dimensions(new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)))
.setDimFilter(equality("v0", "bfoo", ColumnType.STRING))
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
.setLimitSpec(new DefaultLimitSpec(
@ -491,14 +491,14 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
.setVirtualColumns(expressionVirtualColumn("v0", "array_length(\"dim3\")", ColumnType.LONG))
.setDimensions(
dimensions(
new DefaultDimensionSpec("dim1", "_d0", ColumnType.STRING),
new DefaultDimensionSpec("v0", "_d1", ColumnType.LONG)
new DefaultDimensionSpec("dim1", "d0", ColumnType.STRING),
new DefaultDimensionSpec("v0", "d1", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
.setLimitSpec(new DefaultLimitSpec(
ImmutableList.of(new OrderByColumnSpec(
"_d1",
"d1",
OrderByColumnSpec.Direction.DESCENDING,
StringComparators.NUMERIC
)),
@ -559,7 +559,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -619,7 +619,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -680,8 +680,8 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.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)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -739,7 +739,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -799,7 +799,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -836,7 +836,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
.setVirtualColumns(expressionVirtualColumn("v0", "array_offset(\"dim3\",1)", ColumnType.STRING))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -877,7 +877,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -918,7 +918,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG)
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -965,7 +965,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG)
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1030,7 +1030,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1088,7 +1088,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
)
.setDimFilter(range("v0", ColumnType.LONG, 0L, null, true, false))
.setDimensions(dimensions(new DefaultDimensionSpec("v1", "_d0", ColumnType.STRING)))
.setDimensions(dimensions(new DefaultDimensionSpec("v1", "d0", ColumnType.STRING)))
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
.setLimitSpec(new DefaultLimitSpec(
ImmutableList.of(
@ -1098,7 +1098,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
StringComparators.NUMERIC
),
new OrderByColumnSpec(
"_d0",
"d0",
OrderByColumnSpec.Direction.ASCENDING,
StringComparators.LEXICOGRAPHIC
)
@ -1170,7 +1170,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
"string_to_array('a,b',',')",
ColumnType.STRING
))
.setDimensions(dimensions(new DefaultDimensionSpec("m1", "_d0", ColumnType.FLOAT)))
.setDimensions(dimensions(new DefaultDimensionSpec("m1", "d0", ColumnType.FLOAT)))
.setContext(QUERY_CONTEXT_DEFAULT)
.build()
)
@ -1204,8 +1204,8 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
expressionVirtualColumn("v0", "string_to_array('a,b',',')", ColumnType.STRING)
)
.setDimensions(dimensions(
new DefaultDimensionSpec("m1", "_d0", ColumnType.FLOAT),
new DefaultDimensionSpec("v0", "_d1", ColumnType.STRING)
new DefaultDimensionSpec("m1", "d0", ColumnType.FLOAT),
new DefaultDimensionSpec("v0", "d1", ColumnType.STRING)
))
.setContext(QUERY_CONTEXT_DEFAULT)
.build()
@ -1302,7 +1302,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1380,7 +1380,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1473,7 +1473,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG)
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1530,7 +1530,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1597,7 +1597,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1655,7 +1655,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1712,7 +1712,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG)
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1766,8 +1766,8 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
)
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.LONG),
new DefaultDimensionSpec("v1", "_d1", ColumnType.LONG)
new DefaultDimensionSpec("v0", "d0", ColumnType.LONG),
new DefaultDimensionSpec("v1", "d1", ColumnType.LONG)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1818,7 +1818,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
.setDimFilter(equality("v0", "a", ColumnType.STRING))
.setDimensions(
dimensions(
new DefaultDimensionSpec("dim3", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("dim3", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1861,7 +1861,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
.setDimFilter(equality("v0", "b", ColumnType.STRING))
.setDimensions(
dimensions(
new DefaultDimensionSpec("dim3", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("dim3", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1908,7 +1908,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
.setDimFilter(new LikeDimFilter("v0", "b%", null, null))
.setDimensions(
dimensions(
new DefaultDimensionSpec("dim3", "_d0", ColumnType.STRING)
new DefaultDimensionSpec("dim3", "d0", ColumnType.STRING)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -1951,7 +1951,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2003,7 +2003,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))
@ -2059,7 +2059,7 @@ public class CalciteMultiValueStringQueryTest extends BaseCalciteQueryTest
))
.setDimensions(
dimensions(
new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING_ARRAY)
new DefaultDimensionSpec("v0", "d0", ColumnType.STRING_ARRAY)
)
)
.setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt")))

View File

@ -1059,7 +1059,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
public void testAnyAggregatorsOnHeapNumericNulls()
{
testQuery(
"SELECT ANY_VALUE(l1), ANY_VALUE(d1), ANY_VALUE(f1) FROM druid.numfoo",
"SELECT ANY_VALUE(l1), ANY_VALUE(dbl1), ANY_VALUE(f1) FROM druid.numfoo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
@ -1068,7 +1068,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
.aggregators(
aggregators(
new LongAnyAggregatorFactory("a0", "l1"),
new DoubleAnyAggregatorFactory("a1", "d1"),
new DoubleAnyAggregatorFactory("a1", "dbl1"),
new FloatAnyAggregatorFactory("a2", "f1")
)
)
@ -1120,17 +1120,17 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
public void testAnyAggregatorsOffHeapNumericNulls()
{
testQuery(
"SELECT ANY_VALUE(l1), ANY_VALUE(d1), ANY_VALUE(f1) FROM druid.numfoo GROUP BY dim2",
"SELECT ANY_VALUE(l1), ANY_VALUE(dbl1), 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", "d1"),
new DoubleAnyAggregatorFactory("a1", "dbl1"),
new FloatAnyAggregatorFactory("a2", "f1")
)
)
@ -1247,7 +1247,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)
)
@ -1715,7 +1715,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
public void testEarliestAggregatorsNumericNulls()
{
testQuery(
"SELECT EARLIEST(l1), EARLIEST(d1), EARLIEST(f1) FROM druid.numfoo",
"SELECT EARLIEST(l1), EARLIEST(dbl1), EARLIEST(f1) FROM druid.numfoo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
@ -1724,7 +1724,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
.aggregators(
aggregators(
new LongFirstAggregatorFactory("a0", "l1", null),
new DoubleFirstAggregatorFactory("a1", "d1", null),
new DoubleFirstAggregatorFactory("a1", "dbl1", null),
new FloatFirstAggregatorFactory("a2", "f1", null)
)
)
@ -1742,7 +1742,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
{
msqIncompatible();
testQuery(
"SELECT LATEST(l1), LATEST(d1), LATEST(f1) FROM druid.numfoo",
"SELECT LATEST(l1), LATEST(dbl1), LATEST(f1) FROM druid.numfoo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
@ -1751,7 +1751,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
.aggregators(
aggregators(
new LongLastAggregatorFactory("a0", "l1", null),
new DoubleLastAggregatorFactory("a1", "d1", null),
new DoubleLastAggregatorFactory("a1", "dbl1", null),
new FloatLastAggregatorFactory("a2", "f1", null)
)
)
@ -1778,14 +1778,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
filter = and(
notNull("dim1"),
notNull("l1"),
notNull("d1"),
notNull("dbl1"),
notNull("f1")
);
}
testQuery(
"SELECT EARLIEST(dim1, 32), LATEST(l1), LATEST(d1), LATEST(f1) "
"SELECT EARLIEST(dim1, 32), LATEST(l1), LATEST(dbl1), 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",
+ "WHERE dim1 IS NOT NULL AND l1 IS NOT NULL AND dbl1 IS NOT NULL AND f1 is NOT NULL",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
@ -1796,7 +1796,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
aggregators(
new StringFirstAggregatorFactory("a0", "dim1", null, 32),
new LongLastAggregatorFactory("a1", "l1", null),
new DoubleLastAggregatorFactory("a2", "d1", null),
new DoubleLastAggregatorFactory("a2", "dbl1", null),
new FloatLastAggregatorFactory("a3", "f1", null)
)
)
@ -1814,7 +1814,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
public void testAnyAggregatorsDoesNotSkipNulls()
{
testQuery(
"SELECT ANY_VALUE(dim1, 32), ANY_VALUE(l2), ANY_VALUE(d2), ANY_VALUE(f2) FROM druid.numfoo",
"SELECT ANY_VALUE(dim1, 32), ANY_VALUE(l2), ANY_VALUE(dbl2), ANY_VALUE(f2) FROM druid.numfoo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
@ -1824,7 +1824,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
aggregators(
new StringAnyAggregatorFactory("a0", "dim1", 32, true),
new LongAnyAggregatorFactory("a1", "l2"),
new DoubleAnyAggregatorFactory("a2", "d2"),
new DoubleAnyAggregatorFactory("a2", "dbl2"),
new FloatAnyAggregatorFactory("a3", "f2")
)
)
@ -1848,14 +1848,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
filter = and(
notNull("dim1"),
notNull("l2"),
notNull("d2"),
notNull("dbl2"),
notNull("f2")
);
}
testQuery(
"SELECT ANY_VALUE(dim1, 32), ANY_VALUE(l2), ANY_VALUE(d2), ANY_VALUE(f2) "
"SELECT ANY_VALUE(dim1, 32), ANY_VALUE(l2), ANY_VALUE(dbl2), ANY_VALUE(f2) "
+ "FROM druid.numfoo "
+ "WHERE dim1 IS NOT NULL AND l2 IS NOT NULL AND d2 IS NOT NULL AND f2 is NOT NULL",
+ "WHERE dim1 IS NOT NULL AND l2 IS NOT NULL AND dbl2 IS NOT NULL AND f2 is NOT NULL",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
@ -1866,7 +1866,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
aggregators(
new StringAnyAggregatorFactory("a0", "dim1", 32, true),
new LongAnyAggregatorFactory("a1", "l2"),
new DoubleAnyAggregatorFactory("a2", "d2"),
new DoubleAnyAggregatorFactory("a2", "dbl2"),
new FloatAnyAggregatorFactory("a3", "f2")
)
)
@ -1910,7 +1910,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)
@ -1949,16 +1949,16 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
testQuery(
"SELECT dim1, EARLIEST(d1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
"SELECT dim1, EARLIEST(dbl1) 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)
new DoubleFirstAggregatorFactory("a0", "dbl1", null)
)
)
.metric(new InvertedTopNMetricSpec(new NumericTopNMetricSpec("a0")))
@ -2000,7 +2000,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)
@ -2047,7 +2047,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)
@ -2087,16 +2087,16 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
testQuery(
"SELECT dim1, LATEST(d1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
"SELECT dim1, LATEST(dbl1) 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", "d1", null)
new DoubleLastAggregatorFactory("a0", "dbl1", null)
)
)
.metric(new InvertedTopNMetricSpec(new NumericTopNMetricSpec("a0")))
@ -2139,7 +2139,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)
@ -2190,7 +2190,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")
@ -2234,16 +2234,16 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
testQuery(
"SELECT dim1, ANY_VALUE(d1) FROM druid.numfoo GROUP BY 1 ORDER BY 2 LIMIT 10",
"SELECT dim1, ANY_VALUE(dbl1) 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")
new DoubleAnyAggregatorFactory("a0", "dbl1")
)
)
.metric(new InvertedTopNMetricSpec(new NumericTopNMetricSpec("a0")))
@ -2290,7 +2290,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")
@ -3512,7 +3512,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
testQuery(
"SELECT COUNT(*)\n"
+ "FROM druid.numfoo\n"
+ "WHERE d1 IS NULL",
+ "WHERE dbl1 IS NULL",
useDefault
? ImmutableList.of(
Druids.newScanQueryBuilder()
@ -3533,7 +3533,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
.dataSource(CalciteTests.DATASOURCE3)
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.filters(isNull("d1"))
.filters(isNull("dbl1"))
.aggregators(aggregators(new CountAggregatorFactory("a0")))
.context(QUERY_CONTEXT_DEFAULT)
.build()
@ -3706,13 +3706,13 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
testQuery(
"SELECT d1, COUNT(*) FROM druid.numfoo GROUP BY d1 ORDER BY d1 DESC LIMIT 10",
"SELECT dbl1, COUNT(*) FROM druid.numfoo GROUP BY dbl1 ORDER BY dbl1 DESC LIMIT 10",
QUERY_CONTEXT_DEFAULT,
ImmutableList.of(
new TopNQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
.intervals(querySegmentSpec(Filtration.eternity()))
.dimension(new DefaultDimensionSpec("d1", "_d0", ColumnType.DOUBLE))
.dimension(new DefaultDimensionSpec("dbl1", "d0", ColumnType.DOUBLE))
.threshold(10)
.aggregators(aggregators(new CountAggregatorFactory("a0")))
.metric(
@ -3756,7 +3756,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(
@ -3800,7 +3800,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(
@ -3883,13 +3883,13 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
testQuery(
"SELECT COUNT(*)\n"
+ "FROM druid.numfoo\n"
+ "WHERE d1 > 0",
+ "WHERE dbl1 > 0",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.filters(range("d1", ColumnType.LONG, 0L, null, true, false))
.filters(range("dbl1", ColumnType.LONG, 0L, null, true, false))
.aggregators(aggregators(new CountAggregatorFactory("a0")))
.context(QUERY_CONTEXT_DEFAULT)
.build()
@ -4922,15 +4922,15 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
public void testSimpleDoubleAggregations()
{
testQuery(
"SELECT MIN(d1), MAX(d1) FROM druid.numfoo",
"SELECT MIN(dbl1), MAX(dbl1) FROM druid.numfoo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.aggregators(aggregators(
new DoubleMinAggregatorFactory("a0", "d1"),
new DoubleMaxAggregatorFactory("a1", "d1")
new DoubleMinAggregatorFactory("a0", "dbl1"),
new DoubleMaxAggregatorFactory("a1", "dbl1")
))
.context(QUERY_CONTEXT_DEFAULT)
.build()
@ -4968,7 +4968,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(d1), AVG(d1) FROM druid.numfoo",
"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",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
@ -4992,7 +4992,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
new CountAggregatorFactory("a6"),
notNull("dim2")
),
new DoubleSumAggregatorFactory("a7:sum", "d1"),
new DoubleSumAggregatorFactory("a7:sum", "dbl1"),
new CountAggregatorFactory("a7:count")
)
: aggregators(
@ -5019,12 +5019,12 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
),
new FilteredAggregatorFactory(
new CountAggregatorFactory("a8"),
notNull("d1")
notNull("dbl1")
),
new DoubleSumAggregatorFactory("a9:sum", "d1"),
new DoubleSumAggregatorFactory("a9:sum", "dbl1"),
new FilteredAggregatorFactory(
new CountAggregatorFactory("a9:count"),
notNull("d1")
notNull("dbl1")
)
)
)
@ -9058,8 +9058,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))
@ -10387,14 +10387,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
+ " count(*),\n"
+ " COUNT(DISTINCT dim1),\n"
+ " APPROX_COUNT_DISTINCT(distinct dim1),\n"
+ " sum(d1),\n"
+ " max(d1),\n"
+ " min(d1),\n"
+ " sum(dbl1),\n"
+ " max(dbl1),\n"
+ " min(dbl1),\n"
+ " sum(l1),\n"
+ " max(l1),\n"
+ " min(l1),\n"
+ " avg(l1),\n"
+ " avg(d1)\n"
+ " avg(dbl1)\n"
+ "FROM druid.numfoo WHERE dim2 = 0",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
@ -10420,9 +10420,9 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
false,
true
),
new DoubleSumAggregatorFactory("a3", "d1"),
new DoubleMaxAggregatorFactory("a4", "d1"),
new DoubleMinAggregatorFactory("a5", "d1"),
new DoubleSumAggregatorFactory("a3", "dbl1"),
new DoubleMaxAggregatorFactory("a4", "dbl1"),
new DoubleMinAggregatorFactory("a5", "dbl1"),
new LongSumAggregatorFactory("a6", "l1"),
new LongMaxAggregatorFactory("a7", "l1"),
new LongMinAggregatorFactory("a8", "l1"),
@ -10433,12 +10433,12 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
new CountAggregatorFactory("a9:count"),
notNull("l1")
),
new DoubleSumAggregatorFactory("a10:sum", "d1"),
new DoubleSumAggregatorFactory("a10:sum", "dbl1"),
useDefault
? new CountAggregatorFactory("a10:count")
: new FilteredAggregatorFactory(
new CountAggregatorFactory("a10:count"),
notNull("d1")
notNull("dbl1")
)
)
)
@ -10654,14 +10654,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(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ " max(d1) FILTER(WHERE dim1 = 'nonexistent'),\n"
+ " min(d1) 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(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(d1) FILTER(WHERE dim1 = 'nonexistent')\n"
+ " avg(dbl1) FILTER(WHERE dim1 = 'nonexistent')\n"
+ "FROM druid.numfoo WHERE dim2 = 'a' GROUP BY dim2",
ImmutableList.of(
GroupByQuery.builder()
@ -10670,7 +10670,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(
@ -10698,15 +10698,15 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
equality("dim1", "nonexistent", ColumnType.STRING)
),
new FilteredAggregatorFactory(
new DoubleSumAggregatorFactory("a3", "d1"),
new DoubleSumAggregatorFactory("a3", "dbl1"),
equality("dim1", "nonexistent", ColumnType.STRING)
),
new FilteredAggregatorFactory(
new DoubleMaxAggregatorFactory("a4", "d1"),
new DoubleMaxAggregatorFactory("a4", "dbl1"),
equality("dim1", "nonexistent", ColumnType.STRING)
),
new FilteredAggregatorFactory(
new DoubleMinAggregatorFactory("a5", "d1"),
new DoubleMinAggregatorFactory("a5", "dbl1"),
equality("dim1", "nonexistent", ColumnType.STRING)
),
new FilteredAggregatorFactory(
@ -10738,7 +10738,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
)
),
new FilteredAggregatorFactory(
new DoubleSumAggregatorFactory("a10:sum", "d1"),
new DoubleSumAggregatorFactory("a10:sum", "dbl1"),
equality("dim1", "nonexistent", ColumnType.STRING)
),
useDefault
@ -10749,7 +10749,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
: new FilteredAggregatorFactory(
new CountAggregatorFactory("a10:count"),
and(
notNull("d1"),
notNull("dbl1"),
equality("dim1", "nonexistent", ColumnType.STRING)
)
)
@ -10827,7 +10827,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(
@ -13299,14 +13299,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
public void testFilterDoubleDimension()
{
testQuery(
"SELECT dim1 FROM numfoo WHERE d1 = 1.7 LIMIT 1",
"SELECT dim1 FROM numfoo WHERE dbl1 = 1.7 LIMIT 1",
ImmutableList.of(
newScanQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
.intervals(querySegmentSpec(Filtration.eternity()))
.columns("dim1")
.columnTypes(ColumnType.STRING)
.filters(equality("d1", 1.7, ColumnType.DOUBLE))
.filters(equality("dbl1", 1.7, ColumnType.DOUBLE))
.resultFormat(ScanQuery.ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
.limit(1)
.context(QUERY_CONTEXT_DEFAULT)
@ -13576,7 +13576,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()
)
@ -13588,15 +13588,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)
@ -14175,7 +14175,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(
@ -14350,7 +14350,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(
@ -14597,7 +14597,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
{
cannotVectorize();
testQuery(
"SELECT STRING_AGG(l1, ','), STRING_AGG(DISTINCT l1, ','), STRING_AGG(d1, ','), STRING_AGG(DISTINCT d1, ','), STRING_AGG(f1, ','), STRING_AGG(DISTINCT f1, ',') FROM numfoo",
"SELECT STRING_AGG(l1, ','), STRING_AGG(DISTINCT l1, ','), STRING_AGG(dbl1, ','), STRING_AGG(DISTINCT dbl1, ','), STRING_AGG(f1, ','), STRING_AGG(DISTINCT f1, ',') FROM numfoo",
ImmutableList.of(
Druids.newTimeseriesQueryBuilder()
.dataSource(CalciteTests.DATASOURCE3)
@ -14646,40 +14646,40 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
new FilteredAggregatorFactory(
new ExpressionLambdaAggregatorFactory(
"a2",
ImmutableSet.of("d1"),
ImmutableSet.of("dbl1"),
"__acc",
"[]",
"[]",
true,
false,
false,
"array_append(\"__acc\", \"d1\")",
"array_append(\"__acc\", \"dbl1\")",
"array_concat(\"__acc\", \"a2\")",
null,
"if(array_length(o) == 0, null, array_to_string(o, ','))",
ExpressionLambdaAggregatorFactory.DEFAULT_MAX_SIZE_BYTES,
TestExprMacroTable.INSTANCE
),
notNull("d1")
notNull("dbl1")
),
new FilteredAggregatorFactory(
new ExpressionLambdaAggregatorFactory(
"a3",
ImmutableSet.of("d1"),
ImmutableSet.of("dbl1"),
"__acc",
"[]",
"[]",
true,
false,
false,
"array_set_add(\"__acc\", \"d1\")",
"array_set_add(\"__acc\", \"dbl1\")",
"array_set_add_all(\"__acc\", \"a3\")",
null,
"if(array_length(o) == 0, null, array_to_string(o, ','))",
ExpressionLambdaAggregatorFactory.DEFAULT_MAX_SIZE_BYTES,
TestExprMacroTable.INSTANCE
),
notNull("d1")
notNull("dbl1")
),
new FilteredAggregatorFactory(
new ExpressionLambdaAggregatorFactory(
@ -15221,7 +15221,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)
))
@ -15248,7 +15248,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)
@ -15286,7 +15286,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)
@ -15328,7 +15328,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)))
@ -16328,8 +16328,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)

View File

@ -481,7 +481,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
+ "BITWISE_COMPLEMENT(l1),\n"
+ "BITWISE_SHIFT_LEFT(l1, 2),\n"
+ "BITWISE_SHIFT_RIGHT(l1, 2),\n"
+ "BITWISE_CONVERT_DOUBLE_TO_LONG_BITS(d1),\n"
+ "BITWISE_CONVERT_DOUBLE_TO_LONG_BITS(dbl1),\n"
+ "BITWISE_CONVERT_LONG_BITS_TO_DOUBLE(l1)\n"
+ "FROM numfoo",
ImmutableList.of(
@ -497,7 +497,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
expressionVirtualColumn("v3", "bitwiseComplement(\"l1\")", ColumnType.LONG),
expressionVirtualColumn("v4", "bitwiseShiftLeft(\"l1\",2)", ColumnType.LONG),
expressionVirtualColumn("v5", "bitwiseShiftRight(\"l1\",2)", ColumnType.LONG),
expressionVirtualColumn("v6", "bitwiseConvertDoubleToLongBits(\"d1\")", ColumnType.LONG),
expressionVirtualColumn("v6", "bitwiseConvertDoubleToLongBits(\"dbl1\")", ColumnType.LONG),
expressionVirtualColumn("v7", "bitwiseConvertLongBitsToDouble(\"l1\")", ColumnType.DOUBLE)
)
.context(QUERY_CONTEXT_DEFAULT)
@ -579,7 +579,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
"SELECT\n"
+ "SAFE_DIVIDE(f1, f2),\n"
+ "SAFE_DIVIDE(l1, l2),\n"
+ "SAFE_DIVIDE(d2, d1),\n"
+ "SAFE_DIVIDE(dbl2, dbl1),\n"
+ "SAFE_DIVIDE(l1, f1)\n"
+ "FROM numfoo",
ImmutableList.of(
@ -591,7 +591,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
.virtualColumns(
expressionVirtualColumn("v0", "safe_divide(\"f1\",\"f2\")", ColumnType.FLOAT),
expressionVirtualColumn("v1", "safe_divide(\"l1\",\"l2\")", ColumnType.LONG),
expressionVirtualColumn("v2", "safe_divide(\"d2\",\"d1\")", ColumnType.DOUBLE),
expressionVirtualColumn("v2", "safe_divide(\"dbl2\",\"dbl1\")", ColumnType.DOUBLE),
expressionVirtualColumn("v3", "safe_divide(\"l1\",\"f1\")", ColumnType.FLOAT)
)
.context(QUERY_CONTEXT_DEFAULT)
@ -2143,7 +2143,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
// possibly pollute the cache
// https://github.com/apache/druid/issues/16552
testBuilder()
.sql("select dim1,d1 from numfoo where 0.0 < d1 and d1 < 1.25 group by dim1,d1")
.sql("select dim1,dbl1 from numfoo where 0.0 < dbl1 and dbl1 < 1.25 group by dim1,dbl1")
.expectedResults(
ImmutableList.of(
new Object[] {"", 1.0D}
@ -2152,7 +2152,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
.run();
testBuilder()
.sql("select dim1,d1 from numfoo where 0.0 < d1 and d1 < 1.75 group by dim1,d1")
.sql("select dim1,dbl1 from numfoo where 0.0 < dbl1 and dbl1 < 1.75 group by dim1,dbl1")
.expectedResults(
ImmutableList.of(
new Object[] {"", 1.0D},

View File

@ -84,14 +84,14 @@ public class CalciteTableAppendTest extends BaseCalciteQueryTest
public void testAppend2()
{
testBuilder()
.sql("select dim1,dim4,d1,f1 from TABLE(APPEND('foo','numfoo')) u")
.sql("select dim1,dim4,dbl1,f1 from TABLE(APPEND('foo','numfoo')) u")
.expectedQuery(
Druids.newScanQueryBuilder()
.dataSource(
unionDataSource(CalciteTests.DATASOURCE1, CalciteTests.DATASOURCE3)
)
.intervals(querySegmentSpec(Filtration.eternity()))
.columns("dim1", "dim4", "d1", "f1")
.columns("dim1", "dim4", "dbl1", "f1")
.columnTypes(ColumnType.STRING, ColumnType.STRING, ColumnType.DOUBLE, ColumnType.FLOAT)
.context(QUERY_CONTEXT_DEFAULT)
.resultFormat(ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
@ -126,14 +126,14 @@ public class CalciteTableAppendTest extends BaseCalciteQueryTest
public void testAppendSameTableMultipleTimes()
{
testBuilder()
.sql("select dim1,dim4,d1,f1 from TABLE(APPEND('foo','numfoo','foo')) u where dim1='2'")
.sql("select dim1,dim4,dbl1,f1 from TABLE(APPEND('foo','numfoo','foo')) u where dim1='2'")
.expectedQuery(
Druids.newScanQueryBuilder()
.dataSource(
unionDataSource(CalciteTests.DATASOURCE1, CalciteTests.DATASOURCE3, CalciteTests.DATASOURCE1)
)
.intervals(querySegmentSpec(Filtration.eternity()))
.columns("dim1", "dim4", "d1", "f1")
.columns("dim1", "dim4", "dbl1", "f1")
.columnTypes(ColumnType.STRING, ColumnType.STRING, ColumnType.DOUBLE, ColumnType.FLOAT)
.context(QUERY_CONTEXT_DEFAULT)
.resultFormat(ResultFormat.RESULT_FORMAT_COMPACTED_LIST)

View File

@ -55,6 +55,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@ -79,6 +80,7 @@ import java.util.stream.Collectors;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
/**
* These test cases are borrowed from the drill-test-framework at
@ -113,9 +115,12 @@ public class DrillWindowQueryTest extends BaseCalciteQueryTest
@Test
public void ensureAllDeclared() throws Exception
{
assumeTrue(DrillWindowQueryTest.class.equals(getClass()));
final URL windowQueriesUrl = ClassLoader.getSystemResource("drill/window/queries/");
Path windowFolder = new File(windowQueriesUrl.toURI()).toPath();
Set<String> allCases = FileUtils
.streamFiles(windowFolder.toFile(), true, "q")
.map(file -> {

View File

@ -171,8 +171,8 @@ public class TestDataBuilder
"dim5",
"dim6"
)))
.add(new DoubleDimensionSchema("d1"))
.add(new DoubleDimensionSchema("d2"))
.add(new DoubleDimensionSchema("dbl1"))
.add(new DoubleDimensionSchema("dbl2"))
.add(new FloatDimensionSchema("f1"))
.add(new FloatDimensionSchema("f2"))
.add(new LongDimensionSchema("l1"))
@ -390,7 +390,7 @@ public class TestDataBuilder
.put("t", "2000-01-01")
.put("m1", "1.0")
.put("m2", "1.0")
.put("d1", 1.0)
.put("dbl1", 1.0)
.put("f1", 1.0f)
.put("l1", 7L)
.put("dim1", "")
@ -404,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("dbl1", 1.7)
.put("dbl2", 1.7)
.put("f1", 0.1f)
.put("f2", 0.1f)
.put("l1", 325323L)
@ -421,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("dbl1", 0.0)
.put("dbl2", 0.0)
.put("f1", 0.0)
.put("f2", 0.0)
.put("l1", 0)
@ -594,8 +594,8 @@ public class TestDataBuilder
x.get("dim3"),
x.get("dim4"),
x.get("dim5"),
x.get("d1"),
x.get("d2"),
x.get("dbl1"),
x.get("dbl2"),
x.get("f1"),
x.get("f2"),
x.get("l1"),
@ -607,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("dbl1", ColumnType.DOUBLE)
.add("dbl2", ColumnType.DOUBLE)
.add("f1", ColumnType.FLOAT)
.add("f2", ColumnType.FLOAT)
.add("l1", ColumnType.LONG)

View File

@ -4,9 +4,9 @@
SELECT d3 FROM (select * from druid.numfoo where dim2='a'), UNNEST(MV_TO_ARRAY(dim3)) as unnested (d3);
LogicalProject(d3=[$17])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], d3=[$18])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], d3=[$18])
LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{17}])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], $f17=[MV_TO_ARRAY($3)])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], $f17=[MV_TO_ARRAY($3)])
LogicalFilter(condition=[=($2, 'a')])
LogicalTableScan(table=[[druid, numfoo]])
LogicalProject(d3=[$0])
@ -19,7 +19,7 @@ LogicalProject(d3=[$17])
LogicalProject(d3=[$18])
LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{17}])
LogicalProject(__time=[$0], dim1=[$1], dim2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], $f17=[MV_TO_ARRAY($3)])
LogicalProject(__time=[$0], dim1=[$1], dim2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], $f17=[MV_TO_ARRAY($3)])
LogicalFilter(condition=[=($2, 'a')])
LogicalTableScan(table=[[druid, numfoo]])
Uncollect

View File

@ -22,13 +22,13 @@ SELECT substring(d3,1) FROM druid.numfoo, UNNEST(MV_TO_ARRAY(dim3)) as unnested
!ok
LogicalProject(EXPR$0=[SUBSTRING($18, 1)])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>(SUBSTRING($0, 1), 'b')])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(EXPR$0=[SUBSTRING($18, 1)], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>(SUBSTRING($0, 1), 'b')])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan

View File

@ -22,13 +22,13 @@ SELECT substring(d3,1) FROM druid.numfoo, UNNEST(MV_TO_ARRAY(dim3)) as unnested
!ok
LogicalProject(EXPR$0=[SUBSTRING($18, 1)])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>(SUBSTRING($0, 1), 'b')])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(EXPR$0=[SUBSTRING($18, 1)], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>(SUBSTRING($0, 1), 'b')])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan

View File

@ -21,14 +21,14 @@ SELECT d3 FROM (select * from druid.numfoo where dim2='a'), UNNEST(MV_TO_ARRAY(d
!ok
LogicalProject(d3=[$18])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)])
LogicalProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalFilter(condition=[=($2, 'a')])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(d3=[$18], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)])
DruidProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidFilter(condition=[=($2, 'a')])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
@ -61,7 +61,7 @@ DruidProject(d3=[$18], druid=[logical])
"dimension" : "dim2",
"value" : "a"
},
"columns" : [ "__time", "dim1", "v0", "dim3", "dim4", "dim5", "dim6", "d1", "d2", "f1", "f2", "l1", "l2", "cnt", "m1", "m2", "unique_dim1" ],
"columns" : [ "__time", "dim1", "v0", "dim3", "dim4", "dim5", "dim6", "dbl1", "dbl2", "f1", "f2", "l1", "l2", "cnt", "m1", "m2", "unique_dim1" ],
"columnTypes" : [ "LONG", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING", "DOUBLE", "DOUBLE", "FLOAT", "FLOAT", "LONG", "LONG", "LONG", "FLOAT", "DOUBLE", "COMPLEX<hyperUnique>" ],
"granularity" : {
"type" : "all"

View File

@ -22,14 +22,14 @@ SELECT d3 FROM (select * from druid.numfoo where dim2='a'), UNNEST(MV_TO_ARRAY(d
!ok
LogicalProject(d3=[$18])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)])
LogicalProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalFilter(condition=[=($2, 'a')])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(d3=[$18], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)])
DruidProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidFilter(condition=[=($2, 'a')])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
@ -63,7 +63,7 @@ DruidProject(d3=[$18], druid=[logical])
"matchValueType" : "STRING",
"matchValue" : "a"
},
"columns" : [ "__time", "dim1", "v0", "dim3", "dim4", "dim5", "dim6", "d1", "d2", "f1", "f2", "l1", "l2", "cnt", "m1", "m2", "unique_dim1" ],
"columns" : [ "__time", "dim1", "v0", "dim3", "dim4", "dim5", "dim6", "dbl1", "dbl2", "f1", "f2", "l1", "l2", "cnt", "m1", "m2", "unique_dim1" ],
"columnTypes" : [ "LONG", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING", "DOUBLE", "DOUBLE", "FLOAT", "FLOAT", "LONG", "LONG", "LONG", "FLOAT", "DOUBLE", "COMPLEX<hyperUnique>" ],
"granularity" : {
"type" : "all"

View File

@ -24,14 +24,14 @@ AND unnested.d3 <> 'b';
!ok
LogicalProject(d3=[$18])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>($0, 'b')])
LogicalProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalFilter(condition=[AND(=($2, 'a'), <>($1, 'foo'))])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(d3=[$18], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>($0, 'b')])
DruidProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidFilter(condition=[AND(=($2, 'a'), <>($1, 'foo'))])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
@ -74,7 +74,7 @@ DruidProject(d3=[$18], druid=[logical])
}
} ]
},
"columns" : [ "__time", "dim1", "v0", "dim3", "dim4", "dim5", "dim6", "d1", "d2", "f1", "f2", "l1", "l2", "cnt", "m1", "m2", "unique_dim1" ],
"columns" : [ "__time", "dim1", "v0", "dim3", "dim4", "dim5", "dim6", "dbl1", "dbl2", "f1", "f2", "l1", "l2", "cnt", "m1", "m2", "unique_dim1" ],
"columnTypes" : [ "LONG", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING", "DOUBLE", "DOUBLE", "FLOAT", "FLOAT", "LONG", "LONG", "LONG", "FLOAT", "DOUBLE", "COMPLEX<hyperUnique>" ],
"granularity" : {
"type" : "all"

View File

@ -25,14 +25,14 @@ AND unnested.d3 <> 'b';
!ok
LogicalProject(d3=[$18])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>($0, 'b')])
LogicalProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalFilter(condition=[AND(=($2, 'a'), <>($1, 'foo'))])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(d3=[$18], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>($0, 'b')])
DruidProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], $f2=[CAST('a':VARCHAR):VARCHAR], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidFilter(condition=[AND(=($2, 'a'), <>($1, 'foo'))])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
@ -77,7 +77,7 @@ DruidProject(d3=[$18], druid=[logical])
}
} ]
},
"columns" : [ "__time", "dim1", "v0", "dim3", "dim4", "dim5", "dim6", "d1", "d2", "f1", "f2", "l1", "l2", "cnt", "m1", "m2", "unique_dim1" ],
"columns" : [ "__time", "dim1", "v0", "dim3", "dim4", "dim5", "dim6", "dbl1", "dbl2", "f1", "f2", "l1", "l2", "cnt", "m1", "m2", "unique_dim1" ],
"columnTypes" : [ "LONG", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING", "DOUBLE", "DOUBLE", "FLOAT", "FLOAT", "LONG", "LONG", "LONG", "FLOAT", "DOUBLE", "COMPLEX<hyperUnique>" ],
"granularity" : {
"type" : "all"

View File

@ -24,13 +24,13 @@ SELECT d3 FROM druid.numfoo, UNNEST(MV_TO_ARRAY(dim3)) as unnested (d3) where st
!ok
LogicalProject(d3=[$18])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[OR(<(STRLEN($0), 2), =($0, 'd'))])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(d3=[$18], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[OR(<(STRLEN($0), 2), =($0, 'd'))])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan

View File

@ -25,13 +25,13 @@ SELECT d3 FROM druid.numfoo, UNNEST(MV_TO_ARRAY(dim3)) as unnested (d3) where st
!ok
LogicalProject(d3=[$18])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[OR(<(STRLEN($0), 2), =($0, 'd'))])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(d3=[$18], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[OR(<(STRLEN($0), 2), =($0, 'd'))])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan

View File

@ -23,13 +23,13 @@ SELECT d3 FROM druid.numfoo, UNNEST(MV_TO_ARRAY(dim3)) as unnested (d3) where d3
!ok
LogicalProject(d3=[$18])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>($0, 'd')])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(d3=[$18], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>($0, 'd')])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan

View File

@ -24,13 +24,13 @@ SELECT d3 FROM druid.numfoo, UNNEST(MV_TO_ARRAY(dim3)) as unnested (d3) where d3
!ok
LogicalProject(d3=[$18])
LogicalUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>($0, 'd')])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(d3=[$18], druid=[logical])
DruidUnnest(unnestExpr=[MV_TO_ARRAY($3)], filter=[<>($0, 'd')])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], d1=[$7], d2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidProject(__time=[$0], dim1=[$1], dim2=[$2], dim3=[$3], dim4=[$4], dim5=[$5], dim6=[$6], dbl1=[$7], dbl2=[$8], f1=[$9], f2=[$10], l1=[$11], l2=[$12], cnt=[$13], m1=[$14], m2=[$15], unique_dim1=[$16], __time0=[$0], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan

View File

@ -74,7 +74,7 @@ DruidSort(fetch=[1], druid=[logical])
"dimensions" : [ {
"type" : "default",
"dimension" : "dim4",
"outputName" : "_d0",
"outputName" : "d0",
"outputType" : "STRING"
} ],
"limitSpec" : {
@ -83,7 +83,7 @@ DruidSort(fetch=[1], druid=[logical])
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim4\" == \"j0._d0\")",
"condition" : "(\"dim4\" == \"j0.d0\")",
"joinType" : "INNER"
},
"dimension" : {

View File

@ -75,7 +75,7 @@ DruidSort(fetch=[1], druid=[logical])
"dimensions" : [ {
"type" : "default",
"dimension" : "dim4",
"outputName" : "_d0",
"outputName" : "d0",
"outputType" : "STRING"
} ],
"limitSpec" : {
@ -84,7 +84,7 @@ DruidSort(fetch=[1], druid=[logical])
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim4\" == \"j0._d0\")",
"condition" : "(\"dim4\" == \"j0.d0\")",
"joinType" : "INNER"
},
"dimension" : {

View File

@ -43,7 +43,7 @@ DruidProject(dim4=[CAST('a':VARCHAR):VARCHAR], EXPR$1=[$0], EXPR$2=[$1], druid=[
"dimension" : {
"type" : "extraction",
"dimension" : "dim5",
"outputName" : "_d0",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",

View File

@ -43,7 +43,7 @@ DruidProject(dim4=[CAST('a':VARCHAR):VARCHAR], EXPR$1=[$0], EXPR$2=[$1], druid=[
"dimension" : {
"type" : "extraction",
"dimension" : "dim5",
"outputName" : "_d0",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",

View File

@ -70,7 +70,7 @@ DruidProject(t1=['dummy'], t2=[$0], druid=[logical])
"dimensions" : [ {
"type" : "default",
"dimension" : "dim4",
"outputName" : "_d0",
"outputName" : "d0",
"outputType" : "STRING"
} ],
"limitSpec" : {
@ -85,7 +85,7 @@ DruidProject(t1=['dummy'], t2=[$0], druid=[logical])
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "case_searched((\"_d0\" == 'b'),\"_d0\",null)",
"expression" : "case_searched((\"d0\" == 'b'),\"d0\",null)",
"outputType" : "STRING"
} ],
"granularity" : {
@ -94,7 +94,7 @@ DruidProject(t1=['dummy'], t2=[$0], druid=[logical])
"dimensions" : [ {
"type" : "default",
"dimension" : "v0",
"outputName" : "d0",
"outputName" : "_d0",
"outputType" : "STRING"
} ],
"postAggregations" : [ {

View File

@ -17,19 +17,19 @@ expectedOperators:
type: "framedAgg"
frame: { type: "rows" }
aggregations:
- { "type": "doubleSum", "name": "w1", "fieldName": "_d1" }
- { "type": "doubleSum", "name": "w1", "fieldName": "d1" }
- type: "naiveSort"
columns:
- column: "_d1"
- column: "d1"
direction: "ASC"
- type: "naivePartition"
partitionColumns: [ "_d1" ]
partitionColumns: [ "d1" ]
- type: "window"
processor:
type: "framedAgg"
frame: { type: "rows" }
aggregations:
- { "type": "doubleSum", "name": "w0", "fieldName": "_d0" }
- { "type": "doubleSum", "name": "w0", "fieldName": "d0" }
expectedResults:
- [1.0, 1.0, 1.0, 21.0]
- [2.0, 2.0, 2.0, 21.0]

View File

@ -3,11 +3,11 @@ type: "operatorValidation"
sql: |
SELECT
count(*) over (),
ARRAY_AGG(d1, 100), ARRAY_AGG(f1, 100), ARRAY_AGG(m1, 100)
ARRAY_AGG(dbl1, 100), ARRAY_AGG(f1, 100), ARRAY_AGG(m1, 100)
FROM numfoo
WHERE d1>0 AND f1>0
GROUP BY d1, f1, m1
ORDER BY d1, f1, m1
WHERE dbl1>0 AND f1>0
GROUP BY dbl1, f1, m1
ORDER BY dbl1, f1, m1
expectedResults:
- [2,[1.0],[1.0],[1.0]]

View File

@ -14,8 +14,8 @@ sql: |
WINDOW W AS (partition by dim2 ORDER BY dim1 ROWS UNBOUNDED FOLLOWING)
expectedOperators:
- {"type":"naiveSort","columns":[{"column":"_d1","direction":"ASC"},{"column":"_d0","direction":"ASC"}]}
- { type: "naivePartition", partitionColumns: [ "_d1" ] }
- {"type":"naiveSort","columns":[{"column":"d1","direction":"ASC"},{"column":"d0","direction":"ASC"}]}
- { type: "naivePartition", partitionColumns: [ "d1" ] }
- type: "window"
processor:
type: "framedAgg"