Guosmilesmile commented on code in PR #15906:
URL: https://github.com/apache/iceberg/pull/15906#discussion_r3111366252
##########
data/src/test/java/org/apache/iceberg/data/BaseFormatModelTests.java:
##########
@@ -702,21 +699,79 @@ void testDataWriterMetricsWithCountsMode(FileFormat
fileFormat) throws IOExcepti
schema,
PartitionSpec.unpartitioned(),
3,
- ImmutableMap.of(TableProperties.DEFAULT_WRITE_METRICS_MODE,
"counts"));
+ ImmutableMap.of(
+ TableProperties.DEFAULT_WRITE_METRICS_MODE,
MetricsModes.Counts.get().toString()));
MetricsConfig countsConfig = MetricsConfig.forTable(table);
List<Record> genericRecords = dataGenerator.generateRecords();
DataFile dataFile = writeGenericRecords(fileFormat, schema,
genericRecords, countsConfig);
- assertThat(dataFile).isNotNull();
- assertThat(dataFile.recordCount()).isEqualTo(genericRecords.size());
-
// In the counts mode, valueCounts and nullValueCounts should be present,
while lowerBounds and
// upperBounds should be null.
- assertValueAndNullCounts(
- fileFormat, schema, genericRecords, dataFile.valueCounts(),
dataFile.nullValueCounts());
- assertBoundsNull(fileFormat, schema, dataFile.lowerBounds(),
dataFile.upperBounds());
+ assertCounts(fileFormat, schema, genericRecords, dataFile);
+ assertBoundsNull(schema, dataFile);
+ assertColumnSize(fileFormat, dataFile);
+ }
+
+ @ParameterizedTest
+ @FieldSource("FILE_FORMATS")
+ void testDataWriterMetricsWithTruncateMode(FileFormat fileFormat) throws
IOException {
+ int truncateLength = 5;
+ Schema schema =
+ new Schema(
+ Types.NestedField.required(1, "col_str", Types.StringType.get()),
Review Comment:
Yes, I add a new ut to cover it. But it only support in Parquet.
As orc only support truncate string.
https://github.com/apache/iceberg/blob/f984c28b215c56846c632ccc5a368f4f4afe0b5d/orc/src/main/java/org/apache/iceberg/orc/OrcMetrics.java#L340-L348
--
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]