forked from github/dataease
Merge pull request #12371 from dataease/pr@dev-v2@fix_ds
fix(数据源): 修复ClickHouse日期格式化问题
This commit is contained in:
commit
c2961d5612
2
pom.xml
2
pom.xml
@ -30,7 +30,7 @@
|
||||
<mybatis-plus.version>3.5.6</mybatis-plus.version>
|
||||
<h2.version>2.2.220</h2.version>
|
||||
<knife4j.version>4.4.0</knife4j.version>
|
||||
<calcite-core.version>1.35.13</calcite-core.version>
|
||||
<calcite-core.version>1.35.14</calcite-core.version>
|
||||
<commons-dbcp2.version>2.6.0</commons-dbcp2.version>
|
||||
<antlr.version>3.5.2</antlr.version>
|
||||
<java-jwt.version>3.12.1</java-jwt.version>
|
||||
|
@ -14,10 +14,10 @@ public class DatasourceDTO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1175287571828910222L;
|
||||
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long pid;
|
||||
/**
|
||||
* 数据源名称
|
||||
@ -73,10 +73,10 @@ public class DatasourceDTO implements Serializable {
|
||||
private TaskDTO syncSetting;
|
||||
|
||||
private Integer editType;
|
||||
private String nodeType;
|
||||
private String action;
|
||||
private String fileName;
|
||||
private String size;
|
||||
private String nodeType;
|
||||
private String action;
|
||||
private String fileName;
|
||||
private String size;
|
||||
/**
|
||||
* 上次成功更新时间
|
||||
*/
|
||||
@ -91,4 +91,6 @@ public class DatasourceDTO implements Serializable {
|
||||
private String taskStatus;
|
||||
|
||||
private Boolean enableDataFill;
|
||||
|
||||
private int dsVersion = -1;
|
||||
}
|
||||
|
@ -136,6 +136,10 @@ public abstract class Provider {
|
||||
try {
|
||||
DatasourceSchemaDTO value = dsMap.entrySet().iterator().next().getValue();
|
||||
|
||||
// 获取数据库version
|
||||
ConnectionObj connection = getConnection(value);
|
||||
value.setDsVersion(connection.getConnection().getMetaData().getDatabaseMajorVersion());
|
||||
|
||||
SqlParser parser = SqlParser.create(sql, SqlParser.Config.DEFAULT.withLex(Lex.JAVA));
|
||||
SqlNode sqlNode = parser.parseStmt();
|
||||
return sqlNode.toSqlString(getDialect(value)).toString();
|
||||
@ -218,7 +222,7 @@ public abstract class Provider {
|
||||
sqlDialect = RedshiftSqlDialect.DEFAULT;
|
||||
break;
|
||||
case ck:
|
||||
sqlDialect = ClickHouseSqlDialect.DEFAULT;
|
||||
sqlDialect = new ClickHouseSqlDialect(ClickHouseSqlDialect.DEFAULT_CONTEXT, coreDatasource.getDsVersion());
|
||||
break;
|
||||
case h2:
|
||||
sqlDialect = H2SqlDialect.DEFAULT;
|
||||
|
Loading…
Reference in New Issue
Block a user