Skip to content

Conversation

@kailash360
Copy link

@kailash360 kailash360 commented Feb 9, 2026

Summary

This PR standardizes boolean parsing across modules so configuration values accept both true/false and 1/0 (with null/unrecognized values treated as false). This improves compatibility with tools and environments that only emit numeric booleans.

Closes

Checklist

Delete items not relevant to your PR:


Note

Medium Risk
Behavior changes for boolean parsing in config and value conversion paths could alter outcomes for previously non-standard string values, though the change is small and well-covered by new tests.

Overview
Standardizes boolean parsing across clickhouse-data, client-v2, and jdbc-v2 by introducing ClickHouseUtils.parseBoolean(String) (supports true/false and 1/0, defaults to false for null/unknown) and routing existing boolean parsing through it.

Updates client config parsing (ClientConfigProperties.parseValue), string-to-boolean conversions in serialization/value conversion helpers (SerializerUtils, ValueConverters), and JDBC driver flags (JdbcConfiguration) to use the new parser, and adds targeted unit tests covering numeric and textual boolean inputs.

Written by Cursor Bugbot for commit 3128606. This will update automatically on new commits. Configure here.

@CLAassistant
Copy link

CLAassistant commented Feb 9, 2026

CLA assistant check
All committers have signed the CLA.

Assert.assertTrue(ClickHouseUtils.parseBoolean("true"));
Assert.assertFalse(ClickHouseUtils.parseBoolean("false"));

// unrecognized values should be parsed as false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chernser shouldn't we throw an exception for unrecognized values?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is an unrecognized value, then we should also follow the behavior pattern of other configs in this case.

For example, the default_query_settings config accepts a set of settings, else null by default. Now, if someone sets a random setting that is not used by Clickhouse then does it throw an error, or simply ignores that?

Similarly, jdbc_sql_parser accepts 1 of 3 enum constants. Does it throw an error if any other value is passed?

If we throw an exception only for boolean types and simply ignore for other types, then it will create inconsistent behaviour. Please let me know your thoughts on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[jdbc-v2, client-v2] Accept 1 and 0 for boolean properties

3 participants