LuciferYang commented on code in PR #13149:
URL: https://github.com/apache/gluten/pull/13149#discussion_r4111207209
##########
gluten-core/src/main/scala/org/apache/gluten/extension/GlutenSessionExtensions.scala:
##########
@@ -43,8 +43,15 @@ private[gluten] class GlutenSessionExtensions
injector.control.disableOn {
session =>
val glutenEnabledForThread =
-
Option(session.sparkContext.getLocalProperty(GLUTEN_ENABLE_FOR_THREAD_KEY))
- .forall(_.toBoolean)
+
Option(session.sparkContext.getLocalProperty(GLUTEN_ENABLE_FOR_THREAD_KEY)).forall
{
+ value =>
+ 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 62ad0d037. Extracted the parse into a package-visible
`GlutenSessionExtensions.isEnabledForThread` and added
`GlutenSessionExtensionsSuite`: it asserts boolean values parse, and that a
non-boolean value like `yes` raises an `IllegalArgumentException` whose message
names both `gluten.enabledForCurrentThread` and the offending value. Testing
the extracted parser directly locks the contract without standing up a full
session-extension harness.
--
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]