com.clickzetta.client.jdbc.core.LakehouseHttpClient 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.client.jdbc.core;
import com.google.protobuf.util.JsonFormat;
import cz.proto.coordinator.CoordinatorServiceOuterClass;
import java.sql.SQLException;
public class LakehouseHttpClient implements LakehouseClient {
@Override
public CoordinatorServiceOuterClass.SubmitJobResponse submitJob(String request, CZConnectContext connectContext, String jobId) throws Exception {
String respStr = connectContext.getHttpHelper().submitStatement(request, connectContext, jobId);
return CZLakehouseResponseHelper.convertToPb(respStr);
}
@Override
public CoordinatorServiceOuterClass.GetJobResultResponse getJobResult(String request, CZConnectContext connectContext, String jobId) throws Exception {
String resp = connectContext.getHttpHelper().getJobInfoStatement(request, connectContext,
jobId, "result");
CoordinatorServiceOuterClass.GetJobResultResponse.Builder respBuilder = CoordinatorServiceOuterClass.GetJobResultResponse.newBuilder();
JsonFormat.parser().ignoringUnknownFields().merge(resp, respBuilder);
CoordinatorServiceOuterClass.GetJobResultResponse getResult = respBuilder.build();
return getResult;
}
@Override
public CoordinatorServiceOuterClass.GetJobProgressResponse getJobProgress(String request, CZConnectContext connectContext, String jobId) throws Exception {
String resp = connectContext.getHttpHelper().getJobInfoStatement(request, connectContext,
jobId, "progress");
CoordinatorServiceOuterClass.GetJobProgressResponse.Builder respBuilder = CoordinatorServiceOuterClass.GetJobProgressResponse.newBuilder();
JsonFormat.parser().ignoringUnknownFields().merge(resp, respBuilder);
CoordinatorServiceOuterClass.GetJobProgressResponse getResult = respBuilder.build();
return getResult;
}
@Override
public CoordinatorServiceOuterClass.GetJobProfileResponse getJobProfile(String request, CZConnectContext connectContext, String jobId) throws Exception {
String resp = connectContext.getHttpHelper().getJobInfoStatement(request, connectContext,
jobId, "profile");
CoordinatorServiceOuterClass.GetJobProfileResponse.Builder respBuilder = CoordinatorServiceOuterClass.GetJobProfileResponse.newBuilder();
JsonFormat.parser().ignoringUnknownFields().merge(resp, respBuilder);
CoordinatorServiceOuterClass.GetJobProfileResponse getResult = respBuilder.build();
return getResult;
}
@Override
public CoordinatorServiceOuterClass.GetJobSummaryResponse getJobSummary(String request, CZConnectContext connectContext, String jobId) throws Exception {
String resp = connectContext.getHttpHelper().getJobInfoStatement(request, connectContext,
jobId, "summary");
CoordinatorServiceOuterClass.GetJobSummaryResponse.Builder respBuilder = CoordinatorServiceOuterClass.GetJobSummaryResponse.newBuilder();
JsonFormat.parser().ignoringUnknownFields().merge(resp, respBuilder);
CoordinatorServiceOuterClass.GetJobSummaryResponse getResult = respBuilder.build();
return getResult;
}
@Override
public CoordinatorServiceOuterClass.GetJobPlanResponse getJobPlan(String request, CZConnectContext connectContext, String jobId) throws Exception {
String resp = connectContext.getHttpHelper().getJobInfoStatement(request, connectContext,
jobId, "plan");
CoordinatorServiceOuterClass.GetJobPlanResponse.Builder respBuilder = CoordinatorServiceOuterClass.GetJobPlanResponse.newBuilder();
JsonFormat.parser().ignoringUnknownFields().merge(resp, respBuilder);
CoordinatorServiceOuterClass.GetJobPlanResponse getResult = respBuilder.build();
return getResult;
}
@Override
public CoordinatorServiceOuterClass.CancelJobResponse cancelJob(String request, CZConnectContext connectContext, String jobId) throws Exception {
String resp = connectContext.getHttpHelper().cancelStatement(request, connectContext, jobId);
CoordinatorServiceOuterClass.CancelJobResponse.Builder respBuilder =
CoordinatorServiceOuterClass.CancelJobResponse.newBuilder();
JsonFormat.parser().ignoringUnknownFields().merge(resp, respBuilder);
CoordinatorServiceOuterClass.CancelJobResponse cancelResponse =
respBuilder.build();
return cancelResponse;
}
@Override
public CoordinatorServiceOuterClass.OpenTableResponse openTable(String request, CZConnectContext connectContext, String schema, String table) throws Exception {
String resp = connectContext.getHttpHelper().openTableStatement(request, connectContext,
schema, table);
CoordinatorServiceOuterClass.OpenTableResponse.Builder respBuilder =
CoordinatorServiceOuterClass.OpenTableResponse.newBuilder();
JsonFormat.parser().ignoringUnknownFields().merge(resp, respBuilder);
CoordinatorServiceOuterClass.OpenTableResponse openTableResponse =
respBuilder.build();
return openTableResponse;
}
@Override
public CoordinatorServiceOuterClass.CreateWorkspaceResponse createWorkspace(String request, CZConnectContext connectContext) throws Exception {
throw new CZExceptionNotSupported("LakehouseHttpClient.createWorkspace");
}
@Override
public CoordinatorServiceOuterClass.GetWorkspaceResponse getWorkspace(String request, CZConnectContext connectContext) throws Exception {
throw new CZExceptionNotSupported("LakehouseHttpClient.getWorkspace");
}
@Override
public CoordinatorServiceOuterClass.DeleteWorkspaceResponse deleteWorkspace(String request,
CZConnectContext connectContext) throws Exception {
throw new CZExceptionNotSupported("LakehouseHttpClient.deleteWorkspace");
}
@Override
public CoordinatorServiceOuterClass.UpdateWorkspaceResponse updateWorkspace(String request,
CZConnectContext connectContext) throws Exception {
throw new CZExceptionNotSupported("LakehouseHttpClient.updateWorkspace");
}
@Override
public CoordinatorServiceOuterClass.ListWorkspacesResponse listWorkspaces(String request, CZConnectContext connectContext) throws Exception {
throw new CZExceptionNotSupported("LakehouseHttpClient.listWorkspaces");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy