Diveyam-Mishra commented on code in PR #5048:
URL: https://github.com/apache/calcite/pull/5048#discussion_r3489871307


##########
file/src/main/java/org/apache/calcite/adapter/file/CsvFilterTableScanRule.java:
##########
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.file;
+
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.logical.LogicalFilter;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexInputRef;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.rex.RexUtil;
+import org.apache.calcite.sql.SqlKind;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.immutables.value.Value;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Planner rule that pushes simple equality filter predicates into a
+ * {@link CsvTableScan}.
+ *
+ * <p>Only equality conditions of the form {@code column = literal} can be
+ * pushed down, because {@link CsvEnumerator} only supports per-column

Review Comment:
   My current plan is to introduce a CsvFilter abstraction to represent the 
subset of filters that can be pushed down (initially AND, OR, = and <>, 
including null comparisons). Rather than encoding pushdown state as 
column-value arrays, the planner will build a CsvFilter tree, serialize it, and 
pass the serialized representation through CsvTableScan/CsvTranslatableTable to 
CsvEnumerator, where it will be deserialized and evaluated against each row.
   
   The CsvFilter classes are intended to be a lightweight data model 
representing pushdownable predicates, while evaluation, 
serialization/deserialization, and pretty-printing remain separate concerns. 
This keeps the representation extensible for additional pushdown operators in 
the future without requiring further changes to the transport mechanism between 
planning and execution.
   There is one more option which is to do exactly what spark does compile the 
filter all the way down to actual bytecode but in my opinion thats a bit 
overkill



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

Reply via email to