Skip to content

Commit ad7c4ec

Browse files
committed
Restore deprecated static signatures for toParquetStatistics and fromParquetStatistics
Address PR feedback (gszadovszky, wgtmac on apache#3243): keep the previously-public static methods as @deprecated shims that delegate to a default ParquetMetadataConverter instance, so 1.x callers still compile. The new createdBy-aware non-static methods remain the recommended path.
1 parent 6981ffb commit ad7c4ec

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

parquet-hadoop/src/main/java/org/apache/parquet/format/converter/ParquetMetadataConverter.java

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,28 @@ public List<PageEncodingStats> convertEncodingStats(EncodingStats stats) {
803803
return formatStats;
804804
}
805805

806+
/**
807+
* @param stats the statistics
808+
* @return the parquet format statistics
809+
* @deprecated will be removed in 2.0.0; use {@link #toParquetStatistics(String, org.apache.parquet.column.statistics.Statistics)} instead.
810+
*/
811+
@Deprecated
812+
public static Statistics toParquetStatistics(org.apache.parquet.column.statistics.Statistics stats) {
813+
return toParquetStatistics(stats, ParquetProperties.DEFAULT_STATISTICS_TRUNCATE_LENGTH);
814+
}
815+
816+
/**
817+
* @param stats the statistics
818+
* @param truncateLength max truncation length for binary statistics
819+
* @return the parquet format statistics
820+
* @deprecated will be removed in 2.0.0; use {@link #toParquetStatistics(String, org.apache.parquet.column.statistics.Statistics, int)} instead.
821+
*/
822+
@Deprecated
823+
public static Statistics toParquetStatistics(
824+
org.apache.parquet.column.statistics.Statistics stats, int truncateLength) {
825+
return new ParquetMetadataConverter().toParquetStatistics(null, stats, truncateLength);
826+
}
827+
806828
public Statistics toParquetStatistics(String createdBy, org.apache.parquet.column.statistics.Statistics stats) {
807829
return toParquetStatistics(createdBy, stats, ParquetProperties.DEFAULT_STATISTICS_TRUNCATE_LENGTH);
808830
}
@@ -918,7 +940,7 @@ private boolean isMinMaxStatsReadingSupported(String createdBy, PrimitiveType ty
918940
* @deprecated will be removed in 2.0.0.
919941
*/
920942
@Deprecated
921-
public org.apache.parquet.column.statistics.Statistics fromParquetStatistics(
943+
public static org.apache.parquet.column.statistics.Statistics fromParquetStatistics(
922944
Statistics statistics, PrimitiveTypeName type) {
923945
return fromParquetStatistics(null, statistics, type);
924946
}
@@ -931,13 +953,14 @@ public org.apache.parquet.column.statistics.Statistics fromParquetStatistics(
931953
* @deprecated will be removed in 2.0.0.
932954
*/
933955
@Deprecated
934-
public org.apache.parquet.column.statistics.Statistics fromParquetStatistics(
956+
public static org.apache.parquet.column.statistics.Statistics fromParquetStatistics(
935957
String createdBy, Statistics statistics, PrimitiveTypeName type) {
936-
return fromParquetStatisticsInternal(
937-
createdBy,
938-
statistics,
939-
new PrimitiveType(Repetition.OPTIONAL, type, "fake_type"),
940-
defaultSortOrder(type));
958+
return new ParquetMetadataConverter()
959+
.fromParquetStatisticsInternal(
960+
createdBy,
961+
statistics,
962+
new PrimitiveType(Repetition.OPTIONAL, type, "fake_type"),
963+
defaultSortOrder(type));
941964
}
942965

943966
// Visible for testing

0 commit comments

Comments
 (0)