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

Accept date in literal #1618

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TennyZhuang
Copy link

No description provided.

@@ -149,6 +150,8 @@ def literal(value: L) -> Literal[L]:
return DecimalLiteral(value)
elif isinstance(value, datetime):
return TimestampLiteral(datetime_to_micros(value)) # type: ignore
elif isinstance(value, date):
return DateLiteral(date_to_days(value))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return DateLiteral(date_to_days(value))
return DateLiteral(date_to_days(value)) # type: ignore

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Looks like theres a CI issue, Fokko's suggestion might help resolve it.

Could you also add a test for this change? heres an example for TimestampLiteral

def test_literal_from_datetime() -> None:
assert isinstance(literal(datetime.datetime.now()), TimestampLiteral)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants