Class MetricsUtil


  • public class MetricsUtil
    extends java.lang.Object
    • Method Detail

      • copyWithoutFieldCounts

        public static Metrics copyWithoutFieldCounts​(Metrics metrics,
                                                     java.util.Set<java.lang.Integer> excludedFieldIds)
        Copies a metrics object without value, NULL and NaN counts for given fields.
        Parameters:
        excludedFieldIds - field IDs for which the counts must be dropped
        Returns:
        a new metrics object without counts for given fields
      • copyWithoutFieldCountsAndBounds

        public static Metrics copyWithoutFieldCountsAndBounds​(Metrics metrics,
                                                              java.util.Set<java.lang.Integer> excludedFieldIds)
        Copies a metrics object without counts and bounds for given fields.
        Parameters:
        excludedFieldIds - field IDs for which the counts and bounds must be dropped
        Returns:
        a new metrics object without lower and upper bounds for given fields
      • 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.
      • 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 struct MetricsUtil.ReadableColMetricsStruct, composed of MetricsUtil.ReadableMetricsStruct for all primitive columns in the data table
        Parameters:
        dataTableSchema - schema of data table
        metadataTableSchema - schema of existing metadata table (to ensure id uniqueness)
        Returns:
        schema of readable_metrics struct