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: Presto create column fix #28305

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eyalsh99
Copy link

@eyalsh99 eyalsh99 commented May 1, 2024

fix(presto): create column info - return native type

SUMMARY

Current Presto db_engine_spec get_columns failes because _create_column_info returned a stringifyied type instead of native type. This has prevented the creation of a new Presto dataset. See issue #25962

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
image

After:
After

TESTING INSTRUCTIONS

run:
pytest -v tests/unit_tests/db_engine_specs/test_presto.py

output:
============================================================================================================ test session starts ============================================================================================================
platform darwin -- Python 3.9.6, pytest-8.2.0, pluggy-1.5.0 -- ***/venv/bin/python3
cachedir: .pytest_cache
rootdir: ***
configfile: pytest.ini
plugins: mock-3.14.0
collected 23 items

tests/unit_tests/db_engine_specs/test_presto.py::test_convert_dttm[VARCHAR-dttm0-None] PASSED [ 4%]
tests/unit_tests/db_engine_specs/test_presto.py::test_convert_dttm[DATE-dttm1-DATE '2022-01-01'] PASSED [ 8%]
tests/unit_tests/db_engine_specs/test_presto.py::test_convert_dttm[TIMESTAMP-dttm2-TIMESTAMP '2022-01-01 01:23:45.600000'] PASSED [ 13%]
tests/unit_tests/db_engine_specs/test_presto.py::test_convert_dttm[TIMESTAMP WITH TIME ZONE-dttm3-TIMESTAMP '2022-01-01 01:23:45.600000'] PASSED [ 17%]
tests/unit_tests/db_engine_specs/test_presto.py::test_convert_dttm[TIMESTAMP WITH TIME ZONE-dttm4-TIMESTAMP '2022-01-01 01:23:45.600000+00:00'] PASSED [ 21%]
tests/unit_tests/db_engine_specs/test_presto.py::test_get_column_spec[varchar(255)-VARCHAR-attrs0-GenericDataType.STRING-False] PASSED [ 26%]
tests/unit_tests/db_engine_specs/test_presto.py::test_get_column_spec[varchar-String-None-GenericDataType.STRING-False] PASSED [ 30%]
tests/unit_tests/db_engine_specs/test_presto.py::test_get_column_spec[char(255)-CHAR-attrs2-GenericDataType.STRING-False] PASSED [ 34%]
tests/unit_tests/db_engine_specs/test_presto.py::test_get_column_spec[char-String-None-GenericDataType.STRING-False] PASSED [ 39%]
tests/unit_tests/db_engine_specs/test_presto.py::test_get_column_spec[integer-Integer-None-GenericDataType.NUMERIC-False] PASSED [ 43%]
tests/unit_tests/db_engine_specs/test_presto.py::test_get_column_spec[time-Time-None-GenericDataType.TEMPORAL-True] PASSED [ 47%]
tests/unit_tests/db_engine_specs/test_presto.py::test_get_column_spec[timestamp-TIMESTAMP-None-GenericDataType.TEMPORAL-True] PASSED [ 52%]
tests/unit_tests/db_engine_specs/test_presto.py::test_create_column_info[columnVarchar-VARCHAR] PASSED [ 56%]
tests/unit_tests/db_engine_specs/test_presto.py::test_create_column_info[columnString-String] PASSED [ 60%]
tests/unit_tests/db_engine_specs/test_presto.py::test_create_column_info[columnChar-CHAR] PASSED [ 65%]
tests/unit_tests/db_engine_specs/test_presto.py::test_create_column_info[columnInteger-Integer] PASSED [ 69%]
tests/unit_tests/db_engine_specs/test_presto.py::test_create_column_info[columnTime-Time] PASSED [ 73%]
tests/unit_tests/db_engine_specs/test_presto.py::test_create_column_info[columnTimestamp-TIMESTAMP] PASSED [ 78%]

tests/unit_tests/db_engine_specs/test_presto.py::test_get_schema_from_engine_params PASSED [ 82%]
tests/unit_tests/db_engine_specs/test_presto.py::test_where_latest_partition[column_type0-2023-05-01-DATE '2023-05-01'] PASSED [ 86%]
tests/unit_tests/db_engine_specs/test_presto.py::test_where_latest_partition[column_type1-2023-05-01-TIMESTAMP '2023-05-01'] PASSED [ 91%]
tests/unit_tests/db_engine_specs/test_presto.py::test_where_latest_partition[column_type2-2023-05-01-'2023-05-01'] PASSED [ 95%]
tests/unit_tests/db_engine_specs/test_presto.py::test_where_latest_partition[column_type3-1234-1234] PASSED [100%]

============================================================================================================ 23 passed in 0.68s =============================================================================================================

ADDITIONAL INFORMATION

  • [x ] Has associated issue: Fixes Failure on creation of a new Presto dataset due to failure to load columns #25962
  • 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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@rusackas rusackas requested a review from john-bodley May 1, 2024 15:20
@john-bodley
Copy link
Member

@eyalsh99 thanks for the fix. I was wondering whether you did a git blame to try to decipher why we were quoting the type in the past? I agree it seems atypical, but there likely was some pseudo valid reason.

@codecov-commenter
Copy link

codecov-commenter commented May 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.39%. Comparing base (c975f97) to head (38033f2).
Report is 31 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #28305      +/-   ##
==========================================
+ Coverage   60.48%   67.39%   +6.90%     
==========================================
  Files        1931     1933       +2     
  Lines       76236    76494     +258     
  Branches     8568     8568              
==========================================
+ Hits        46114    51553    +5439     
+ Misses      28017    22836    -5181     
  Partials     2105     2105              
Flag Coverage Δ
hive ?
mysql 77.52% <ø> (?)
postgres 77.65% <ø> (?)
presto ?
python 77.78% <ø> (+14.29%) ⬆️
sqlite 77.11% <ø> (?)
unit ?

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rusackas rusackas changed the title Presto create column fix fix: Presto create column fix May 2, 2024
@rusackas rusackas added the data:connect:presto Related to Presto label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure on creation of a new Presto dataset due to failure to load columns
4 participants