Skip to content

Commit

Permalink
[Improve][Connector][Doris] Improve doris source. (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlechazoW authored Oct 27, 2022
1 parent dde6452 commit 0052d8d
Show file tree
Hide file tree
Showing 30 changed files with 166 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
import java.util.List;
import java.util.StringJoiner;

/**
* Company:www.dtstack.com.
*
* @author shitou
* @date 2021/11/10
*/
public class DorisColumnConverter
extends AbstractRowConverter<RowData, RowData, StringJoiner, String> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@

import java.util.StringJoiner;

/**
* Company: www.dtstack.com
*
* @author xuchao
* @date 2021-11-21
*/
public class DorisHttpRowConverter
extends AbstractRowConverter<RowData, RowData, StringJoiner, LogicalType> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@

import java.util.Locale;

/**
* @author xuchao
* @date 2021-11-21
*/
public class DorisRowTypeConverter {

public static DataType apply(String type) {
Expand All @@ -38,31 +34,41 @@ public static DataType apply(String type) {
return DataTypes.BOOLEAN();
case "TINYINT":
return DataTypes.TINYINT();
case "TINYINT UNSIGNED":
case "SMALLINT":
return DataTypes.SMALLINT();
case "SMALLINT UNSIGNED":
case "MEDIUMINT":
case "MEDIUMINT UNSIGNED":
case "INT":
case "INTEGER":
case "INT24":
return DataTypes.INT();
case "INT UNSIGNED":
case "BIGINT":
return DataTypes.BIGINT();
case "BIGINT UNSIGNED":
return DataTypes.DECIMAL(20, 0);
case "REAL":
case "FLOAT":
case "FLOAT UNSIGNED":
return DataTypes.FLOAT();
case "DECIMAL":
case "DECIMAL UNSIGNED":
case "NUMERIC":
case "DECIMALV2":
return DataTypes.DECIMAL(38, 18);
case "DOUBLE":
case "DOUBLE UNSIGNED":
return DataTypes.DOUBLE();
case "CHAR":
case "VARCHAR":
case "STRING":
case "JSON":
case "TINYTEXT":
case "TEXT":
case "MEDIUMTEXT":
case "LONGTEXT":
case "JSON":
case "ENUM":
case "SET":
return DataTypes.STRING();
Expand All @@ -81,8 +87,8 @@ public static DataType apply(String type) {
case "LONGBLOB":
case "BINARY":
case "VARBINARY":
// BYTES 底层调用的是VARBINARY最大长度
case "GEOMETRY":
// BYTES 底层调用的是VARBINARY最大长度
return DataTypes.BYTES();
case "NULL_TYPE":
case "NULL":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

package com.dtstack.chunjun.connector.doris.exception;

/**
* @author tiezhu@dtstack
* @date 2021/9/17 星期五
*/
public class DorisConnectFailedException extends RuntimeException {
public DorisConnectFailedException(String username, String hostUrl, Throwable cause) {
super(String.format("User [%s] connect to [%s] failed.", username, hostUrl), cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,12 @@
import java.util.Objects;
import java.util.Properties;

/**
* @author tiezhu@dtstack
* @date 2021/9/16 星期四
*/
public class DorisConf extends JdbcConf {

private String database;

private String table;

private String username;

private String password;

private String writeMode;

private List<String> feNodes;

private String url;
Expand Down Expand Up @@ -102,14 +92,6 @@ public void setPassword(String password) {
this.password = password;
}

public String getWriteMode() {
return writeMode;
}

public void setWriteMode(String writeMode) {
this.writeMode = writeMode;
}

public List<String> getFeNodes() {
return feNodes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
import java.util.Properties;
import java.util.StringJoiner;

/**
* @author tiezhu@dtstack
* @date 2021/9/17 星期五
*/
public class DorisConfBuilder {

private final DorisConf dorisConf;

public DorisConfBuilder() {
Expand Down Expand Up @@ -58,11 +55,6 @@ public DorisConfBuilder setPassword(String password) {
return this;
}

public DorisConfBuilder setWriteMode(String writeMode) {
this.dorisConf.setWriteMode(writeMode);
return this;
}

public DorisConfBuilder setNameMapped(boolean needNameMapping) {
this.dorisConf.setNameMapped(needNameMapping);
return this;
Expand Down Expand Up @@ -101,10 +93,6 @@ public DorisConfBuilder setWaitRetryMills(long waitRetryMills) {
public DorisConf build() {
StringJoiner errorMessage = new StringJoiner("\n");

if (dorisConf.getFeNodes() == null || dorisConf.getFeNodes().isEmpty()) {
errorMessage.add("Doris FeNodes can not be empty!");
}

if (dorisConf.getUsername() == null || dorisConf.getUsername().isEmpty()) {
errorMessage.add("Doris Username can not be empty!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

package com.dtstack.chunjun.connector.doris.options;

/**
* @author tiezhu@dtstack
* @date 2021/9/17 星期五
*/
public final class DorisKeys {

public static final String FIELD_DELIMITER_KEY = "fieldDelimiter";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@

import java.util.List;

/**
* Company: www.dtstack.com
*
* @author xuchao
* @date 2021-11-21
*/
public class DorisOptions {
public static final ConfigOption<List<String>> FENODES =
ConfigOptions.key("feNodes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@

import java.io.Serializable;

/**
* @author tiezhu@dtstack
* @date 2021/9/18 星期六
*/
public class LoadConf implements Serializable {

private static final Long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

package com.dtstack.chunjun.connector.doris.options;

/**
* @author tiezhu@dtstack
* @date 2021/9/18 星期六
*/
public class LoadConfBuilder {
private final LoadConf loadConf;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
import java.util.StringJoiner;
import java.util.stream.IntStream;

/**
* Company:www.dtstack.com.
*
* @author shitou
* @date 2022/1/17
*/
public class Carrier implements Serializable {
private static final long serialVersionUID = 1L;
private final List<Map<String, Object>> insertContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* Company:www.dtstack.com.
*
* @author shitou
* @date 2021/12/21
*/
public class DorisLoadClient implements Serializable {
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(DorisLoadClient.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,15 @@
import java.util.UUID;
import java.util.stream.Collectors;

/**
* @author tiezhu@dtstack.com
* @since 08/10/2021 Friday
*/
public class DorisStreamLoad implements Serializable {

private static final Logger LOG = LoggerFactory.getLogger(DorisStreamLoad.class);
private static final ObjectMapper OM = new ObjectMapper();
private static final List<String> DORIS_SUCCESS_STATUS =
new ArrayList<>(Arrays.asList("Success", "Publish Timeout"));
private static final String LOAD_URL_PATTERN = "http://%s/api/%s/%s/_stream_load?";
private String authEncoding;
private Properties streamLoadProp;
private final String authEncoding;
private final Properties streamLoadProp;
private String hostPort;
private DorisConf options;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@
import static com.dtstack.chunjun.connector.doris.options.DorisKeys.ILLEGAL_ARGUMENT_MESSAGE;
import static com.dtstack.chunjun.connector.doris.options.DorisKeys.SHOULD_NOT_HAPPEN_MESSAGE;

/**
* @author tiezhu@dtstack
* @date 2021/9/17 星期五
*/
public class FeRestService implements Serializable {

public static final int REST_RESPONSE_STATUS_OK = 200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@

import java.util.List;

/**
* @author tiezhu@dtstack.com
* @since 08/10/2021 Friday
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Backend {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
* @author tiezhu@dtstack.com
* @since 08/10/2021 Friday
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class BackendRow {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@

import java.util.Objects;

/**
* @author tiezhu@dtstack.com
* @since 08/10/2021 Friday
*/
public class Field {
private String name;
private String type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
import java.util.Set;
import java.util.StringJoiner;

/**
* @author tiezhu@dtstack
* @date 2021/9/18 星期六
*/
public class PartitionDefinition implements Serializable, Comparable<PartitionDefinition> {
private final String database;
private final String table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
import java.util.Map;
import java.util.Objects;

/**
* @author tiezhu@dtstack.com
* @since 08/10/2021 Friday
*/
public class QueryPlan {
private int status;
private String opaqued_query_plan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
* @author tiezhu@dtstack.com
* @since 08/10/2021 Friday
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class RespContent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
import java.util.List;
import java.util.Objects;

/**
* @author tiezhu@dtstack.com
* @since 08/10/2021 Friday
*/
public class Schema {
private int status = 0;
private List<Field> properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
import java.util.List;
import java.util.Objects;

/**
* @author tiezhu@dtstack.com
* @since 08/10/2021 Friday
*/
public class Tablet {
private List<String> routing;
private int version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
import java.util.Arrays;
import java.util.List;

/**
* Company: www.dtstack.com
*
* @author xuchao
* @date 2021-11-21
*/
public class DorisDynamicTableSink extends JdbcDynamicTableSink {

private final TableSchema physicalSchema;
Expand Down
Loading

0 comments on commit 0052d8d

Please sign in to comment.