Skip to content

[Bug] SimplifyInvalidDateBinaryPredicatesDateRule may cause invalid query plan#5987

Merged
morningman merged 3 commits intoapache:masterfrom
morningman:invalid_date_rule
Jun 10, 2021
Merged

[Bug] SimplifyInvalidDateBinaryPredicatesDateRule may cause invalid query plan#5987
morningman merged 3 commits intoapache:masterfrom
morningman:invalid_date_rule

Conversation

@morningman
Copy link
Contributor

@morningman morningman commented Jun 7, 2021

Proposed changes

  1. "where 1k > to_date(now())" will return EMPTYSET in query plan.
  2. DateLiteral should accept date string like "2021-6-1".

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)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have created an issue on (Fix [Bug] query with date column predicate return empty set #5988 ) and described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • If these changes need document changes, I have updated the document
  • Any dependent changes have been merged

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

…uery plan

1. "where 1k > to_date(now())" will return EMPTYSET in query plan.
2. DateLiteral should accept date string like "2021-6-1".
@morningman morningman added kind/fix Categorizes issue or PR as related to a bug. area/planner Issues or PRs related to the query planner labels Jun 7, 2021
@xinghuayu007
Copy link
Contributor

approved. I have tested function from_unixtime(), but not function to_date()

// We have to handle the following cases:
// A. k1 is datetime, sql with "k1 > to_date(now())" will be converted to k1 > cast(to_date("xxxx-xx-xx"))
// B. k1 is datetime, sql with "k1 > '2021-10-32 10:00:00.100010'" will be converted to k1 > cast('2021-10-32 10:00:00.100010' as datetime)
// C. k1 is datetime, sql with "k1 > '2021-10-32'" will be converted to k1 > cast('2021-10-32' as datetime)
Copy link
Contributor

Choose a reason for hiding this comment

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

converted to null literal

Copy link
Contributor

@EmmyMiao87 EmmyMiao87 left a comment

Choose a reason for hiding this comment

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

LGTM

@EmmyMiao87 EmmyMiao87 added the approved Indicates a PR has been approved by one committer. label Jun 9, 2021
@EmmyMiao87 EmmyMiao87 self-assigned this Jun 9, 2021
@morningman morningman merged commit 206a711 into apache:master Jun 10, 2021
EmmyMiao87 pushed a commit to EmmyMiao87/incubator-doris that referenced this pull request Nov 10, 2021
…uery plan (apache#5987)

1. "where 1k > to_date(now())" will return EMPTYSET in query plan.
2. DateLiteral should accept date string like "2021-6-1".
seawinde pushed a commit to seawinde/doris that referenced this pull request Jan 30, 2026
…dynamic modification (apache#58198) (apache#5987)

### What problem does this PR solve?

The fixed scheduling time requires a restart to modify. To change it,
use the command admin set frontend
config("cloud_tablet_rebalancer_interval_second"="3"); to apply the
change without a restart.

pick from apache/doris apache#58198
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. area/planner Issues or PRs related to the query planner 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] query with date column predicate return empty set

3 participants

Comments