com.aliyun.odps.jdbc.BasicTableUploader Maven / Gradle / Ivy
package com.aliyun.odps.jdbc;
import static java.lang.String.format;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import com.aliyun.odps.OdpsException;
import com.aliyun.odps.data.ArrayRecord;
import com.aliyun.odps.tunnel.TableTunnel;
import com.aliyun.odps.tunnel.TunnelException;
import com.aliyun.odps.tunnel.io.TunnelRecordWriter;
public class BasicTableUploader extends DataUploader {
private TableTunnel.UploadSession uploadSession;
private int blocks = 0;
public BasicTableUploader(String projectName, String schemaName, String tableName,
String partitionSpec, List specificColumns, OdpsConnection conn)
throws OdpsException, IOException {
super(projectName, schemaName, tableName, partitionSpec, specificColumns, conn);
}
public void setUpSession() throws OdpsException {
if (null != partitionSpec) {
uploadSession = tunnel.createUploadSession(projectName, tableName, partitionSpec);
} else {
uploadSession = tunnel.createUploadSession(projectName, tableName);
}
conn.log.info("create upload session id=" + uploadSession.getId());
reuseRecord = (ArrayRecord) uploadSession.newRecord();
tableSchema = uploadSession.getSchema();
}
protected void upload(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy