From d3b69d9f77693f6e394d321fa67f83646f6846be Mon Sep 17 00:00:00 2001 From: Alessandro Solimando Date: Tue, 27 Feb 2024 21:54:25 +0100 Subject: [PATCH] split add method for ArrowRel.Implementor --- .../calcite/adapter/arrow/ArrowFilter.java | 2 +- .../calcite/adapter/arrow/ArrowProject.java | 5 ++++- .../calcite/adapter/arrow/ArrowRel.java | 20 ++++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowFilter.java b/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowFilter.java index 6ca169bfb175..5d936293b952 100644 --- a/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowFilter.java +++ b/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowFilter.java @@ -60,6 +60,6 @@ class ArrowFilter extends Filter implements ArrowRel { @Override public void implement(Implementor implementor) { implementor.visitInput(0, getInput()); - implementor.add(null, match); + implementor.addFilters(match); } } diff --git a/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowProject.java b/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowProject.java index 770f12244e59..8fee390d543f 100644 --- a/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowProject.java +++ b/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowProject.java @@ -65,7 +65,10 @@ class ArrowProject extends Project implements ArrowRel { @Override public void implement(Implementor implementor) { implementor.visitInput(0, getInput()); - implementor.add(getProjectFields(getProjects()), null); + List projectedFields = getProjectFields(getProjects()); + if (projectedFields != null) { + implementor.addProjectFields(projectedFields); + } } static @Nullable List getProjectFields(List exps) { diff --git a/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowRel.java b/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowRel.java index 1576acf4d546..e6e953cb33e4 100644 --- a/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowRel.java +++ b/arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowRel.java @@ -43,18 +43,20 @@ class Implementor { @Nullable RelOptTable table; @Nullable ArrowTable arrowTable; - /** Adds newly projected fields and restricted predicates. + /** Adds new predicates. * - * @param fields New fields to be projected from a query * @param predicates Predicates */ - void add(@Nullable List fields, @Nullable List predicates) { - if (fields != null) { - selectFields = ImmutableIntList.copyOf(fields); - } - if (predicates != null) { - whereClause.addAll(predicates); - } + void addFilters(List predicates) { + whereClause.addAll(predicates); + } + + /** Adds newly projected fields. + * + * @param fields New fields to be projected from a query + */ + void addProjectFields(List fields) { + selectFields = ImmutableIntList.copyOf(fields); } public void visitInput(int ordinal, RelNode input) {