FrankChen021 commented on code in PR #20628:
URL: https://github.com/apache/druid/pull/20628#discussion_r4314851296


##########
processing/src/main/java/org/apache/druid/query/context/QueryContextParameters.java:
##########
@@ -2508,11 +2508,28 @@ static QueryContextParameter.Builder<Boolean> 
booleanParameter(final String name
         name,
         Boolean.class,
         value -> {
-          if (value instanceof String) {
-            // Matches the established QueryContexts coercion: any string 
other than "true" (ignoring case) is false.
-            return Boolean.parseBoolean((String) value);
+          if (value instanceof String string) {
+            if ("true".equalsIgnoreCase(string) || "1".equals(string)) {
+              return true;
+            } else if ("false".equalsIgnoreCase(string) || "0".equals(string)) 
{
+              return false;
+            }
+          } else if (value instanceof Integer || value instanceof Long || 
value instanceof Short || value instanceof Byte) {

Review Comment:
   Fixed in 8c9936f4b5. `BigInteger` `0`/`1` is now accepted. This happens when 
a context is built in Java, or read from JSON by a mapper with 
`USE_BIG_INTEGER_FOR_INTS`. The new test covers both cases.



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