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
[python] Parquet read path #407
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few minor comments. I tried running the tox tests and there were a number of minor lint issues for formatting and a few of the tests weren't passing with issues around decimal and double.
python/iceberg/api/file_format.py
Outdated
ORC = "orc" | ||
PARQUET = "parquet" | ||
AVRO = "avro" | ||
ORC = "orc", True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be more clear to use a dictionary here to make it clear what these values mean:
e.g.:
ORC = dict(extension = "orc", splittable=True)
PARQUET = dict(extension = "parquet", splittable=True)
AVRO = dict(extension = "avro", splittable=True)
I had to read through the code to understand what these meant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right fixed the test and lint errors. I agree that it's better to be explicit about the enum attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added a test for file format just for good measure
processing_func = process_funcs.get(field.type.type_id) | ||
|
||
if processing_func is None: | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear on how we are dealing with values that are not in the avro record here. In the case that an optional field is not in the avro record, we should emit "null", but it appears that we always fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me think through this. I had refactored this code and I think I just left out the .is_required check on that raise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added in the is_required check to the raise and also tweaked the get map function to follow the pattern of the rest of the functions eg use bracket with a try block instead of get.
I'm going to write up some tests for the avro module to explicitly test some of these cases. Not sure if you want to wait on the merge for this or not
4fcf04a
to
5f71879
Compare
5f71879
to
57721d7
Compare
+1 LGTM. Thanks Ted
First part of commit to add in read support for parquet format.