From 91a0f71a35982614033cf0817dd6042d4de0b0f9 Mon Sep 17 00:00:00 2001 From: junjie Date: Fri, 30 Jul 2021 16:02:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20doris=E7=B1=BB=E5=9E=8B=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/provider/doris/DorisConstants.java | 2 ++ .../java/io/dataease/provider/doris/DorisQueryProvider.java | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/backend/src/main/java/io/dataease/provider/doris/DorisConstants.java b/backend/src/main/java/io/dataease/provider/doris/DorisConstants.java index 5930960165..e25aa90085 100644 --- a/backend/src/main/java/io/dataease/provider/doris/DorisConstants.java +++ b/backend/src/main/java/io/dataease/provider/doris/DorisConstants.java @@ -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"; } diff --git a/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java b/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java index 368736debd..5132840ea6 100644 --- a/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java @@ -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; }