Zouxxyy commented on code in PR #7104:
URL: https://github.com/apache/paimon/pull/7104#discussion_r2716763983


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/rowops/PaimonCopyOnWriteScan.scala:
##########
@@ -88,4 +88,24 @@ case class PaimonCopyOnWriteScan(
     snapshotReader.withDataFileNameFilter(fileName => 
filteredFileNames.contains(fileName))
     dataSplits = snapshotReader.read().splits().asScala.collect { case s: 
DataSplit => s }.toArray
   }
+
+  override lazy val readBuilder: ReadBuilder = {
+    val _readBuilder = table.newReadBuilder().withReadType(readTableRowType)
+    if (pushedPartitionFilters.nonEmpty) {
+      
_readBuilder.withPartitionFilter(PartitionPredicate.and(pushedPartitionFilters.asJava))
+    }
+
+    if (pushedDataFilters.nonEmpty) {
+      if (pushedDataFilters.size > 1) {
+        _readBuilder.withFilter(
+          new CompoundPredicate(And.INSTANCE, 
pushedDataFilters.asJava).negate().get())

Review Comment:
   Or.INSTANCE ?



##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/rowops/PaimonCopyOnWriteScan.scala:
##########
@@ -88,4 +88,24 @@ case class PaimonCopyOnWriteScan(
     snapshotReader.withDataFileNameFilter(fileName => 
filteredFileNames.contains(fileName))
     dataSplits = snapshotReader.read().splits().asScala.collect { case s: 
DataSplit => s }.toArray
   }
+
+  override lazy val readBuilder: ReadBuilder = {
+    val _readBuilder = table.newReadBuilder().withReadType(readTableRowType)
+    if (pushedPartitionFilters.nonEmpty) {
+      
_readBuilder.withPartitionFilter(PartitionPredicate.and(pushedPartitionFilters.asJava))
+    }
+
+    if (pushedDataFilters.nonEmpty) {
+      if (pushedDataFilters.size > 1) {
+        _readBuilder.withFilter(
+          new CompoundPredicate(And.INSTANCE, 
pushedDataFilters.asJava).negate().get())

Review Comment:
   Add null value or null partition case



##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/rowops/PaimonCopyOnWriteScan.scala:
##########
@@ -88,4 +88,24 @@ case class PaimonCopyOnWriteScan(
     snapshotReader.withDataFileNameFilter(fileName => 
filteredFileNames.contains(fileName))
     dataSplits = snapshotReader.read().splits().asScala.collect { case s: 
DataSplit => s }.toArray
   }
+
+  override lazy val readBuilder: ReadBuilder = {
+    val _readBuilder = table.newReadBuilder().withReadType(readTableRowType)
+    if (pushedPartitionFilters.nonEmpty) {
+      
_readBuilder.withPartitionFilter(PartitionPredicate.and(pushedPartitionFilters.asJava))

Review Comment:
   Add partition filter test, and why is a revert not needed here



##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/rowops/PaimonCopyOnWriteScan.scala:
##########
@@ -88,4 +88,24 @@ case class PaimonCopyOnWriteScan(
     snapshotReader.withDataFileNameFilter(fileName => 
filteredFileNames.contains(fileName))
     dataSplits = snapshotReader.read().splits().asScala.collect { case s: 
DataSplit => s }.toArray
   }
+
+  override lazy val readBuilder: ReadBuilder = {
+    val _readBuilder = table.newReadBuilder().withReadType(readTableRowType)
+    if (pushedPartitionFilters.nonEmpty) {
+      
_readBuilder.withPartitionFilter(PartitionPredicate.and(pushedPartitionFilters.asJava))
+    }
+
+    if (pushedDataFilters.nonEmpty) {
+      if (pushedDataFilters.size > 1) {
+        _readBuilder.withFilter(
+          new CompoundPredicate(And.INSTANCE, 
pushedDataFilters.asJava).negate().get())
+      } else {
+        _readBuilder.withFilter(pushedDataFilters.head.negate().get())
+      }
+    }
+
+    pushedLimit.foreach(_readBuilder.withLimit)

Review Comment:
   Dose pushedLimit or pushedTopN realy need, if not ,assert them empty



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