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 schema violation for timezone data (#259) #278

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

Conversation

lr4d
Copy link
Collaborator

@lr4d lr4d commented Apr 14, 2020

Supersedes #260

I tried to rebase this branch on top of master but it was quite the adventure to do so.
I excluded the changes to the changelog and it seems like some removal of comments is also missing, but the important parts should be there.

cc @ged-steponavicius

@codecov
Copy link

codecov bot commented Apr 14, 2020

Codecov Report

Merging #278 into master will decrease coverage by 0.01%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #278      +/-   ##
==========================================
- Coverage   89.88%   89.86%   -0.02%     
==========================================
  Files          39       39              
  Lines        3746     3749       +3     
  Branches      911      915       +4     
==========================================
+ Hits         3367     3369       +2     
  Misses        223      223              
- Partials      156      157       +1     
Impacted Files Coverage Δ
kartothek/core/common_metadata.py 95.17% <93.33%> (-0.22%) ⬇️
kartothek/core/testing.py 73.43% <100.00%> (-1.57%) ⬇️

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 ba6215e...b7ea769. Read the comment docs.

@lr4d lr4d changed the title WIP: Tz bug fix rebased Fix schema violation for timezone data (#259) Apr 14, 2020
@lr4d lr4d marked this pull request as ready for review April 14, 2020 13:45
@@ -78,6 +77,35 @@ def _schema_compat(self):

schema = schema.remove_metadata()
md = {b"pandas": _dict_to_binary(pandas_metadata)}
# https://github.com/JDASoftwareGroup/kartothek/issues/259

if schema is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

why can it be None here? 3 lines above we just call schema = schema.remove_metadata(). Can this return None?


if schema is not None:
fields = []
for f in schema:
Copy link
Contributor

Choose a reason for hiding this comment

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

short comment before the entire massaging would be nice. This function just does more and more and it is hard to follow along.


fields.append(f)
return pa.schema(fields, schema.metadata)
return schema
Copy link
Contributor

Choose a reason for hiding this comment

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

a direct return from the line above would work now as well.

@@ -53,4 +52,7 @@ def test_arrow_compat(arrow_version, reference_store, mocker):
if arrow_version in ("0.14.1", "0.15.0", "0.16.0") and not ARROW_LARGER_EQ_0141:
orig = orig.astype({"null": float})

if LooseVersion(arrow_version) < "0.13.0":
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a short comment on the reason? Is this because timezones cannot be preserved with these old versions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the changes from @ged-steponavicius fixes #259, enabling proper compatibilty of datetimes with timezones i.e. these columns, and we currently only support pyarrow >= 0.13.0

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then why do we need to check < "0.13.0": That's dead code, isn't it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

arrow_version here refers to the arrow version with which the reference data file was created

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
if LooseVersion(arrow_version) < "0.13.0":
if LooseVersion(arrow_version) < "0.13.0": # gh-259: compatibilty of datetimes with timezones only supported in kartothek versions with pyarrow >= 0.13.0

Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion looks good to me, thanks :)

@lr4d
Copy link
Collaborator Author

lr4d commented Apr 16, 2020

This PR now also includes the appropriate changelog entry and I added some commits to update the reference Parquet files.

@ged-steponavicius feel free to push to this branch if you'd like to address the review comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants