Package org.apache.iceberg
Class MetricsUtil
- java.lang.Object
-
- org.apache.iceberg.MetricsUtil
-
public class MetricsUtil extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMetricsUtil.ReadableColMetricsStructA struct of readable metric values for a primitive columnstatic classMetricsUtil.ReadableMetricColDefinitionFixed definition of a readable metric column, ie a mapping of a raw metric to a readable metricstatic classMetricsUtil.ReadableMetricsStructA struct, consisting of allMetricsUtil.ReadableColMetricsStructfor all primitive columns of the table
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<MetricsUtil.ReadableMetricColDefinition>READABLE_METRIC_COLSstatic java.lang.StringREADABLE_METRICS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.Integer,java.lang.Long>createNanValueCounts(java.util.stream.Stream<FieldMetrics<?>> fieldMetrics, MetricsConfig metricsConfig, Schema inputSchema)Construct mapping relationship between column id to NaN value counts from input metrics and metrics config.static MetricsModes.MetricsModemetricsMode(Schema inputSchema, MetricsConfig metricsConfig, int fieldId)Extract MetricsMode for the given field id from metrics config.static SchemareadableMetricsSchema(Schema dataTableSchema, Schema metadataTableSchema)Calculates a dynamic schema for readable_metrics to add to metadata tables.static MetricsUtil.ReadableMetricsStructreadableMetricsStruct(Schema schema, ContentFile<?> file, Types.StructType projectedSchema)Return a readable metrics struct row from file metadata
-
-
-
Field Detail
-
READABLE_METRIC_COLS
public static final java.util.List<MetricsUtil.ReadableMetricColDefinition> READABLE_METRIC_COLS
-
READABLE_METRICS
public static final java.lang.String READABLE_METRICS
- See Also:
- Constant Field Values
-
-
Method Detail
-
createNanValueCounts
public static java.util.Map<java.lang.Integer,java.lang.Long> createNanValueCounts(java.util.stream.Stream<FieldMetrics<?>> fieldMetrics, MetricsConfig metricsConfig, Schema inputSchema)
Construct mapping relationship between column id to NaN value counts from input metrics and metrics config.
-
metricsMode
public static MetricsModes.MetricsMode metricsMode(Schema inputSchema, MetricsConfig metricsConfig, int fieldId)
Extract MetricsMode for the given field id from metrics config.
-
readableMetricsSchema
public static Schema readableMetricsSchema(Schema dataTableSchema, Schema metadataTableSchema)
Calculates a dynamic schema for readable_metrics to add to metadata tables. The type will be the structMetricsUtil.ReadableColMetricsStruct, composed ofMetricsUtil.ReadableMetricsStructfor all primitive columns in the data table- Parameters:
dataTableSchema- schema of data tablemetadataTableSchema- schema of existing metadata table (to ensure id uniqueness)- Returns:
- schema of readable_metrics struct
-
readableMetricsStruct
public static MetricsUtil.ReadableMetricsStruct readableMetricsStruct(Schema schema, ContentFile<?> file, Types.StructType projectedSchema)
Return a readable metrics struct row from file metadata- Parameters:
schema- schema of original data tablefile- content file with metricsprojectedSchema- user requested projection- Returns:
MetricsUtil.ReadableMetricsStruct
-
-