Skip to content

Conversation

@Paultagoras
Copy link
Contributor

Summary

  • Added Bool to binaryReaderMethodForType

Closes #2248

Checklist

Delete items not relevant to your PR:

  • Closes #
  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG

@Paultagoras Paultagoras self-assigned this May 16, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for serializing Boolean values by incorporating Bool type handling into the binary reader and updating the associated test and schema creation files.

  • Added a new Boolean field with its getter/setter in SimplePOJO.
  • Updated SQL queries and table creation SQL to include and utilize the new Bool type.
  • Extended the binaryReaderMethodForType logic in SerializerUtils to support Bool serialization.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
client-v2/src/test/java/com/clickhouse/client/query/SimplePOJO.java Added a Boolean field "bool" with corresponding getter and setter methods, and updated toString() to include it.
client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java Modified the test query to select a Boolean constant and assert its value.
client-v2/src/test/java/com/clickhouse/client/query/QuerySamplePOJO.java Updated the table creation SQL to use the Bool type instead of UInt8 for "bool" column.
client-v2/src/test/java/com/clickhouse/client/api/data_formats/internal/SerializerUtils.java Added a new switch case to handle Bool type serialization by mapping it to readByte.
Comments suppressed due to low confidence (1)

client-v2/src/test/java/com/clickhouse/client/api/data_formats/internal/SerializerUtils.java:960

  • [nitpick] The new Bool case in binaryReaderMethodForType maps Bool to readByte and returns a byte descriptor, which may require implicit conversion to a Boolean. Consider using a dedicated boolean reader method if available or adding explicit conversion logic to improve clarity.
case Bool:

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Paultagoras Paultagoras merged commit 2be5d78 into main May 16, 2025
24 of 25 checks passed
@Paultagoras Paultagoras deleted the add-bool-serialization branch May 16, 2025 16:25
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.

Column type 'Bool' cannot be set to a primitive type 'boolean'

3 participants