dan-s1 commented on code in PR #10269:
URL: https://github.com/apache/nifi/pull/10269#discussion_r2322690384
##########
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:
Per Intellij, the declaration of the `scan` variable can be replaced with a
pattern variable
```suggestion
// Attempt to locate NiFiTableScan as immediate input
if (!(project.getInput() instanceof NiFiTableScan scan)) {
return;
}
```
--
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]