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


##########
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 referenced unqualified here; unless there is an existing 
import elsewhere in the file, this will not compile. Add `import 
scala.collection.mutable.ArrayBuffer` (or fully qualify it at the usage site).



##########
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:
   `maxNativeFormatWidth = 1 << 20` is a non-obvious magic number. Add a brief 
comment explaining why this limit exists (e.g., matches Velox native cap / 1 
MiB width) to make future updates safer and to keep the validator aligned with 
the backend implementation.



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