Fix DuckDB source to handle single-valued category fields#529
Closed
kevinschaper wants to merge 1 commit into
Closed
Fix DuckDB source to handle single-valued category fields#529kevinschaper wants to merge 1 commit into
kevinschaper wants to merge 1 commit into
Conversation
When reading from DuckDB, the category field may be stored as a single string value rather than a list. This caused graph-summary to iterate character-by-character over the string, resulting in empty category statistics. This fix ensures category is always converted to a list: - Single string values are wrapped in a list - Pipe-delimited strings are split into multiple categories - Non-list/non-string values are converted to string and wrapped 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4 tasks
Collaborator
Author
|
I had forgotten about this, I don't think it turned out to be necessary |
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.
Summary
DuckDbSource.process_node()to ensure category is always returned as a listProblem
When reading from DuckDB databases where
categoryis stored as a single string value (e.g.,"biolink:Gene"rather than a list), thegraph-summarycommand produced empty node category statistics.The issue was that
GraphSummary.analyse_node()iterates overcategories, and when passed a string instead of a list, it iterates character-by-character, resulting in invalid single-character "categories" that fail validation.Solution
Convert category to a list in
process_node():["biolink:Gene"]["biolink:Gene", "biolink:NamedThing"]Test plan
kgx graph-summarynow produces proper category breakdowns🤖 Generated with Claude Code