From 54a6963d494de1a8c5f302e956fd4e70450980f7 Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 18 Mar 2024 14:48:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20ClickHouse,=20Oracl?= =?UTF-8?q?e=E6=94=AF=E6=8C=81=E5=B9=B4=E5=AD=A3=E5=BA=A6=E3=80=81?= =?UTF-8?q?=E5=B9=B4=E5=91=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/query/ck/CKQueryProvider.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/core/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java b/core/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java index 6be04e0b09..f6e0bd7634 100644 --- a/core/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java +++ b/core/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java @@ -1551,11 +1551,11 @@ public class CKQueryProvider extends QueryProvider { case "y": return "%Y"; case "y_Q": - return "CONCAT(%s,'" + split + "','Q',%s)"; + return "CONCAT(toString(%s),'" + split + "','Q',toString(%s))"; case "y_M": return "%Y" + split + "%m"; case "y_W": - return "CONCAT(%s,'" + split + "','W',%s)"; + return "CONCAT(toString(%s),'" + split + "','W',toString(%s))"; case "y_M_d": return "%Y" + split + "%m" + split + "%d"; case "H_m_s": @@ -1600,28 +1600,30 @@ public class CKQueryProvider extends QueryProvider { if (x.getDeType() == DeTypeConstants.DE_TIME) { String format = transDateFormat(x.getDateStyle(), x.getDatePattern()); if (x.getDeExtractType() == DeTypeConstants.DE_STRING) { + String s = String.format(CKConstants.toDateTime, originField); if (StringUtils.equalsIgnoreCase(x.getDateStyle(), "y_Q")) { fieldName = String.format(format, - String.format(CKConstants.toYear, "toDate(" + originField + ")"), - String.format(CKConstants.toQuarter, "toDate(" + originField + ")")); + String.format(CKConstants.toYear, String.format(CKConstants.toDateTime, originField)), + String.format(CKConstants.toQuarter, String.format(CKConstants.toDateTime, originField))); } else if (StringUtils.equalsIgnoreCase(x.getDateStyle(), "y_W")) { fieldName = String.format(format, - String.format(CKConstants.toYear, "toDate(" + originField + ")"), - String.format(CKConstants.toWeek, "toDate(" + originField + ")")); + String.format(CKConstants.toYear, s), + String.format(CKConstants.toWeek, s)); } else { - fieldName = String.format(CKConstants.formatDateTime, String.format(CKConstants.toDateTime, originField), format); + fieldName = String.format(CKConstants.formatDateTime, s, format); } } else { + String s = String.format(CKConstants.toDateTime, String.format(CKConstants.toFloat64, originField)); if (StringUtils.equalsIgnoreCase(x.getDateStyle(), "y_Q")) { fieldName = String.format(format, - String.format(CKConstants.toYear, "toDate(" + originField + ")"), - String.format(CKConstants.toQuarter, "toDate(" + originField + ")")); + String.format(CKConstants.toYear, s), + String.format(CKConstants.toQuarter, s)); } else if (StringUtils.equalsIgnoreCase(x.getDateStyle(), "y_W")) { fieldName = String.format(format, - String.format(CKConstants.toYear, "toDate(" + originField + ")"), - String.format(CKConstants.toWeek, "toDate(" + originField + ")")); + String.format(CKConstants.toYear, s), + String.format(CKConstants.toWeek, s)); } else { - fieldName = String.format(CKConstants.formatDateTime, String.format(CKConstants.toDateTime, String.format(CKConstants.toFloat64, originField)), format); + fieldName = String.format(CKConstants.formatDateTime, s, format); } } } else {