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


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/PaimonScanBuilder.scala:
##########
@@ -90,6 +97,57 @@ class PaimonScanBuilder(table: InnerTable)
     false
   }
 
+  override def pushTopN(orders: Array[SortOrder], limit: Int): Boolean = {
+    if (hasPostScanPredicates) {
+      return false
+    }
+
+    if (!table.isInstanceOf[FileStoreTable]) {
+      return false
+    }
+
+    val coreOptions = CoreOptions.fromMap(table.options())
+    if (coreOptions.deletionVectorsEnabled()) {
+      return false
+    }
+
+    if (orders.length != 1) {
+      return false
+    }
+
+    val order = orders(0)
+    if (!order.expression().isInstanceOf[NamedReference]) {
+      return false
+    }
+
+    val fieldName = 
order.expression().asInstanceOf[NamedReference].fieldNames().mkString(".")
+    val rowType = table.rowType()
+    if (rowType.notContainsField(fieldName)) {
+      return false
+    }
+
+    val field = rowType.getField(fieldName)
+    val ref = new FieldRef(field.id(), field.name(), field.`type`())
+
+    val nullOrdering = order.nullOrdering() match {
+      case expressions.NullOrdering.NULLS_LAST => NullOrdering.NULLS_LAST
+      case _ => NullOrdering.NULLS_FIRST

Review Comment:
   match all types otherwise return false



-- 
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: issues-unsubscr...@paimon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to