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

AVRO-2432: Handle Empty Datafiles #691

Merged
merged 1 commit into from Oct 28, 2019

Conversation

kojiromike
Copy link
Contributor

Fix DataFileReader so it can handle datafiles with zero blocks in them. I refactored David Beswick's patch in the ticket to close out two old TODOs in the DataFileReader iterator implementation.

Jira

  • My PR addresses AVRO-2432
  • My PR references the ticket in the PR title.
  • My PR does not add any dependencies.

Tests

  • My PR adds a test case for a datafile with an empty file data block.

Commits

Documentation

  • My PR fixes a bug in the python implementations and does not require a change to documentation.

@@ -403,10 +403,6 @@ def __exit__(self, type, value, traceback):
def __iter__(self):
return self

def __next__(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Did not know that Python would allow having a method implemented twice 😱

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's basically just a dictionary. One eats the next one. :(

>>> class foo(object):
...   def hello(self):
...     print('i am hello1')
...   def hello(self):
...     print('i am hello2')
>>> import pprint
>>> pprint.pprint(foo.__dict__)
mappingproxy({'__dict__': <attribute '__dict__' of 'foo' objects>,
              '__doc__': None,
              '__module__': '__main__',
              '__weakref__': <attribute '__weakref__' of 'foo' objects>,
              'hello': <function foo.hello at 0x7f450cd85f28>})

@kojiromike kojiromike merged commit 7d87cde into apache:master Oct 28, 2019
@kojiromike kojiromike deleted the AVRO-2432/empty-datafile branch October 28, 2019 19:35
timjroberts pushed a commit to timjroberts/avro that referenced this pull request Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants