fresh-borzoni commented on code in PR #3346:
URL: https://github.com/apache/fluss/pull/3346#discussion_r3303810432
##########
fluss-spark/fluss-spark-common/src/main/scala/org/apache/fluss/spark/read/FlussPartitionReader.scala:
##########
@@ -57,6 +60,9 @@ abstract class FlussPartitionReader(tablePath: TablePath,
flussConfig: Configura
def next0(): Boolean
override def next(): Boolean = {
+ if (limit.isDefined && numRowsRead >= limit.get) {
Review Comment:
nit: limit.exists(numRowsRead >= _) ?
##########
fluss-spark/fluss-spark-ut/src/test/scala/org/apache/fluss/spark/SparkLogTableReadTest.scala:
##########
@@ -603,4 +603,23 @@ class SparkLogTableReadTest extends FlussSparkTestBase {
assert(numRowsRead == 5L, s"Expected 5 rows read, got $numRowsRead")
}
}
+
+ test("Spark Read: limit pushdown") {
Review Comment:
Could you add one execution test using FlussMetrics.NUM_ROWS_READ, same
pattern as the "scan metrics" test above to assert the reader actually stopped
early? Current test doesn't prove that pushdown worked, it just applies top cap.
smth like this
```
df.collect()
assert(batchScanExec.metrics(FlussMetrics.NUM_ROWS_READ).value <= 2)
```
--
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]