wmoustafa commented on code in PR #6004:
URL: https://github.com/apache/iceberg/pull/6004#discussion_r1194595021
##########
core/src/main/java/org/apache/iceberg/SingleValueParser.java:
##########
@@ -309,17 +309,28 @@ public static void toJson(Type type, Object defaultValue,
JsonGenerator generato
generator.writeString(defaultValue.toString());
break;
case FIXED:
+ // Normally, FIXED is backed by a byte[], but it can also be backed by
a ByteBuffer in the
+ // case of Fixed Literals. Ideally, Fixed Literals would be backed by
a byte[], but that
+ // would make the APIs backwards incompatible.
+ // See {@link org.apache.iceberg.expressions.Literals.FixedLiteral}.
Preconditions.checkArgument(
- defaultValue instanceof ByteBuffer, "Invalid default %s value:
%s", type, defaultValue);
- ByteBuffer byteBufferValue = (ByteBuffer) defaultValue;
Review Comment:
No longer applicable after fixing the issue as per the above discussion.
##########
core/src/main/java/org/apache/iceberg/avro/ValueReaders.java:
##########
@@ -653,22 +669,27 @@ public ValueReader<?> reader(int pos) {
public S read(Decoder decoder, Object reuse) throws IOException {
S struct = reuseOrCreate(reuse);
+ // Set the default values first. Setting default values first allows
them to be overridden
+ // once the data is read from the file if the corresponding field is
present in the file.
+ for (int i = 0; i < defaultValuesPositions.length; i += 1) {
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]