You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/09/01 06:42:14 UTC

[GitHub] [incubator-doris] morningman opened a new pull request #4495: [Bug] function str_to_date()'s behavior on BE and FE is inconsistent

morningman opened a new pull request #4495:
URL: https://github.com/apache/incubator-doris/pull/4495


   ## Proposed changes
   
   Main CL:
   1. Copy the code from BE to implement the `str_to_date()` function in FE. 
   2. `str_to_date("2020-08-08", "%Y-%m-%d %H:%i:%s")` will return `2020-08-08 00:00:00` instead of `2020-08-08`.
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [x] Bugfix (non-breaking change which fixes an issue)
   
   ## Checklist
   
   - [x] I have create an issue on (Fix #4494), and have described the bug/feature there in detail
   - [x] Compiling and unit tests pass locally with my changes
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #4495: [Bug] function str_to_date()'s behavior on BE and FE is inconsistent

Posted by GitBox <gi...@apache.org>.
kangkaisen commented on a change in pull request #4495:
URL: https://github.com/apache/incubator-doris/pull/4495#discussion_r480905168



##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
##########
@@ -632,4 +669,435 @@ public long getSecond() {
     public int hashCode() {
         return 31 * super.hashCode() + Objects.hashCode(unixTimestamp(TimeZone.getDefault()));
     }
+
+    // parset the date string value in 'value' by 'format' pattern.
+    // return the next position to parse if hasSubVal is true.
+    // throw InvalidFormatException if encounter errors.
+    // this method is exaclty same as from_date_format_str() in be/src/runtime/datetime_value.cpp
+    // change this method should also change that.
+    public int fromDateFormatStr(String format, String value, boolean hasSubVal) throws InvalidFormatException {

Review comment:
       Move these util methods to a single util class? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-doris] morningman commented on a change in pull request #4495: [Bug] function str_to_date()'s behavior on BE and FE is inconsistent

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #4495:
URL: https://github.com/apache/incubator-doris/pull/4495#discussion_r481747384



##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
##########
@@ -632,4 +669,435 @@ public long getSecond() {
     public int hashCode() {
         return 31 * super.hashCode() + Objects.hashCode(unixTimestamp(TimeZone.getDefault()));
     }
+
+    // parset the date string value in 'value' by 'format' pattern.
+    // return the next position to parse if hasSubVal is true.
+    // throw InvalidFormatException if encounter errors.
+    // this method is exaclty same as from_date_format_str() in be/src/runtime/datetime_value.cpp
+    // change this method should also change that.
+    public int fromDateFormatStr(String format, String value, boolean hasSubVal) throws InvalidFormatException {

Review comment:
       It is now only used for DateLiteral, and this method is also in `datetime_value.cpp` in BE.
   So I think we can just leave it here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #4495: [Bug] function str_to_date()'s behavior on BE and FE is inconsistent

Posted by GitBox <gi...@apache.org>.
kangkaisen commented on a change in pull request #4495:
URL: https://github.com/apache/incubator-doris/pull/4495#discussion_r481868930



##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
##########
@@ -632,4 +669,435 @@ public long getSecond() {
     public int hashCode() {
         return 31 * super.hashCode() + Objects.hashCode(unixTimestamp(TimeZone.getDefault()));
     }
+
+    // parset the date string value in 'value' by 'format' pattern.
+    // return the next position to parse if hasSubVal is true.
+    // throw InvalidFormatException if encounter errors.
+    // this method is exaclty same as from_date_format_str() in be/src/runtime/datetime_value.cpp
+    // change this method should also change that.
+    public int fromDateFormatStr(String format, String value, boolean hasSubVal) throws InvalidFormatException {

Review comment:
       Ok. I think the Literal class should be simple. But which isn't a big issue.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-doris] morningman merged pull request #4495: [Bug] function str_to_date()'s behavior on BE and FE is inconsistent

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #4495:
URL: https://github.com/apache/incubator-doris/pull/4495


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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