clintropolis commented on code in PR #18092:
URL: https://github.com/apache/druid/pull/18092#discussion_r2264531952
##########
sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java:
##########
@@ -7508,21 +7543,14 @@ public void testApproxCountDistinct()
new CardinalityAggregatorFactory(
"a3",
null,
- dimensions(
- new ExtractionDimensionSpec(
- "dim2",
- "dim2",
- ColumnType.STRING,
- new SubstringDimExtractionFn(0, 1)
- )
- ),
+ dimensions(new DefaultDimensionSpec("v0", "v0")),
Review Comment:
nit: `DefaultDimensionSpec.of`
##########
sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java:
##########
@@ -7483,7 +7517,8 @@ public void testApproxCountDistinct()
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.virtualColumns(
- expressionVirtualColumn("v0",
"concat(substring(\"dim2\", 0, 1),'x')", ColumnType.STRING)
+ expressionVirtualColumn("v0", "substring(\"dim2\", 0,
1)", ColumnType.STRING),
+ expressionVirtualColumn("v1",
"concat(substring(\"dim2\", 0, 1),'x')", ColumnType.STRING)
Review Comment:
this reminds me we need to look into re-using existing virtual columns when
we are building the final list, since i think `v1` should really be
`concat("v0", 'x')`. Even better would be all common sub-expressions split out
so that cached computations could be re-used among similar expressions
##########
sql/src/test/java/org/apache/druid/sql/calcite/CalciteArraysQueryTest.java:
##########
@@ -1014,8 +1015,14 @@ public void testArrayOverlapFilterDoubleArrayColumn()
@Test
public void testArrayOverlapFilterWithExtractionFn()
{
+ final Map<String, Object> queryContext = QueryContexts.override(
+ QUERY_CONTEXT_DEFAULT,
+ ImmutableMap.of(PlannerContext.CTX_SQL_USE_EXTRACTION_FNS, true)
Review Comment:
nit: old habits die hard, but I think we've been starting to move towards
using like `Map.of` and `List.of` instead of these
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]