Skip to content

Conversation

@morningman
Copy link
Contributor

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

  • Bugfix (non-breaking change which fixes an issue)

Checklist

@morningman morningman added the kind/fix Categorizes issue or PR as related to a bug. label Sep 1, 2020
@morningman morningman self-assigned this Sep 1, 2020
// 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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these util methods to a single util class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

@kangkaisen kangkaisen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Sep 3, 2020
@morningman morningman merged commit 5166a6c into apache:master Sep 3, 2020
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. kind/fix Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] function str_to_date()'s behavior on BE and FE is inconsistent

3 participants