v.19.8Improvements

Added Functions Jsonextractraw, Jsonextractkeyandvalues

Added functions JSONExtractRaw, JSONExtractKeyAndValues. Renamed functions jsonExtract<type> to JSONExtract<type>. When something goes wrong these functions return the correspondent values, not NULL. Modified function JSONExtract, now it gets the return type from its last parameter and does not inject nullables. Implemented fallback to RapidJSON in case AVX2 instructions are not available. Simdjson library updated to a new version. #5235 (Vitaly Baranov)
Introduced new JSON extraction functions JSONExtractRaw and JSONExtractKeyAndValues, renamed existing JSON extraction functions to PascalCase (JSONExtract<Type>), improved error handling to return fallback values instead of NULL, updated JSONExtract to infer return type from its last parameter without injecting nullable types, and added fallback to RapidJSON when AVX2 instructions are unavailable. The simdjson library was also updated.

Why it matters

These enhancements improve JSON parsing robustness and consistency in ClickHouse by providing new utility functions, better error handling that avoids NULL results on failure, and compatibility across different CPU architectures by falling back to RapidJSON if AVX2 is unsupported. This ensures more reliable JSON data processing and easier use of JSON functions.

How to use it

Use the new functions JSONExtractRaw to retrieve raw JSON data and JSONExtractKeyAndValues to extract keys and values from JSON. Replace calls to old jsonExtract<type> functions with the renamed JSONExtract<Type> variants. When using JSONExtract, provide the desired return type as the last argument to avoid nullable injection. The fallback to RapidJSON and simdjson update happen transparently without user intervention.