Repository navigation
Conversation
d50b717 to
7363408
Compare
theory
left a comment
There was a problem hiding this comment.
This looks very useful, and simpler than the earlier PRs, thank you!
I rebased and made some tweaks, but have a few more questions about the code and some changes to make.
I also tried using body::jsonb instead of jsonb_in(body::cstring); shouldn't that work, as well? Also CAST(body AS jsonb).
|
|
||
| document = serialized_json_document((Expr*)linitial(fe->args)); | ||
| if (document != NULL) { | ||
| if (cdef->cf_type != CF_JSON_EXTRACT_PATH_TEXT || |
There was a problem hiding this comment.
Why not allow CF_JSON_EXTRACT_PATH, too?
| } | ||
| input = (FuncExpr*)expr; | ||
| if ((input->funcid != F_JSON_IN && input->funcid != F_JSONB_IN) || | ||
| (input->funcresulttype != JSONOID && input->funcresulttype != JSONBOID) || |
There was a problem hiding this comment.
Don't json_in() and jsonb_in() return JSON and JSONB by definition? This line seems redundant.
| if (!IsA(argument, CoerceViaIO) || | ||
| ((CoerceViaIO*)argument)->resulttype != CSTRINGOID) { | ||
| return NULL; |
There was a problem hiding this comment.
json_in() and jsonb_in() take a cstring argument by definition, no? Again seems redundant.
| return NULL; | ||
| } | ||
| argument = ((CoerceViaIO*)argument)->arg; | ||
| return exprType((Node*)argument) == TEXTOID ? argument : NULL; |
There was a problem hiding this comment.
We only ever allow TEXT to be converted to a cstring? What about bytea, character, or varchar?
| static bool | ||
| serialized_json_path_is_shippable(Const* path) { |
There was a problem hiding this comment.
Could use a comment to explain that a numeric value is not usable for ClickHouse JSON path expressions, so this function prevents them from being pushed down.
| } | ||
|
|
||
| static void | ||
| append_serialized_json_function( |
There was a problem hiding this comment.
Please add doc comments for each new function. TIA!
Compatibility views often expose a ClickHouse String as PostgreSQL json/jsonb through `json[b]_in(text::cstring)`. Teach json/jsonb `extract_path_text` to recognize that exact wrapper and puh them down to ClickHouse JSON functions when called with constant, non-numeric paths. The mapping preserves SQL NULL, missing keys, JSON null, empty strings, scalars, objects, nested paths, and invalid-JSON errors. Numeric and empty path components, non-text extraction, and non-constant paths remain local where semantics cannot be mapped safely. Tests include Cyrillic `ILIKE` pushdown and json/jsonb result semantics.
7363408 to
5bf1a1e
Compare
|
Sorry for the long silence on this one. To answer your question about
Treating a The test view now uses None of this is pushed yet, and your six inline comments are still open. I'll address them in the same push. |
Compatibility views often expose a ClickHouse String as PostgreSQL json/jsonb through json[b]_in(text::cstring). This teaches json/jsonb extract_path_text pushdown to recognize that exact wrapper and deparse constant non-numeric paths with ClickHouse JSON functions.
The mapping preserves SQL NULL, missing keys, JSON null, empty strings, scalars, objects, nested paths, and invalid-JSON errors. Numeric and empty path components, non-text extraction, and non-constant paths remain local where semantics cannot be mapped safely.
Regression coverage includes Cyrillic ILIKE pushdown and json/jsonb result semantics.
Tested with PostgreSQL 18 and ClickHouse 26.3.12.3: