v.18.16New Feature

DEFAULT Expressions for Missing Fields in Semi-Structured Formats Enabled by insert_sample_with_metadata Setting

DEFAULT expressions are evaluated for missing fields when loading data in semi-structured input formats (JSONEachRow, TSKV). The feature is enabled with the insert_sample_with_metadata setting. #3555
DEFAULT expressions are now evaluated for missing fields when loading data using semi-structured input formats like JSONEachRow and TSKV.

Why it matters

This feature ensures that when data is loaded and certain fields are missing in semi-structured formats, the respective DEFAULT expressions are automatically applied. This improves data consistency and simplifies data ingestion workflows by eliminating the need for manual handling of missing values.

How to use it

Enable this feature by setting the insert_sample_with_metadata setting to true during data insertion with formats such as JSONEachRow or TSKV. For example:

SET insert_sample_with_metadata = 1;
INSERT INTO table_name FORMAT JSONEachRow ...