All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.snowflake.ingest.streaming.internal.Flusher Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
/*
 * Copyright (c) 2022 Snowflake Computing Inc. All rights reserved.
 */

package net.snowflake.ingest.streaming.internal;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import net.snowflake.ingest.utils.Pair;

/**
 * Interface to convert {@link ChannelData} buffered in {@link RowBuffer} to the underlying format
 * implementation for faster processing.
 *
 * @param  type of column data ({@link ParquetChunkData})
 */
public interface Flusher {
  /**
   * Serialize buffered rows into the underlying format.
   *
   * @param channelsDataPerTable buffered rows
   * @param filePath file path
   * @return {@link SerializationResult}
   * @throws IOException
   */
  SerializationResult serialize(List> channelsDataPerTable, String filePath)
      throws IOException;

  /** Holds result of the buffered rows conversion: channel metadata and stats. */
  class SerializationResult {
    final List channelsMetadataList;
    final Map columnEpStatsMapCombined;
    final long rowCount;
    final float chunkEstimatedUncompressedSize;
    final ByteArrayOutputStream chunkData;
    final Pair chunkMinMaxInsertTimeInMs;

    public SerializationResult(
        List channelsMetadataList,
        Map columnEpStatsMapCombined,
        long rowCount,
        float chunkEstimatedUncompressedSize,
        ByteArrayOutputStream chunkData,
        Pair chunkMinMaxInsertTimeInMs) {
      this.channelsMetadataList = channelsMetadataList;
      this.columnEpStatsMapCombined = columnEpStatsMapCombined;
      this.rowCount = rowCount;
      this.chunkEstimatedUncompressedSize = chunkEstimatedUncompressedSize;
      this.chunkData = chunkData;
      this.chunkMinMaxInsertTimeInMs = chunkMinMaxInsertTimeInMs;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy