Hi Mahendrakar, I would say that Values should be handled more or less the same way that we handle a TableScan so returning null seems like a bug.
However, to be sure it would help if you can come up with a concrete query/plan that cannot be decorrelated due to this. If that's the case please log a JIRA case with the steps to reproduce. You can try to create a test case in SqlToRelConverterTest [1] or RelOptRulesTest [2]. Best, Stamatis [1] https://github.com/apache/calcite/blob/07e420bfc36e8f217f5c3459fdf6c1ede609cb80/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java [2] https://github.com/apache/calcite/blob/07e420bfc36e8f217f5c3459fdf6c1ede609cb80/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java On Thu, Nov 11, 2021 at 8:18 AM Mahendrakar Srinivasarao < [email protected]> wrote: > Hi Community, > > Hope you are doing well. > I have a question about the handling of Values Rel. > > File: RelDecorrelator.java > > public Frame decorrelateRel(Values rel, boolean isCorVarDefined) { > return null; > } > > Why do we return null for Values Rel. Can you please let me know. > > > While looking at the join/union handlers (in the same file), if one of > the input frame is null, handler returns null. > > JOIN > > Input1 Input2 > > > In the above scenario, let's say input1 is decorrelated successfully > but Input2 has Values Rel, in which case we return null as per the > logic in Join (below). > > public Frame decorrelateRel(Join rel, boolean isCorVarDefined) { > > . > > . > > . > > final RelNode oldLeft = rel.getInput(0); > final RelNode oldRight = rel.getInput(1); > > final Frame leftFrame = getInvoke(oldLeft, isCorVarDefined, rel); > final Frame rightFrame = getInvoke(oldRight, isCorVarDefined, rel); > > if (leftFrame == null || rightFrame == null) { > // If any input has not been rewritten, do not rewrite this rel. > return null; > > . > > . > > > . > } > > > > > Thanks, > Mahendrakar. >
