Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sql-filter): generate date filter of 'IS_ON_OR_AFTER' #707

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dtable_events/tests/sql/test_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def get_expected_sql_for_modifier(filter_modifier, column_name):
"filter_predicate": 'And',
"sorts":[],
},
"expected_sql": "SELECT * FROM `Table1` WHERE `createTime` <= '2021-12-20' and `createTime` is not null LIMIT 0, 100",
"expected_sql": "SELECT * FROM `Table1` WHERE `createTime` < '2021-12-21' and `createTime` is not null LIMIT 0, 100",
"by_group": False,
},
{
Expand Down
6 changes: 4 additions & 2 deletions dtable_events/utils/sql_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,11 @@ def op_is_on_or_before(self):
target_date, _ = self._other_date()
if not target_date:
return ""
return "`%(column_name)s` <= '%(target_date)s' and `%(column_name)s` is not null" % ({

next_date = self._format_date(target_date + timedelta(days=1))
return "`%(column_name)s` < '%(target_date)s' and `%(column_name)s` is not null" % ({
"column_name": self.column_name,
"target_date": self._format_date(target_date)
"target_date": next_date
})

def op_is_on_or_after(self):
Expand Down