kgyrtkirk commented on code in PR #17550:
URL: https://github.com/apache/druid/pull/17550#discussion_r1905623884


##########
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQSelectTest.java:
##########
@@ -2494,12 +2494,11 @@ public void testJoinUsesDifferentAlgorithm(String 
contextName, Map<String, Objec
                 new QueryDataSource(
                     newScanQueryBuilder()
                         .dataSource("foo")
-                        .virtualColumns(expressionVirtualColumn("v0", "0", 
ColumnType.LONG))
-                        .columns("v0")
+                        .columns("__time")
                         .columnTypes(ColumnType.LONG)
                         .context(defaultScanQueryContext(
                             queryContext,
-                            RowSignature.builder().add("v0", 
ColumnType.LONG).build()
+                            RowSignature.builder().add("__time", 
ColumnType.LONG).build()

Review Comment:
   no columns are needed from the left hand side; but Calcite has some tweaks 
here and there to avoid relnodes with `0` columns.
   
   This PR suppresses the introduction of a column with the `0` value by the 
[Fieldtrimmer](https://github.com/apache/calcite/blob/7d4135eb17e2a70ac608ab1dd3e5a7f4d03706da/core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java#L575-L602)
   but in one of the rules there is also an unconditional projection of the 
[1st 
columns](https://github.com/apache/calcite/blob/7d4135eb17e2a70ac608ab1dd3e5a7f4d03706da/core/src/main/java/org/apache/calcite/rel/rules/PushProjector.java#L458-L464)
   
   which causes this change.
   
   We should be able to handle the case of empty columns - I wanted to dig into 
that more deeply ; as it seems like there are also some rule combinations which 
may lead to an empty column set...(but forgot the testcase)
   
   I think that in general Calcite should be able to handle these things - and 
we should only make 
   corrections in the execution engine if it causes issues.



-- 
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]

Reply via email to