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(spanner/spansql): fix DATE and TIMESTAMP parsing. #4480
Changes from 1 commit
f10b604
0cb3b33
007bcf2
4586857
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2714,11 +2714,15 @@ func (p *parser) parseLit() (Expr, *parseError) { | |
p.back() | ||
return p.parseArrayLit() | ||
case tok.caseEqual("DATE"): | ||
p.back() | ||
return p.parseDateLit() | ||
if !p.sniff("=") && !p.sniff(",") && !p.sniff("FROM") && !p.sniff("AS") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be implemented using a positive look-ahead instead of a negative-look ahead. In other words: If the SELECT UNIX_DATE(DATE "2008-12-25") Also, adding additional exceptions to the current if-not list will not solve that permanently, as there might be changes to the query syntax that would add additional keywords (i.e. not only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreeed. Fixed at 007bcf2 |
||
p.back() | ||
return p.parseDateLit() | ||
} | ||
case tok.caseEqual("TIMESTAMP"): | ||
p.back() | ||
return p.parseTimestampLit() | ||
if !p.sniff("=") && !p.sniff(",") && !p.sniff("FROM") && !p.sniff("AS") { | ||
p.back() | ||
return p.parseTimestampLit() | ||
} | ||
} | ||
|
||
// TODO: struct literals | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Do not add this to the list of string functions (see comment above the list)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fixed and added more date timestamp functions at 0cb3b33