-
Notifications
You must be signed in to change notification settings - Fork 47
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
Conversation
src/main/java/com/clickhouse/kafka/connect/sink/db/ClickHouseWriter.java
Outdated
Show resolved
Hide resolved
…not need to add the default marker
src/test/java/com/clickhouse/kafka/connect/sink/ClickHouseSinkTaskWithSchemaTest.java
Show resolved
Hide resolved
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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
.
- 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? - 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); |
There was a problem hiding this comment.
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.
There was a problem hiding this 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 !
Summary
Tuple testing & Nullable fields in Tuple support
Checklist
Delete items not relevant to your PR: