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(explore): Add int and bool regex pattern #13621

Merged
merged 3 commits into from
Mar 17, 2021

Conversation

nikolagigic
Copy link
Contributor

SUMMARY

Adding postgres regex pattern for integer and boolean type columns.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

Comment on lines 102 to 111
(
re.compile(r"^int.*", re.IGNORECASE),
INTEGER(),
utils.GenericDataType.NUMERIC,
),
(
re.compile(r"^bool.*", re.IGNORECASE),
BOOLEAN(),
utils.GenericDataType.BOOLEAN,
),
Copy link
Member

Choose a reason for hiding this comment

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

I think these should be put in BaseEngineSpec (to replace integer and boolean respectively), as they're both fairly commonly used type names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is specific to Postgres Dialect https://github.com/apache/superset/pull/13621/files#diff-8cec2642bdfebf02492bfb132c78133c229f409661a4e56c8ea96868a1afd63fR37
so keeping them separate like this might be better idea unless you think it's not needed?

Copy link
Member

Choose a reason for hiding this comment

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

I know INT is at least used in SQL Server and a synonym on Snowflake, and I don't know of any commonly used type names that would cause a collision with the shorter regexes, so I still feel like these should be in the base engine spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, will make a change

assert CrateEngineSpec.convert_dttm("TIMESTAMP", dttm) == "1546398245678.9"
assert CrateEngineSpec.convert_dttm("TIMESTAMP", dttm) == "1546394645678.9"
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be changed back to UTC (I need to look into how to make this always render the timestamp as UTC despite local timezone).

@codecov
Copy link

codecov bot commented Mar 15, 2021

Codecov Report

Merging #13621 (640a98b) into master (ae66f5f) will decrease coverage by 5.93%.
The diff coverage is 13.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13621      +/-   ##
==========================================
- Coverage   77.05%   71.12%   -5.94%     
==========================================
  Files         911      829      -82     
  Lines       46380    41512    -4868     
  Branches     5615     4332    -1283     
==========================================
- Hits        35740    29524    -6216     
- Misses      10500    11988    +1488     
+ Partials      140        0     -140     
Flag Coverage Δ
cypress 56.56% <13.13%> (+1.83%) ⬆️
hive 80.04% <ø> (-0.01%) ⬇️
javascript ?
mysql 80.35% <ø> (ø)
postgres 80.40% <ø> (-0.01%) ⬇️
presto 80.08% <ø> (-0.01%) ⬇️
python 80.91% <ø> (ø)
sqlite 80.02% <ø> (ø)

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

Impacted Files Coverage Δ
...nativeFilters/FilterBar/FilterSets/EditSection.tsx 13.51% <0.00%> (-22.05%) ⬇️
...tiveFilters/FilterBar/FilterSets/FilterSetUnit.tsx 18.75% <0.00%> (-22.16%) ⬇️
.../nativeFilters/FilterBar/FilterSets/FilterSets.tsx 4.54% <0.00%> (-13.77%) ⬇️
...ents/nativeFilters/FilterBar/FilterSets/Footer.tsx 21.42% <0.00%> (-34.83%) ⬇️
...onents/nativeFilters/FilterBar/FilterSets/utils.ts 18.18% <0.00%> (-9.41%) ⬇️
superset-frontend/src/dataMask/actions.ts 100.00% <ø> (+28.57%) ⬆️
superset-frontend/src/dataMask/reducer.ts 100.00% <ø> (ø)
superset/db_engine_specs/base.py 86.16% <ø> (ø)
...tiveFilters/FilterBar/FilterSets/FiltersHeader.tsx 11.11% <5.55%> (-28.02%) ⬇️
...onents/nativeFilters/FilterBar/FilterSets/state.ts 11.11% <11.11%> (ø)
... and 500 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae66f5f...11c8766. Read the comment docs.

@nikolagigic nikolagigic force-pushed the fix/postgres_regex_strings branch from bdef61d to 11c8766 Compare March 15, 2021 13:51
@junlincc junlincc added the explore:dataset Related to the dataset of Explore label Mar 15, 2021
@villebro villebro changed the title fix(explore): Add postgres int and bool regex pattern fix(explore): Add int and bool regex pattern Mar 17, 2021
@villebro villebro merged commit aa0cd64 into apache:master Mar 17, 2021
allanco91 pushed a commit to allanco91/superset that referenced this pull request May 21, 2021
* fix postgres regex string for bool and int

* move regex from postgres to bae

* move regex from postgres to base
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
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 explore:dataset Related to the dataset of Explore size/XS 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants