arina-ielchiieva commented on a change in pull request #1810: DRILL-7271:
Refactor Metadata interfaces and classes to contain all needed information for
the File based Metastore
URL: https://github.com/apache/drill/pull/1810#discussion_r296688086
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/BaseParquetMetadataProvider.java
##########
@@ -313,18 +328,30 @@ public TableMetadata getTableMetadata() {
partitionsForValue.asMap().forEach((partitionKey, value) -> {
Map<SchemaPath, ColumnStatistics> columnsStatistics = new
HashMap<>();
- Map<StatisticsKind, Object> statistics = new HashMap<>();
+ List<StatisticsHolder> statistics = new ArrayList<>();
partitionKey = partitionKey == NULL_VALUE ? null : partitionKey;
- statistics.put(ColumnStatisticsKind.MIN_VALUE, partitionKey);
- statistics.put(ColumnStatisticsKind.MAX_VALUE, partitionKey);
+ statistics.add(new StatisticsHolder<>(partitionKey,
ColumnStatisticsKind.MIN_VALUE));
+ statistics.add(new StatisticsHolder<>(partitionKey,
ColumnStatisticsKind.MAX_VALUE));
- statistics.put(ColumnStatisticsKind.NULLS_COUNT,
Statistic.NO_COLUMN_STATS);
- statistics.put(TableStatisticsKind.ROW_COUNT,
Statistic.NO_COLUMN_STATS);
+ statistics.add(new StatisticsHolder<>(Statistic.NO_COLUMN_STATS,
ColumnStatisticsKind.NULLS_COUNT));
+ statistics.add(new StatisticsHolder<>(Statistic.NO_COLUMN_STATS,
TableStatisticsKind.ROW_COUNT));
columnsStatistics.put(partitionColumn,
- new ColumnStatisticsImpl<>(statistics,
-
ParquetTableMetadataUtils.getComparator(getParquetGroupScanStatistics().getTypeForColumn(partitionColumn).getMinorType())));
- partitions.add(new PartitionMetadata(partitionColumn,
getTableMetadata().getSchema(),
- columnsStatistics, statistics, (Set<Path>) value, tableName,
-1));
+ new ColumnStatistics<>(statistics,
+
getParquetGroupScanStatistics().getTypeForColumn(partitionColumn).getMinorType()));
+ MetadataInfo metadataInfo = new
MetadataInfo(MetadataType.PARTITION, MetadataInfo.GENERAL_INFO_KEY, null);
+ TableMetadata tableMetadata = getTableMetadata();
+ PartitionMetadata partitionMetadata = PartitionMetadata.builder()
+ .withTableInfo(tableMetadata.getTableInfo())
+ .withMetadataInfo(metadataInfo)
+ .withColumn(partitionColumn)
+ .withSchema(tableMetadata.getSchema())
+ .withColumnsStatistics(columnsStatistics)
+ .withStatistics(statistics)
+ .withPartitionValues(Collections.emptyList())
+ .withLocations((Set<Path>) value)
Review comment:
Why cast is needed here?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services