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

com.clickzetta.platform.client.api.SuccessMessage Maven / Gradle / Ivy

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

import com.google.common.collect.Lists;
import cz.proto.ingestion.Ingestion;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class SuccessMessage implements Message {

  Ingestion.DataMutateRequest request;
  Ingestion.DataMutateResponse response;

  final String sessionId;
  final String schemaName;
  final String tableName;

  public SuccessMessage(
      String sessionId,
      Ingestion.DataMutateRequest request,
      Ingestion.DataMutateResponse response) {
    this.sessionId = sessionId;
    this.request = request;
    this.response = response;
    this.schemaName = request.getSchemaName();
    this.tableName = request.getTableName();
  }

  @Override
  public String getSessionId() {
    return sessionId;
  }

  @Override
  public long getBatchId() {
    return request.getBatchId();
  }

  @Override
  public long getTimestamp() {
    return request.getWriteTimestamp();
  }

  @Override
  public List getSchemaName() {
    return Lists.newArrayList(schemaName);
  }

  @Override
  public List getTableName() {
    return Lists.newArrayList(tableName);
  }

  @Override
  public long getTotalRowsCounts() {
    return request.getBatchCount();
  }

  @Override
  public List getRowStates() {
    return response.getRowStatusList()
        .stream().sorted(Comparator.comparingInt(Ingestion.MutateRowStatus::getRowIndex))
        .collect(Collectors.toList());
  }

  @Override
  public int getErrorRowsCounts() {
    return 0;
  }

  @Override
  public List getErrorRows() {
    return null;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy