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

fix(tests): Ensure deterministic SELECT ordering for CSV upload tests #23856

Merged
merged 6 commits into from
Apr 27, 2023

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Apr 27, 2023

SUMMARY

Some unit tests are failing (example) as SELECT statements do not guarantee deterministic ordering unless an ORDER BY clause is used. It's unclear why these unit tests are failing somewhat consistently now, though it might be due to a non-deterministic file ordering when adding files to a zip file.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

CI.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@john-bodley john-bodley marked this pull request as ready for review April 27, 2023 19:43
@codecov
Copy link

codecov bot commented Apr 27, 2023

Codecov Report

Merging #23856 (4c77a22) into master (0bf8907) will increase coverage by 14.44%.
The diff coverage is n/a.

❗ Current head 4c77a22 differs from pull request most recent head 50db0de. Consider uploading reports for the commit 50db0de to get more accurate results

@@             Coverage Diff             @@
##           master   #23856       +/-   ##
===========================================
+ Coverage   53.58%   68.02%   +14.44%     
===========================================
  Files        1938     1938               
  Lines       74957    74957               
  Branches     8140     8140               
===========================================
+ Hits        40167    50993    +10826     
+ Misses      32706    21880    -10826     
  Partials     2084     2084               
Flag Coverage Δ
hive 53.01% <ø> (?)
mysql 78.80% <ø> (?)
postgres 78.87% <ø> (?)
presto 52.92% <ø> (?)
python 82.67% <ø> (+29.85%) ⬆️
sqlite 77.39% <ø> (?)
unit 52.81% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 334 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@john-bodley
Copy link
Member Author

@hughhhh this should fix the issue you were trying to resolve in cc23d5d. I realize that @betodealmeida's recommendation was to sort the output, but it seems like the row ordering likely matters, i.e., should be deterministic.

Comment on lines 563 to 564
data = engine.execute(f"SELECT * from {PARQUET_UPLOAD_TABLE}").fetchall()
assert data == [("max", 3), ("bob", 4), ("john", 1), ("paul", 2)]
assert data == [("john", 1), ("paul", 2), ("max", 3), ("bob", 4)]
Copy link
Member

Choose a reason for hiding this comment

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

A SELECT does not guarantee order without an ORDER BY; if we don't want to use sorted() here we need to add an explicit ORDER BY to the query.

Copy link
Member Author

Choose a reason for hiding this comment

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

@betodealmeida I've re-authored the PR based on your comment.

@john-bodley john-bodley changed the title fix(tests): Ensure deterministic zip file ordering for CSV uploads fix(tests): Ensure deterministic CSV select Apr 27, 2023
@john-bodley john-bodley changed the title fix(tests): Ensure deterministic CSV select fix(tests): Ensure deterministic SELECT ordering for CSV upload tests Apr 27, 2023
Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

@john-bodley john-bodley merged commit f3a6754 into master Apr 27, 2023
sebastianliebscher pushed a commit to sebastianliebscher/superset that referenced this pull request Apr 28, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the john-bodley--fix-csv-uploads branch March 26, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants