com.clickzetta.platform.client.api.ArrowFailureMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clickzetta-java Show documentation
Show all versions of clickzetta-java Show documentation
The java SDK for clickzetta's Lakehouse
package com.clickzetta.platform.client.api;
import com.clickzetta.platform.arrow.ArrowTable;
import cz.proto.ingestion.v2.IngestionV2;
import java.util.*;
import java.util.stream.Collectors;
public class ArrowFailureMessage extends ArrowSuccessMessage {
private final ArrowTable table;
public ArrowFailureMessage(
String sessionId,
ArrowTable table,
IngestionV2.MutateRequest request,
IngestionV2.MutateResponse response) {
super(sessionId, request, response);
this.table = table;
}
@Override
public int getErrorRowsCounts() {
if (response.getRowStatusListCount() > 0) {
return (int) response.getRowStatusListList().stream()
.filter(mutateRowStatus -> mutateRowStatus.getCode() != IngestionV2.Code.SUCCESS).count();
}
return 0;
}
@Override
public List getErrorRows() {
if (response.getRowStatusListCount() > 0) {
List errorRowStatus = response.getRowStatusListList()
.stream().filter(mutateRowStatus -> mutateRowStatus.getCode() != IngestionV2.Code.SUCCESS)
.sorted(Comparator.comparingInt(IngestionV2.MutateRowStatus::getRowIndex))
.collect(Collectors.toList());
return decodeArrowRow(request, errorRowStatus);
}
return null;
}
private List decodeArrowRow(IngestionV2.MutateRequest request, List errorRowStatus) {
return new ArrayList<>();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy