-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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(sqllab): Invalid start date #25133
fix(sqllab): Invalid start date #25133
Conversation
@@ -56,7 +56,10 @@ export default async function parseResponse<T extends ParseMethod = 'json'>( | |||
// `json-bigint` could not handle floats well, see sidorares/json-bigint#62 | |||
// TODO: clean up after json-bigint>1.0.1 is released | |||
json: cloneDeepWith(json, (value: any) => | |||
value?.isInteger?.() === false ? Number(value) : undefined, | |||
value?.isInteger?.() === false || |
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.
@justinpark how is there any merit to casting this to a Decimal as opposed to a Number
or are these types typically not used by the Superset frontend?
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.
Good point. I also concerned about the data inaccuracy issue since this will convert all float numbers in Number(even Decimal) which can drop some digits in a long form 234020423042304302.402
vs 234020423042304300 (=Number(234020423042304302.402))
I reverted this json-bigint modification and made the extra date value conversion logic in SqlLab instead.
42f1913
to
bd91059
Compare
@justinpark I think your current implementation is safer, i.e., casting specific instances of stringified decimals to a |
@justinpark can you please also add a date component to "Started" in SQL Lab Query History as it is really difficult to identify what date query ran on with just time displayed. |
@mdeshmu I added the date value in the format. |
@justinpark thanks for adding the date. We are using the above format in the Query History Tab. |
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.
LGTM. Thanks for the fix @justinpark!
I like @mdeshmu suggestion to make the time format consistent with SQL -> Query History 👍🏼
@michael-s-molina Please include this PR in 3.0. Thanks. |
Sounds good. I changed to same format as Query History as well as from |
(cherry picked from commit 8b2a408)
SUMMARY
Fixes #24790
Since /updated_since api migrate to v1 in #22611 , the startDttm format has been changed from a number to a string.
Similar to #19605, it fails the conversion to a moment object. Since the Flask’s JSON serialization of decimals casts it to a string is actually correct as it preserves precision, so the frontend should expect strings.
This commit adds the extra parse logic in sqllab query sync to handle the floating value in the string format.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
After:
https://user-images.githubusercontent.com/1392866/264449407-c2015fe7-d1ef-48b4-9c98-60de6aa27c9c.png
Before:
https://user-images.githubusercontent.com/57723564/255794908-2b4a9005-00fc-4adc-95b0-d7a8a0fdee09.png
TESTING INSTRUCTIONS
Go to SQLLab and run a query
Go to Query history and check the start date column
ADDITIONAL INFORMATION