Fix Snowflake external table 0-row bug with flat JSON array format - #328
Draft
concaf wants to merge 4 commits into
Draft
Fix Snowflake external table 0-row bug with flat JSON array format#328concaf wants to merge 4 commits into
concaf wants to merge 4 commits into
Conversation
…y format Snowflake's VARIANT type has a 16MB per-row limit. The current format writes each stage's output as a single JSON object (e.g., 195MB for embeddings), which exceeds this limit and causes external tables to silently return 0 rows despite files being registered. Switch all pipeline stages (converted, chunks, embeddings) to output JSON arrays of flat row objects. With STRIP_OUTER_ARRAY=TRUE already configured on the external tables, each array element becomes its own row, keeping VARIANT values well under the 16MB limit. All readers handle both old (single-object) and new (array) formats for backward compatibility during migration.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The nilerr linter flags cases where a non-nil error is returned as nil. In these fallback unmarshal paths, returning nil error is intentional — an unparseable file means it should be re-processed, not that the reconciler failed.
The nilerr linter flags the return line, not the if line, so the directive must be on the return statement to suppress the warning.
The nilerr linter does not fire on this line, so the nolint directive triggers nolintlint for being unnecessary.
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
EXTERNAL_TABLE_FILE_REGISTRATION_HISTORY.STRIP_OUTER_ARRAY=TRUEalready set on the external tables, each array element becomes its own row (~10KB each), well under the 16MB limit.ConvertedRow,ChunkRow,EmbeddingRow) and update all controllers to write the new format while reading both old and new formats for backward compatibility.Companion DPO MR: Updates materialized views to read the flat row format (no more LATERAL FLATTEN needed).
Test plan
aiftestgdrivear)select count(*) from <db>.staging.embeddings_ext_tblreturns > 0select count(*) from <db>.staging.chunks_ext_tblreturns > 0EMBEDDINGS_MV,CHUNKS_MV,CONVERTED_MV) return correct data