Skip to content

Fix#9041 YAML input list-of-maps reading and null-path failures - #9082

Merged
bamaer merged 2 commits into
apache:mainfrom
leehaut:hotfix/lance-common-46
Oct 23, 2026
Merged

bamaer merged 2 commits into
apache:mainfrom
leehaut:hotfix/lance-common-46

Conversation

@leehaut

@leehaut leehaut commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Fix #9041

YAML Input stopped after the first element of a list of maps, and threw a NullPointerException when a field path matched nothing or when every file was empty and "Ignore empty file" was selected. Labels and tooltips for that transform also described the wrong behavior.

A list of maps is now read to the end. $.id and $[*].id both return one row per element. A missing path becomes a null field instead of failing the transform. Skipping empty files walks the file list and finishes normally when nothing remains to read. English and Chinese labels now match this behavior: the result-files label says "filenames", the row-number field is an Integer, and the Required and Ignore empty file tooltips no longer describe wildcard handling or empty files incorrectly.

The existing YAML integration tests cover map documents, wildcard paths on a map, plain value lists, multiple documents, and YAML stored in a field. Those paths are unchanged. New unit tests cover a list of maps, a missing path, a single empty file, and an empty file followed by a file with content.

Verification

Ran the three pipelines with the Local Pipeline Engine:

  • list-of-maps: a list of maps returns Anna, Ben, and Chris (3 rows, 0 errors). A plain list still returns Spark, Flink, and Beam (3 rows, 0 errors).
  • missing-path: $.nope returns one row, id = 1 and missing = null, and the pipeline finishes with 0 errors.
  • ignore-empty-file: the only file is empty and "Ignore empty file" is selected. The log reports that the file is empty, no rows are written, and the pipeline finishes with no error.

Unit tests

YamlReaderTests covers a list of maps with $.id / $.name and with $[*].id / $[*].name, and a missing path that becomes null.

YamlInputTests covers the same list of maps and missing path through processRow, plus "Ignore empty file" for one empty file and for an empty file followed by a file with rows.

Signed-off-by: leehaut <leehaut@gmail.com>
@bamaer

bamaer commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Thanks for yet another great fix @leehaut! This covers all the cases from #9041. I built the plugin and ran the unit tests: all 52 pass, and the 7 new ones fail on main without the fix. I also tried nested wildcards inside list elements, missing fields in one element and empty elements, and they all give the expected rows. I didn't run the sample pipelines.

Should fix

  • A list of maps split over several YAML documents still stops after the first document. - id: 1\n- id: 2\n---\n- id: 3\n- id: 4 gives rows 1 and 2 only. Plain lists already behave this way on main: once a list document is used up, getRow returns an empty row, and YamlInput reads that as the end of the file. A one-line change in YamlReader.getRow (YamlReader.java:169) fixes both cases, and the existing tests still pass:
    if (row.length == 0 && (!isFinishedDocument() || documentIt.hasNext())) {
    A test with two list-of-maps documents would cover it.

Signed-off-by: leehaut <leehaut@gmail.com>
@leehaut

leehaut commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @bamaer

getRow now keeps reading when the empty row finishes a list document and another document remains. testListOfMaps_readsEveryDocument covers the two-document list of maps (ids 1–4, then the empty end row). YamlReaderTests: 20 tests, all passing.

@bamaer
bamaer merged commit da19d92 into apache:main Oct 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: YAML Input reads only the first element of a list of maps, and fails with a NullPointerException on a missing path or empty files

3 participants