-
Notifications
You must be signed in to change notification settings - Fork 99
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
SNOW-1737840: Adapt record mapping in RecordService #969
SNOW-1737840: Adapt record mapping in RecordService #969
Conversation
if (includeAllMetadata) { | ||
streamingIngestRow.put(TABLE_COLUMN_METADATA, mapper.writeValueAsString(row.getMetadata())); | ||
} |
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.
not sure if there was some trick here but i moved it from the forEach loop above to here. I don't see any sense in parsing and putting it all over again for every jsonNode. This should improve overall processing speed as we do not serialise it for every json node we have
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.
I think I even saw some tech debt ticket regarding multiple serialization. It's great that you've optimized it.
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
class IcebergTableStreamingRecordMapperTest { |
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.
please think of more test cases if possible with example :)
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.
Looks exhaustive to me, let's wait for the bugs to happen :)
|
||
@Override | ||
public Map<String, Object> processSnowflakeRecord( | ||
SnowflakeTableRow row, boolean schematizationEnabled, boolean includeAllMetadata) |
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.
nit: maybe just boolean includeMetadata
?
String key = fields.next(); | ||
JsonNode valueNode = headersNode.get(key); | ||
String value; | ||
if (valueNode.isTextual()) { |
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.
nit: extract String getTextualValue(JsonNode node)
and reuse in SnowflakeTableStreamingRecordMapper
?
this.clock = clock; | ||
this.enableSchematization = enableSchematization; |
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.
I wonder if RecordService
needs to be aware of enableSchematization
value after creating StreamingRecordMapper
abstraction. In fact we could pass this flag to a mapper in a factory instead of processSnowflakeRecord
argument.
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.
good idea
@@ -67,8 +123,7 @@ public static List<RecordWithMetadata<PrimitiveJsonRecord>> fromSchematizedResul | |||
resultSet.getLong("ID_INT8"), | |||
resultSet.getLong("ID_INT16"), | |||
resultSet.getLong("ID_INT32"), | |||
// FIXME: there is currently some bug in Iceberg when storing int64 values | |||
// resultSet.getLong("ID_INT64"), | |||
resultSet.getLong("ID_INT64"), |
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.
Thx, please close https://snowflakecomputing.atlassian.net/browse/SNOW-1754474 if it works.
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.
Left some minor comments but great change overall!
Overview
SNOW-1737840
Pre-review checklist
snowflake.ingestion.method
.Yes
- Added end to end and Unit Tests.No
- Suggest why it is not param protected