Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuple testing & Nullable fields in Tuple support #492

Merged
merged 7 commits into from
Jan 17, 2025
Merged

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.

@@ -622,7 +622,7 @@ protected void doWritePrimitive(Type columnType, Schema.Type dataType, OutputStr
}


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.

@@ -479,7 +479,7 @@ protected void doWriteColValue(Column col, OutputStream stream, Data value, bool
Data innerData = (Data) jsonMapValues.get(fieldName);
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