Repository navigation
fix(ENGKNOW-4019): return default dictionary header for nor -asdict on an empty dictionary - #155
Merged
Merged
Conversation
…n an empty dictionary A dictionary with no entries is a valid state, but nor -asdict on a 0-byte .gord/.nord failed with "Input source contains no header", and a file with only blank lines gave a one-column header (col1). Any query reading such a dictionary failed, e.g. gregor_sm_gb_track_dicts for long-read projects where del/me/sma/rep_varcalls.gord are created empty. NorInputSource takes an optional default header. For -asdict on a .gord or .nord, Nor passes the file header from the dictionary's .meta if present, otherwise the dictionary type's default header. With a default header, empty lines are skipped and an input with no lines reports the default header with no rows. Non-dictionary inputs and non-empty dictionaries are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
gmagnu
marked this pull request as ready for review
October 7, 2026 23:43
bragnarsson
approved these changes
Oct 8, 2026
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.
Problem
A dictionary with no entries is valid, but
nor -asdictcould not read one:Input source contains no headercol1, blank rows.gord.metaInput source contains no header.meta, 0 rowscol1 col2 …nor x.tsv)Input source contains no headerAny query that reads an empty dictionary with
nor -asdictfailed. When it was one step of a merged script, the whole script failed.Change
NorInputSource/NoValidateNorInputSourcetake an optionaldefaultHeader. When it is set, empty lines are skipped, and an input with no lines reports that header with no rows. A secondary 8-arg constructor keeps the Java callers unchanged.Nor: for-asdicton a.gord/.nord, the default header is the file header from<dict>.metaif present, otherwiseGorDictionaryTableMeta.DEFAULT_TABLE_HEADER/NorDictionaryTableMeta.DEFAULT_TABLE_HEADER.Testing
UTestNorDictionary: 0-byte.gord, blank-line.gord, empty.gordwith.meta, empty.nord, an empty dict used positionally downstream (inset -c #2 … | rename #2 …), a non-empty headerless dict (unchanged), and an empty non-dictionary file (still throws). Before the fix 5 of these failed; now all pass../gradlew :gortools:test :gortools:testScala: 2661 tests, 0 failures.🤖 Generated with Claude Code