You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by li...@apache.org on 2020/04/03 05:19:36 UTC

[incubator-doris] branch branch-0.12 updated (d465a8c -> 2c8c7e7)

This is an automated email from the ASF dual-hosted git repository.

lichaoyong pushed a change to branch branch-0.12
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git.


 discard d465a8c  Fix spell error (#3255)
     add 881661a  Fix spell error (#3255)
     new 2c8c7e7  Fix cast date type return wrong result (#3214)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d465a8c)
            \
             N -- N -- N   refs/heads/branch-0.12 (2c8c7e7)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/doris/analysis/DateLiteral.java   |  7 +++++++
 .../org/apache/doris/analysis/DateLiteralTest.java    | 19 +++++++++++++++++++
 2 files changed, 26 insertions(+)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[incubator-doris] 01/01: Fix cast date type return wrong result (#3214)

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lichaoyong pushed a commit to branch branch-0.12
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit 2c8c7e7d5934cce4d89e8a9cb0096a48bb94ab5f
Author: HangyuanLiu <46...@qq.com>
AuthorDate: Fri Apr 3 12:08:18 2020 +0800

    Fix cast date type return wrong result (#3214)
    
    We have multiple date type, and we also need to cast between different date types.
    If not cast, it will cause problems when binarypredicate
---
 .../java/org/apache/doris/analysis/DateLiteral.java   |  7 +++++++
 .../org/apache/doris/analysis/DateLiteralTest.java    | 19 +++++++++++++++++++
 gensrc/script/gen_build_version.sh                    |  2 +-
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java b/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java
index cce2ad8..db0631a 100644
--- a/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java
+++ b/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java
@@ -320,6 +320,13 @@ public class DateLiteral extends LiteralExpr {
     @Override
     protected Expr uncheckedCastTo(Type targetType) throws AnalysisException {
         if (targetType.isDateType()) {
+            if (targetType.equals(Type.DATE)) {
+                this.castToDate();                            
+            } else if (targetType.equals(Type.DATETIME)) {
+                this.type = Type.DATETIME;                            
+            } else {
+                throw new AnalysisException("Error date literal type : " + type);
+            }
             return this;
         } else if (targetType.isStringType()) {
             return new StringLiteral(getStringValue());
diff --git a/fe/src/test/java/org/apache/doris/analysis/DateLiteralTest.java b/fe/src/test/java/org/apache/doris/analysis/DateLiteralTest.java
index 2121131..02b165b 100644
--- a/fe/src/test/java/org/apache/doris/analysis/DateLiteralTest.java
+++ b/fe/src/test/java/org/apache/doris/analysis/DateLiteralTest.java
@@ -55,4 +55,23 @@ public class DateLiteralTest {
         }
         Assert.assertFalse(hasException);
     }
+
+    @Test
+    public void uncheckedCastTo() {
+        boolean hasException = false;
+        try {
+            DateLiteral literal = new DateLiteral("1997-10-07", Type.DATE);
+            Expr castToExpr = literal.uncheckedCastTo(Type.DATETIME);
+            Assert.assertTrue(castToExpr instanceof DateLiteral);
+            Assert.assertEquals(castToExpr.type, Type.DATETIME);
+
+            DateLiteral literal2 = new DateLiteral("1997-10-07 12:23:23", Type.DATETIME);
+            Expr castToExpr2 = literal2.uncheckedCastTo(Type.DATETIME);
+            Assert.assertTrue(castToExpr2 instanceof DateLiteral);
+        } catch (AnalysisException e) {
+            e.printStackTrace();
+            hasException = true;
+        }
+        Assert.assertFalse(hasException);
+    }
 }
diff --git a/gensrc/script/gen_build_version.sh b/gensrc/script/gen_build_version.sh
index 21bb1b8..0b3550b 100755
--- a/gensrc/script/gen_build_version.sh
+++ b/gensrc/script/gen_build_version.sh
@@ -25,7 +25,7 @@
 # contains the build version based on the git hash or svn revision.
 ##############################################################
 
-build_version="trunk"
+build_version="branch-0.12"
 
 unset LANG
 unset LC_CTYPE


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org