ramiroaquinoromero commented on PR #37071: URL: https://github.com/apache/superset/pull/37071#issuecomment-3784903090
> @ramiroaquinoromero If we can't reproduce the issue i guess that means this is a defensive fix? Can we mock the issue somehow to see it and make sure it's fixed. @msyavuz Sure! I've added two tests that demonstrate the actual problem: Tests Added: `test_df_to_records_nan_json_serialization()` - Shows that without our fix, json.dumps(ignore_nan=False) raises ValueError: Out of range float values are not JSON compliant. The test directly mocks the issue by simulating Athena's NaN results and demonstrates that our fix converts NaN to None, preventing this error. `test_df_to_records_with_json_serialization_like_sql_lab()` - Replicates the actual SQL Lab serialization flow (mimicking sql_lab.py:360 and sql_lab.py:332) and validates that with our fix, serialization works correctly regardless of the ignore_nan flag setting. What the tests prove: The fix prevents ValueError exceptions when ignore_nan=False and eliminates the dependency on having ignore_nan=True set correctly throughout the codebase. Our fix ensures NaN values are converted to JSON-compliant null values at the source (df_to_records), making the output spec-compliant and interoperable with strict JSON parsers across different systems. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
