An Azure real-time analytics service designed for mission-critical workloads.
- For Parquet outputs, nested JSON record fields must have a stable, strongly typed schema in the query projection. Avro and Parquet are schema-on-write formats and don’t support variable or loosely typed schemas within a single file. If the projected schema changes row by row, or if a field is treated as a generic
record/arraywithout a fixed structure, rows can be rejected or values can be written as null. The recommended approach is to:- Explicitly project the nested fields as separate scalar columns (for example,
after.id,after.field1,source.db, etc.) using dot notation, so that the Parquet schema is uniform and strongly typed. - Avoid passing the entire
recordobject (after,source,before) as a singlerecord-typed column to Parquet.
This aligns with the guidance that Avro/Parquet outputs should be treated as strongly typed and that queries should use explicit projections and conversions to ensure a uniform schema.SELECT after.id AS after_id, after.field1 AS after_field1, after.field2 AS after_field2, after.field3 AS after_field3, source.version AS source_version, source.db AS source_db, source.table AS source_table, op, ts_ms INTO ParquetOutput FROM input - Explicitly project the nested fields as separate scalar columns (for example,
-
TRY_CASTtorecordis not a supported way to produce Parquet output. For Avro and Parquet, the documentation states that these formats should be considered strongly typed and schema-on-write, and that queries should be written with explicit conversions and projections for a uniform schema. There is no documented support for emitting genericrecord-typed columns directly into Parquet; instead, nested JSON objects should be parsed and flattened into scalar columns before writing to Parquet. In particular, the data type mapping table shows thatrecordis represented as a JSON object for JSON in/out and as an Avro record type for Avro in/out, but it does not describerecordas a first-class Parquet output type. For Parquet, the guidance is to avoid variable schemas and use explicit conversions. - Behavior changes that affect nested types in Parquet output aren’t documented in the provided material. What is documented is:
- Avro and Parquet outputs don’t support variable schemas within a single file; schema changes can cause file splitting or row rejection.
- Outputs using these formats should be treated as strongly typed, with explicit conversions and projections.
- Parse nested JSON (
record) fields using dot notation or helper functions where needed. - Project only scalar (or otherwise well-defined) columns into the Parquet output.
- If the full nested structure is required, keep a parallel JSON output where
recordandarraytypes are natively supported.
References: