minni31 commented on code in PR #13223:
URL: https://github.com/apache/gluten/pull/13223#discussion_r4268288518


##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxValidatorApi.scala:
##########
@@ -104,6 +110,150 @@ class VeloxValidatorApi extends ValidatorApi {
 }
 
 object VeloxValidatorApi {
+  private val nativeFormatFlags = Set('-', '+', ' ', '0')
+  private val maxNativeFormatWidth = 1 << 20
+
+  private def supportsFormatString(formatString: FormatString): Boolean = {
+    val format = formatString.children.headOption match {
+      case Some(Literal(value: UTF8String, dataType))
+          if dataType.isInstanceOf[StringType] =>
+        value.toString
+      case _ =>
+        return false
+    }
+    val conversions = parseNativeFormatString(format).getOrElse {
+      return false
+    }
+    conversions.length <= formatString.children.length - 1 &&
+    conversions
+      .zip(formatString.children.tail)
+      .forall {
+        case (conversion, argument) =>
+          supportsNativeFormatType(conversion, argument.dataType)
+      }
+  }
+
+  private def parseNativeFormatString(format: String): Option[Seq[Char]] = {
+    val conversions = ArrayBuffer.empty[Char]

Review Comment:
   `ArrayBuffer` is already imported near the top of this file via `import 
scala.collection.mutable.ArrayBuffer`, so no source change is needed here.



##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxValidatorApi.scala:
##########
@@ -104,6 +110,150 @@ class VeloxValidatorApi extends ValidatorApi {
 }
 
 object VeloxValidatorApi {
+  private val nativeFormatFlags = Set('-', '+', ' ', '0')

Review Comment:
   Fixed in `a5fc4956a`: added a comment explaining that the limit matches 
Velox's per-specifier output cap and prevents excessive allocations.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to