Achata JSON do multi_format_api com underscore para colunas compatíveis com DuckDB#91
Merged
gabrielbressan-tfy merged 1 commit intoJul 9, 2026
Conversation
json_normalize used a dot separator, producing columns like `day.c`. MindsDB runs projections through DuckDB, where a dotted name is parsed as a struct/table qualifier (column `c` of `day`) instead of a column literally named "day.c" — and no quoting form (backticks/double quotes) survives that rewrite, so the column becomes unselectable. Switch to sep='_' (matching the XML path) so nested fields flatten to day_c / prevDay_c, which are plain, selectable identifiers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Contexto
O handler
multi_format_apiexplode o array de registros de uma resposta JSON em linhas e achata os objetos aninhados em colunas. O achatamento usava separador de ponto (json_normalize(sep='.')), gerando nomes comoday.c,prevDay.c.Esses nomes são inutilizáveis no caminho de consulta do MindsDB. A projeção é executada via DuckDB, e um nome com ponto é interpretado como qualificador de struct/tabela (coluna
cdeday) em vez de uma coluna chamada literalmenteday.c. Nenhuma forma de citação resolve: aspas duplas viram literais de string e crases são removidas no rewrite antes da execução. Resultado observado em staging:Binder Error: Referenced column "c" not found.O que foi implementado
Troca o separador do
json_normalizede ponto para underscore no caminho JSON, alinhando ao caminho XML que já fazia isso. Campos aninhados passam a virarday_c,prevDay_c,lastQuote_P— identificadores simples e selecionáveis diretamente, sem ambiguidade de citação.A mudança cobre tanto a explosão de registros quanto o fallback de objeto único (auto_explode desligado), para manter a convenção consistente.
Arquitetura e decisões
Pontos de atenção para review
day_c/prevDay_c/lastQuote_P, sem nomes com ponto.🤖 Generated with Claude Code