Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
CAST string to temporal type now calls isTimestamp #1718
CAST string to temporal type now calls isTimestamp #1718
Changes from 2 commits
cb48046
53c917b
0f3520f
48e1c9c
2b0d86c
7316576
9ab1292
d5e0055
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do we have to do an extra regex pass? IIRC the regex passes are really expensive, and I'm curious how it compares to the cost of
isValidTimestamp
andasTimestampMicrosceonds
. I'm wondering if it would be overall cheaper to use the original regex and ifElse the two valid+conversion formats corresponding to that regex instead of adding another regex pass.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.
Yes, that makes sense. I'll refactor this part to avoid the additional regex call.
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.
I pushed one commit that refactors this to use a single regex and then pushed another commit to remove the regex completely for this full timestamp case and tests pass with the current test values.
@revans2 would you have any concerns about removing regex use in this case?
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.
Once we have sanitized the inputs the regular expressions are redundant and should be removed.
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.
I think we can probably remove even more regular expressions from the code.
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.
I looked at this some more and remembered why we have the regex here. We need to make sure there is no additional text after the sanitized date/timestamp string. I added an additional test case to demonstrate this for timestamps and reverted the change to remove the regex for this case.
I do think could remove more of these regexes by checking the length of the sanitized strings (in conjunction with calling cuDF
isTimestamp
) rather than using regex and have filed an issue for this: #1738