LuciferYang commented on code in PR #13149:
URL: https://github.com/apache/gluten/pull/13149#discussion_r4140912388


##########
gluten-core/src/main/scala/org/apache/gluten/extension/GlutenSessionExtensions.scala:
##########
@@ -58,4 +58,15 @@ private[gluten] class GlutenSessionExtensions
 object GlutenSessionExtensions {
   val GLUTEN_SESSION_EXTENSION_NAME: String = 
classOf[GlutenSessionExtensions].getCanonicalName
   val GLUTEN_ENABLE_FOR_THREAD_KEY: String = "gluten.enabledForCurrentThread"
+
+  // Visible for testing. Parse the per-thread enable flag, naming the 
property and the
+  // offending value when it is not a boolean instead of surfacing a bare 
`toBoolean` failure.
+  private[gluten] def isEnabledForThread(value: String): Boolean = {
+    try value.toBoolean
+    catch {
+      case _: IllegalArgumentException =>
+        throw new IllegalArgumentException(
+          s"$GLUTEN_ENABLE_FOR_THREAD_KEY should be boolean, but was $value")

Review Comment:
   Done in `0510ae4f1`. Inlined the parse back into the `disableOn` predicate 
(keeping the key+value error message and the absent-defaults-to-enabled 
behavior via `forall`) and removed the dedicated 
`GlutenSessionExtensionsSuite`. I did not add an end-to-end case yet: driving 
the `disableOn` wiring needs a full session with the extension injected, which 
lives in the backend suites rather than gluten-core. Glad to add one there if 
you would like it covered end-to-end.



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