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; ...@@ -30,6 +30,8 @@ import com.dlink.utils.JSONUtil;
import java.util.Objects; import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
...@@ -53,6 +55,8 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo ...@@ -53,6 +55,8 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo
return getJobHistoryInfo(getById(id)); return getJobHistoryInfo(getById(id));
} }
private static final Logger log = LoggerFactory.getLogger(JobHistoryServiceImpl.class);
@Override @Override
public JobHistory getJobHistoryInfo(JobHistory jobHistory) { public JobHistory getJobHistoryInfo(JobHistory jobHistory) {
if (Asserts.isNotNull(jobHistory)) { if (Asserts.isNotNull(jobHistory)) {
...@@ -122,6 +126,8 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo ...@@ -122,6 +126,8 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo
*/ */
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Get flink job info failed !! historyId is {}, jobManagerHost is :{}, jobId is :{}",
id, jobManagerHost, jobId);
e.printStackTrace(); e.printStackTrace();
} }
return jobHistory; return jobHistory;
......
...@@ -321,8 +321,11 @@ public abstract class AbstractJdbcDriver extends AbstractDriver { ...@@ -321,8 +321,11 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
Integer length = Integer.valueOf(columnType.replaceAll("\\D", "")); Integer length = Integer.valueOf(columnType.replaceAll("\\D", ""));
field.setLength(length); field.setLength(length);
} else { } else {
// 例如浮点类型的长度和精度是一样的,decimal(10,2) // some database does not have precision
field.setLength(results.getInt(dbQuery.precision())); if (dbQuery.precision() != null) {
// 例如浮点类型的长度和精度是一样的,decimal(10,2)
field.setLength(results.getInt(dbQuery.precision()));
}
} }
field.setType(type); field.setType(type);
} else { } else {
...@@ -359,6 +362,9 @@ public abstract class AbstractJdbcDriver extends AbstractDriver { ...@@ -359,6 +362,9 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
if (columnList.contains(dbQuery.scale())) { if (columnList.contains(dbQuery.scale())) {
field.setScale(results.getInt(dbQuery.scale())); field.setScale(results.getInt(dbQuery.scale()));
} }
if (columnList.contains(dbQuery.defaultValue())) {
field.setDefaultValue(results.getString(dbQuery.defaultValue()));
}
if (columnList.contains(dbQuery.autoIncrement())) { if (columnList.contains(dbQuery.autoIncrement())) {
field.setAutoIncrement( field.setAutoIncrement(
Asserts.isEqualsIgnoreCase(results.getString(dbQuery.autoIncrement()), "auto_increment")); Asserts.isEqualsIgnoreCase(results.getString(dbQuery.autoIncrement()), "auto_increment"));
......
...@@ -24,6 +24,7 @@ import com.dlink.model.Column; ...@@ -24,6 +24,7 @@ import com.dlink.model.Column;
import com.dlink.model.ColumnType; import com.dlink.model.ColumnType;
public class DorisTypeConvert implements ITypeConvert { public class DorisTypeConvert implements ITypeConvert {
@Override @Override
public ColumnType convert(Column column) { public ColumnType convert(Column column) {
ColumnType columnType = ColumnType.STRING; ColumnType columnType = ColumnType.STRING;
...@@ -78,10 +79,12 @@ public class DorisTypeConvert implements ITypeConvert { ...@@ -78,10 +79,12 @@ public class DorisTypeConvert implements ITypeConvert {
} else { } else {
columnType = ColumnType.DOUBLE; columnType = ColumnType.DOUBLE;
} }
} else if (t.contains("date")) { // datetime must above of date,
columnType = ColumnType.STRING; // if not, date will overrwrit datetime
} else if (t.contains("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")) { } else if (t.contains("decimal")) {
columnType = ColumnType.DECIMAL; columnType = ColumnType.DECIMAL;
} else if (t.contains("time")) { } else if (t.contains("time")) {
......
...@@ -75,6 +75,11 @@ public class DorisQuery extends AbstractDBQuery { ...@@ -75,6 +75,11 @@ public class DorisQuery extends AbstractDBQuery {
return "Key"; return "Key";
} }
@Override
public String defaultValue() {
return "Default";
}
public boolean isKeyIdentity(ResultSet results) throws SQLException { public boolean isKeyIdentity(ResultSet results) throws SQLException {
return "auto_increment".equals(results.getString("Extra")); return "auto_increment".equals(results.getString("Extra"));
} }
...@@ -86,32 +91,42 @@ public class DorisQuery extends AbstractDBQuery { ...@@ -86,32 +91,42 @@ public class DorisQuery extends AbstractDBQuery {
@Override @Override
public String characterSet() { public String characterSet() {
return "Default"; return "Collation";
} }
// Doris does not have sort filed ,
// return null skip it
@Override @Override
public String collation() { public String collation() {
return "Default"; return null;
} }
// Doris does not have columnPosition field,
// return null skip it
@Override @Override
public String columnPosition() { public String columnPosition() {
return "Default"; return null;
} }
// Doris does not have precision field,
// return null skip it
@Override @Override
public String precision() { public String precision() {
return "Default"; return null;
} }
// Doris does not have scale field,
// return null skip it
@Override @Override
public String scale() { public String scale() {
return "Default"; return null;
} }
// Doris does not have autoIncrement field,
// return null skip it
@Override @Override
public String autoIncrement() { public String autoIncrement() {
return "Default"; return null;
} }
@Override @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