100132 data data_error ai_generated true

Snowflake:解析JSON错误 — 对象大小超过16777216字节的最大长度

Snowflake: Error parsing JSON — Object size exceeds maximum length of 16777216 bytes

ID: data/snowflake-semi-structured-field-exceeds-limit

其他格式: JSON · Markdown 中文 · English
85%修复率
88%置信度
1证据数
2023-06-01首次发现

版本兼容性

版本状态引入弃用备注
Snowflake 7.0 active
Snowflake 8.0 active

根因分析

VARIANT列中的单个JSON对象超过了Snowflake中半结构化数据字段的16 MB大小限制。

English

A single JSON object in a VARIANT column exceeds the 16 MB size limit for semi-structured data fields in Snowflake.

generic

官方文档

https://docs.snowflake.com/en/sql-reference/data-types-semistructured#size-limits

解决方案

  1. 将大的JSON对象拆分为多个较小的对象(例如,对象数组),并使用FLATTEN函数将其加载为单独的行。
  2. 将JSON存储为TEXT列(VARCHAR)而非VARIANT,仅在查询较小的子集时使用PARSE_JSON()。

无效尝试

常见但无效的做法:

  1. Increasing the VARIANT column size or using a different data type like TEXT 100% 失败

    Snowflake's semi-structured limit is a hard limit; changing column type does not bypass it.

  2. Compressing the JSON data before loading 80% 失败

    Compression reduces storage but the parsed object size remains the same; the limit is on the parsed object, not the file.