fix(steps): make field_pack target resource re-readable - #1793
Open
Sanjays2402 wants to merge 1 commit into
Open
fix(steps): make field_pack target resource re-readable#1793Sanjays2402 wants to merge 1 commit into
Sanjays2402 wants to merge 1 commit into
Conversation
field_pack assigned the generator returned by iterpack/iterpackdict directly to resource.data. A generator is exhausted after one pass, so the transformed resource yielded its rows only on the first read and returned zero rows on every subsequent read_rows()/validate() call (and the source resource, which shares the underlying petl view, was drained with it). Assign a functools.partial instead: the inline parser already calls a non-iterable data value to obtain a fresh iterator, so each read starts a new generator. Closes frictionlessdata#1476
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
field_packassigned the generator returned byiterpack/iterpackdictstraight toresource.data. A generator is exhausted after one pass, so the transformed resource returned its rows on the firstread_rows()and zero rows on every later read (and drained the source resource with it). Assigning afunctools.partialinstead makes each read start a fresh generator — the inline parser already calls a non-iterabledatavalue to get its iterator.Added a regression test that reads the packed resource twice; it fails on
mainand passes with the fix.