You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "villebro (via GitHub)" <gi...@apache.org> on 2023/01/26 14:16:39 UTC
[GitHub] [superset] villebro opened a new pull request, #22871: Villebro/column spec
villebro opened a new pull request, #22871:
URL: https://github.com/apache/superset/pull/22871
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] commented on pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by codecov.
codecov[bot] commented on PR #22871:
URL: https://github.com/apache/superset/pull/22871#issuecomment-1405104105
# [Codecov](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#22871](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1112b07) into [master](https://codecov.io/gh/apache/superset/commit/f8edcd7ae2f1a716505327770b5abaa7691c784a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f8edcd7) will **decrease** coverage by `11.02%`.
> The diff coverage is `100.00%`.
> :exclamation: Current head 1112b07 differs from pull request most recent head 1e07195. Consider uploading reports for the commit 1e07195 to get more accurate results
```diff
@@ Coverage Diff @@
## master #22871 +/- ##
===========================================
- Coverage 67.21% 56.20% -11.02%
===========================================
Files 1879 1879
Lines 72093 72096 +3
Branches 7897 7897
===========================================
- Hits 48459 40521 -7938
- Misses 21606 29547 +7941
Partials 2028 2028
```
| Flag | Coverage Δ | |
|---|---|---|
| mysql | `?` | |
| postgres | `?` | |
| presto | `52.49% <30.11%> (-0.04%)` | :arrow_down: |
| python | `58.75% <100.00%> (-22.98%)` | :arrow_down: |
| sqlite | `?` | |
| unit | `52.42% <100.00%> (+0.77%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/db\_engine\_specs/trino.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3RyaW5vLnB5) | `79.03% <ø> (-5.30%)` | :arrow_down: |
| [superset/utils/core.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvY29yZS5weQ==) | `64.95% <ø> (-25.84%)` | :arrow_down: |
| [superset/db\_engine\_specs/athena.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2F0aGVuYS5weQ==) | `93.54% <100.00%> (+3.54%)` | :arrow_up: |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `75.65% <100.00%> (-14.25%)` | :arrow_down: |
| [superset/db\_engine\_specs/bigquery.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2JpZ3F1ZXJ5LnB5) | `51.98% <100.00%> (-17.74%)` | :arrow_down: |
| [superset/db\_engine\_specs/clickhouse.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2NsaWNraG91c2UucHk=) | `69.09% <100.00%> (+2.42%)` | :arrow_up: |
| [superset/db\_engine\_specs/crate.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2NyYXRlLnB5) | `96.42% <100.00%> (+4.12%)` | :arrow_up: |
| [superset/db\_engine\_specs/dremio.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2RyZW1pby5weQ==) | `95.23% <100.00%> (+5.23%)` | :arrow_up: |
| [superset/db\_engine\_specs/drill.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2RyaWxsLnB5) | `88.09% <100.00%> (+2.72%)` | :arrow_up: |
| [superset/db\_engine\_specs/druid.py](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2RydWlkLnB5) | `82.53% <100.00%> (-0.80%)` | :arrow_down: |
| ... and [326 more](https://codecov.io/gh/apache/superset/pull/22871?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] github-actions[bot] commented on pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by github-actions.
github-actions[bot] commented on PR #22871:
URL: https://github.com/apache/superset/pull/22871#issuecomment-1408942425
@geido Ephemeral environment spinning up at http://34.221.182.253:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] villebro commented on a diff in pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #22871:
URL: https://github.com/apache/superset/pull/22871#discussion_r1091954803
##########
tests/unit_tests/db_engine_specs/test_presto.py:
##########
@@ -46,9 +53,32 @@
def test_convert_dttm(
target_type: str,
dttm: datetime,
- result: Optional[str],
+ expected_result: Optional[str],
+) -> None:
+ from superset.db_engine_specs.presto import PrestoEngineSpec as spec
+
+ assert_convert_dttm(spec, target_type, expected_result, dttm)
+
+
+@pytest.mark.parametrize(
+ "native_type,sqla_type,attrs,generic_type,is_dttm",
+ [
+ ("varchar(255)", types.VARCHAR, {"length": 255}, GenericDataType.STRING, False),
+ ("varchar", types.String, None, GenericDataType.STRING, False),
+ ("char(255)", types.CHAR, {"length": 255}, GenericDataType.STRING, False),
+ ("char", types.String, None, GenericDataType.STRING, False),
+ ("integer", types.Integer, None, GenericDataType.NUMERIC, False),
+ ("time", types.Time, None, GenericDataType.TEMPORAL, True),
+ ("timestamp", types.TIMESTAMP, None, GenericDataType.TEMPORAL, True),
Review Comment:
I only ported over the current tests from the old `presto_tests.py` which apparently didn't have a test for `DATE`. However, notice that we're testing for it in `convert_dttm` above, so it's working at least. Once this is merged I'm hoping I can do a few more rounds of improving coverage.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] villebro merged pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro merged PR #22871:
URL: https://github.com/apache/superset/pull/22871
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] villebro commented on a diff in pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #22871:
URL: https://github.com/apache/superset/pull/22871#discussion_r1089225837
##########
superset/db_engine_specs/athena.py:
##########
@@ -66,10 +66,12 @@ class AthenaEngineSpec(BaseEngineSpec):
def convert_dttm(
cls, target_type: str, dttm: datetime, db_extra: Optional[Dict[str, Any]] = None
) -> Optional[str]:
- tt = target_type.upper()
- if tt == utils.TemporalType.DATE:
+ column_spec = cls.get_column_spec(target_type)
+ sqla_type = column_spec.sqla_type if column_spec else None
Review Comment:
That's a good idea 👍 I'll do that
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] geido commented on pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by "geido (via GitHub)" <gi...@apache.org>.
geido commented on PR #22871:
URL: https://github.com/apache/superset/pull/22871#issuecomment-1408939157
/testenv up
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] github-actions[bot] commented on pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by github-actions.
github-actions[bot] commented on PR #22871:
URL: https://github.com/apache/superset/pull/22871#issuecomment-1410399598
Ephemeral environment shutdown and build artifacts deleted.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] dpgaspar commented on a diff in pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar commented on code in PR #22871:
URL: https://github.com/apache/superset/pull/22871#discussion_r1089123252
##########
superset/db_engine_specs/athena.py:
##########
@@ -66,10 +66,12 @@ class AthenaEngineSpec(BaseEngineSpec):
def convert_dttm(
cls, target_type: str, dttm: datetime, db_extra: Optional[Dict[str, Any]] = None
) -> Optional[str]:
- tt = target_type.upper()
- if tt == utils.TemporalType.DATE:
+ column_spec = cls.get_column_spec(target_type)
+ sqla_type = column_spec.sqla_type if column_spec else None
Review Comment:
we could DRY these up with something simple like `cls.get_column_sqla_type`
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] dpgaspar commented on a diff in pull request #22871: chore(db_engine_specs): clean up column spec logic and add tests
Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar commented on code in PR #22871:
URL: https://github.com/apache/superset/pull/22871#discussion_r1091688643
##########
tests/unit_tests/db_engine_specs/test_presto.py:
##########
@@ -46,9 +53,32 @@
def test_convert_dttm(
target_type: str,
dttm: datetime,
- result: Optional[str],
+ expected_result: Optional[str],
+) -> None:
+ from superset.db_engine_specs.presto import PrestoEngineSpec as spec
+
+ assert_convert_dttm(spec, target_type, expected_result, dttm)
+
+
+@pytest.mark.parametrize(
+ "native_type,sqla_type,attrs,generic_type,is_dttm",
+ [
+ ("varchar(255)", types.VARCHAR, {"length": 255}, GenericDataType.STRING, False),
+ ("varchar", types.String, None, GenericDataType.STRING, False),
+ ("char(255)", types.CHAR, {"length": 255}, GenericDataType.STRING, False),
+ ("char", types.String, None, GenericDataType.STRING, False),
+ ("integer", types.Integer, None, GenericDataType.NUMERIC, False),
+ ("time", types.Time, None, GenericDataType.TEMPORAL, True),
+ ("timestamp", types.TIMESTAMP, None, GenericDataType.TEMPORAL, True),
Review Comment:
`date` etc? do these mean superset will only support these Presto types?
prob a silly question but do these come from: https://github.com/dropbox/PyHive/blob/master/pyhive/sqlalchemy_presto.py#L30?
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org