Unverified Commit 06e66f51 authored by 高岩's avatar 高岩 Committed by GitHub

Fixed the lost column of DRIOS when fetch data column (#1203)

* Fixed the problem that the global variable information of the data source could not be obtained in the K8s mode * Fixed the lost column issue of DRIOS when fetch data column * Add log when get jobInstance info failed * fix Drios datetime type covert error
parent f9062e27
......@@ -30,6 +30,8 @@ import com.dlink.utils.JSONUtil;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
......@@ -53,6 +55,8 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo
return getJobHistoryInfo(getById(id));
}
private static final Logger log = LoggerFactory.getLogger(JobHistoryServiceImpl.class);
@Override
public JobHistory getJobHistoryInfo(JobHistory jobHistory) {
if (Asserts.isNotNull(jobHistory)) {
......@@ -122,6 +126,8 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo
*/
}
} catch (Exception e) {
log.error("Get flink job info failed !! historyId is {}, jobManagerHost is :{}, jobId is :{}",
id, jobManagerHost, jobId);
e.printStackTrace();
}
return jobHistory;
......
......@@ -321,8 +321,11 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
Integer length = Integer.valueOf(columnType.replaceAll("\\D", ""));
field.setLength(length);
} else {
// 例如浮点类型的长度和精度是一样的,decimal(10,2)
field.setLength(results.getInt(dbQuery.precision()));
// some database does not have precision
if (dbQuery.precision() != null) {
// 例如浮点类型的长度和精度是一样的,decimal(10,2)
field.setLength(results.getInt(dbQuery.precision()));
}
}
field.setType(type);
} else {
......@@ -359,6 +362,9 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
if (columnList.contains(dbQuery.scale())) {
field.setScale(results.getInt(dbQuery.scale()));
}
if (columnList.contains(dbQuery.defaultValue())) {
field.setDefaultValue(results.getString(dbQuery.defaultValue()));
}
if (columnList.contains(dbQuery.autoIncrement())) {
field.setAutoIncrement(
Asserts.isEqualsIgnoreCase(results.getString(dbQuery.autoIncrement()), "auto_increment"));
......
......@@ -24,6 +24,7 @@ import com.dlink.model.Column;
import com.dlink.model.ColumnType;
public class DorisTypeConvert implements ITypeConvert {
@Override
public ColumnType convert(Column column) {
ColumnType columnType = ColumnType.STRING;
......@@ -78,10 +79,12 @@ public class DorisTypeConvert implements ITypeConvert {
} else {
columnType = ColumnType.DOUBLE;
}
} else if (t.contains("date")) {
columnType = ColumnType.STRING;
// datetime must above of date,
// if not, date will overrwrit datetime
} else if (t.contains("datetime")) {
columnType = ColumnType.STRING;
columnType = ColumnType.TIMESTAMP;
} else if (t.contains("date")) {
columnType = ColumnType.DATE;
} else if (t.contains("decimal")) {
columnType = ColumnType.DECIMAL;
} else if (t.contains("time")) {
......
......@@ -75,6 +75,11 @@ public class DorisQuery extends AbstractDBQuery {
return "Key";
}
@Override
public String defaultValue() {
return "Default";
}
public boolean isKeyIdentity(ResultSet results) throws SQLException {
return "auto_increment".equals(results.getString("Extra"));
}
......@@ -86,32 +91,42 @@ public class DorisQuery extends AbstractDBQuery {
@Override
public String characterSet() {
return "Default";
return "Collation";
}
// Doris does not have sort filed ,
// return null skip it
@Override
public String collation() {
return "Default";
return null;
}
// Doris does not have columnPosition field,
// return null skip it
@Override
public String columnPosition() {
return "Default";
return null;
}
// Doris does not have precision field,
// return null skip it
@Override
public String precision() {
return "Default";
return null;
}
// Doris does not have scale field,
// return null skip it
@Override
public String scale() {
return "Default";
return null;
}
// Doris does not have autoIncrement field,
// return null skip it
@Override
public String autoIncrement() {
return "Default";
return null;
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment