mihaibudiu commented on code in PR #5048:
URL: https://github.com/apache/calcite/pull/5048#discussion_r3486913962


##########
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:
   Could this situation be improved? Is this a fundamental limitation of 
CsvEnumerator?
   Maybe we need a more powerful enumerator.
   In principle I think any predicate of the current row value should work.
   



##########
file/src/main/java/org/apache/calcite/adapter/file/CsvEnumerator.java:
##########
@@ -254,6 +262,19 @@ static CSVReader openCsv(Source source, char separator) 
throws IOException {
     return new CSVReader(source.reader(), separator);
   }
 
+  private static boolean objectsEqual(@Nullable Object o1, @Nullable Object 
o2) {
+    if (o1 == o2) {
+      return true;
+    }
+    if (o1 == null || o2 == null) {
+      return false;
+    }
+    if (o1 instanceof BigDecimal && o2 instanceof BigDecimal) {

Review Comment:
   Why is this case needed? Doesn't BigDecimal have equals?
   If it does, can this become Objects.equals()?



##########
file/src/test/java/org/apache/calcite/adapter/file/FileAdapterTest.java:
##########
@@ -417,6 +417,63 @@ private static void checkEmpty(ResultSet resultSet) {
     sql("model-with-custom-table", sql).ok();
   }
 
+  /** Test case for

Review Comment:
   It would be nice to higher a higher coverage in terms of SQL types for 
columns.



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