Merge pull request #436 from dataease/pr@dev@fix_doris类型转换

fix: doris类型转换
This commit is contained in:
XiaJunjie2020 2021-07-30 16:36:11 +08:00 committed by GitHub
commit 2f264e6ef8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -41,4 +41,6 @@ public class DorisConstants extends SQLConstants {
public static final String BRACKETS = "(%s)";
public static final String ROUND = "ROUND(%s,%s)";
public static final String VARCHAR = "VARCHAR";
}

View File

@ -519,6 +519,8 @@ public class DorisQueryProvider extends QueryProvider {
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
} else if (field.getDeType() == 0) {
whereName = String.format(DorisConstants.CAST, originName, DorisConstants.VARCHAR);
} else {
whereName = originName;
}
@ -560,6 +562,8 @@ public class DorisQueryProvider extends QueryProvider {
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
} else if (field.getDeType() == 0) {
whereName = String.format(DorisConstants.CAST, originName, DorisConstants.VARCHAR);
} else {
whereName = originName;
}
@ -636,6 +640,8 @@ public class DorisQueryProvider extends QueryProvider {
String from_unixtime = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(DorisConstants.DATE_FORMAT, from_unixtime, format);
}
} else if (x.getDeType() == 0) {
fieldName = String.format(DorisConstants.CAST, originField, DorisConstants.VARCHAR);
} else {
fieldName = originField;
}