Skip to content

Conversation

@mzitnik
Copy link
Collaborator

@mzitnik mzitnik commented Jan 15, 2025

Summary

Tuple testing & Nullable fields in Tuple support

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@mzitnik mzitnik requested a review from Paultagoras January 15, 2025 07:43
Copy link

@bcwalrus bcwalrus left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @mzitnik! Got a suggestion to simplify the logic.



protected void doWriteCol(Data value, boolean fieldExists, Column col, OutputStream stream, boolean defaultsSupport) throws IOException {
protected void doWriteCol(Data value, boolean fieldExists, Column col, OutputStream stream, boolean defaultsSupport, boolean firstTime) throws IOException {

Choose a reason for hiding this comment

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

We probably don't need firstTime.

  1. All we care about is whether the default prefix byte applies to this col. And that's already captured by defaultsSupport. So maybe we should reuse that?
  2. Btw, the name could be more descriptive, like isRootCol.

Maybe also add a comment, something like:

RowBinaryWithDefaults writes an extra byte 01 to indicate default, and 00
to indicate actual value. But that only applies to top level columns.

try {
// we need to apply here the default and nullable logic
doWriteCol(innerData, jsonMapValues.containsKey(fieldName), column, stream, defaultsSupport);
doWriteCol(innerData, jsonMapValues.containsKey(fieldName), column, stream, defaultsSupport, false);

Choose a reason for hiding this comment

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

We can just pass in false for defaultsSupport. No need for extra arg. See below.

Copy link

@bcwalrus bcwalrus left a comment

Choose a reason for hiding this comment

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

Verified the fix on my local ingest environment. Thank @mzitnik !

@mzitnik mzitnik merged commit aa63c72 into main Jan 17, 2025
7 of 8 checks passed
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.

4 participants