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

com.clickzetta.platform.bulkload.BulkLoadMetaData Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package com.clickzetta.platform.bulkload;

import com.clickzetta.platform.arrow.ArrowIGSTableMeta;
import com.clickzetta.platform.arrow.ArrowTable;
import com.clickzetta.platform.client.api.BulkLoadOperation;
import com.clickzetta.platform.client.api.BulkLoadState;
import cz.proto.ingestion.v2.IngestionV2;

import java.util.List;
import java.util.Map;
import java.util.Optional;

public class BulkLoadMetaData {

  private static final long MAX_NUM_ROWS_PER_FILE = 64 << 20;
  private static final long MAX_FILE_SIZE_IN_BYTES_PER_FILE = 256 << 20;

  private final long instanceId;
  private final IngestionV2.BulkLoadStreamInfo info;
  private final ArrowTable arrowTable;

  public BulkLoadMetaData(IngestionV2.BulkLoadStreamInfo info) {
    this.instanceId = info.getIdentifier().getInstanceId();
    this.info = info;
    this.arrowTable = new ArrowTable(new ArrowIGSTableMeta(instanceId,
        this.info.getIdentifier().getSchemaName(), this.info.getIdentifier().getTableName(),
        this.info.getStreamSchema()));
  }

  public long getInstanceId() {
    return instanceId;
  }

  public String getWorkspace() {
    return info.getIdentifier().getWorkspace();
  }

  public String getSchemaName() {
    return info.getIdentifier().getSchemaName();
  }

  public String getTableName() {
    return info.getIdentifier().getTableName();
  }

  public String getStreamId() {
    return info.getStreamId();
  }

  public ArrowTable getArrowTable() {
    return arrowTable;
  }

  public BulkLoadOperation getOperation() {
    return ProtoUtils.fromProtoV2(info.getOperation());
  }

  public BulkLoadState getState() {
    return ProtoUtils.fromProtoV2(info.getStreamState());
  }

  public String getSqlErrorMsg() {
    return info.getSqlErrorMsg();
  }

  public Optional getPartitionSpecs() {
    return info.getPartitionSpec().isEmpty() ?
        Optional.empty() : Optional.of(info.getPartitionSpec());
  }

  public List getRecordKeys() {
    return info.getRecordKeysList();
  }

  public boolean preferInternalEndpoint() {
    return info.getPreferInternalEndpoint();
  }

  public Map getEncryptionOptions() {
    return info.getEncryptionOptionsMap();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy