amogh-jahagirdar commented on code in PR #17035:
URL: https://github.com/apache/iceberg/pull/17035#discussion_r3509846072
##########
core/src/test/java/org/apache/iceberg/TestTrackedFileStruct.java:
##########
@@ -36,93 +36,72 @@ class TestTrackedFileStruct {
Types.NestedField.optional(1000, "id_bucket",
Types.IntegerType.get()),
Types.NestedField.optional(1001, "category",
Types.StringType.get()));
- // Ordinals looked up from the TrackedFile schema so tests don't hard-code
positions.
- private static final List<Types.NestedField> SCHEMA_FIELDS =
- TrackedFile.schemaWithContentStats(Types.StructType.of(),
Types.StructType.of()).fields();
- private static final int TRACKING_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.TRACKING);
- private static final int CONTENT_TYPE_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.CONTENT_TYPE);
- private static final int FORMAT_VERSION_ORDINAL =
- SCHEMA_FIELDS.indexOf(TrackedFile.FORMAT_VERSION);
- private static final int LOCATION_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.LOCATION);
- private static final int FILE_FORMAT_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.FILE_FORMAT);
- private static final int RECORD_COUNT_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.RECORD_COUNT);
- private static final int FILE_SIZE_IN_BYTES_ORDINAL =
- SCHEMA_FIELDS.indexOf(TrackedFile.FILE_SIZE_IN_BYTES);
- private static final int SPEC_ID_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.SPEC_ID);
- private static final int PARTITION_ORDINAL =
ordinalOf(TrackedFile.PARTITION_ID);
- private static final int SORT_ORDER_ID_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.SORT_ORDER_ID);
- private static final int DELETION_VECTOR_ORDINAL =
- SCHEMA_FIELDS.indexOf(TrackedFile.DELETION_VECTOR);
- private static final int MANIFEST_INFO_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.MANIFEST_INFO);
- private static final int KEY_METADATA_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.KEY_METADATA);
- private static final int SPLIT_OFFSETS_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.SPLIT_OFFSETS);
- private static final int EQUALITY_IDS_ORDINAL =
SCHEMA_FIELDS.indexOf(TrackedFile.EQUALITY_IDS);
-
- // Ordinal of MetadataColumns.ROW_POSITION within TrackingStruct's BASE_TYPE,
- // which appends ROW_POSITION after the Tracking schema fields.
- private static final int MANIFEST_POS_ORDINAL =
Tracking.schema().fields().size();
-
- private static int ordinalOf(int fieldId) {
- for (int i = 0; i < SCHEMA_FIELDS.size(); i++) {
- if (SCHEMA_FIELDS.get(i).fieldId() == fieldId) {
- return i;
- }
- }
- throw new IllegalArgumentException("Field not found in TrackedFile schema:
" + fieldId);
- }
+ private static final DeletionVectorStruct DELETION_VECTOR =
Review Comment:
commented below: This is still using the builder for some of the nested
fields within TrackedFile but I think that's fine, we're largely concerned
about the explicitness of TrackedFile tests in this change? So I think it's OK
to reuse the builder abstractions for those nested structures.
--
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]