pvillard31 commented on code in PR #10269:
URL: https://github.com/apache/nifi/pull/10269#discussion_r2322703165
##########
nifi-commons/nifi-calcite-utils/src/main/java/org/apache/nifi/sql/internal/NiFiProjectTableScanRule.java:
##########
@@ -19,24 +19,29 @@
import org.apache.calcite.plan.RelOptRuleCall;
import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.core.Project;
import org.apache.calcite.rel.core.RelFactories;
-import org.apache.calcite.rel.logical.LogicalProject;
import org.apache.calcite.rex.RexInputRef;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.tools.RelBuilderFactory;
import java.util.List;
-class NiFiProjectTableScanRule extends
RelRule<NiFiProjectTableScanRule.Config> {
+public class NiFiProjectTableScanRule extends
RelRule<NiFiProjectTableScanRule.Config> {
NiFiProjectTableScanRule(final Config config) {
super(config);
}
@Override
public void onMatch(final RelOptRuleCall call) {
- final LogicalProject project = call.rel(0);
- final NiFiTableScan scan = call.rel(1);
+ final Project project = call.rel(0);
+
+ // Attempt to locate NiFiTableScan as immediate input
+ if (!(project.getInput() instanceof NiFiTableScan)) {
+ return;
+ }
+ final NiFiTableScan scan = (NiFiTableScan) project.getInput();
Review Comment:
Yep, good point, I need to use this pattern matching more
--
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]