-
Notifications
You must be signed in to change notification settings - Fork 380
Access JSON internal (binary) representation in clients (psql). #6256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Just noticed something funny, I can leverage the datafusion effect in #6173 to actually get JSON in jsonb representation :D Or actually just But I think |
I suspect it's caused by the query plan optimizer. We can investigate this. |
Could you please provide the minimal steps to reproduce for this case? |
public=> show create table json;
Table | Create Table
-------+-------------------------------------
json | CREATE TABLE IF NOT EXISTS "json" (+
| "ts" TIMESTAMP(3) NOT NULL, +
| "x" JSON NULL, +
| TIME INDEX ("ts") +
| ) +
| +
| ENGINE=mito +
|
(1 ligne)
public=> select * from json;
ts | x
----------------------------+---------------------
2025-06-05 15:54:44.798000 | {"x":"y"}
2025-06-05 15:56:14.460000 | {"x":"y","y":212.2}
(2 lignes)
public=> select arrow_cast(x, 'Binary') from json;
arrow_cast(json.x,Utf8("Binary"))
-----------------------------------
{"x":"y"}
{"x":"y","y":212.2}
(2 lignes)
public=> select arrow_cast(x, 'Binary') from json limit 10;
arrow_cast(json.x,Utf8("Binary"))
--------------------------------------------------------------------
\x4000000110000001100000017879
\x400000021000000110000001100000012000000978797960406a866666666666
(2 lignes)
public=> select * from json limit 10;
ts | x
----------------------------+---------------------
2025-06-05 15:54:44.798000 | {"x":"y"}
2025-06-05 15:56:14.460000 | {"x":"y","y":212.2}
(2 lignes) |
What type of enhancement is this?
Performance
What does the enhancement do?
I my use case I have lots of log lines in JSON in a table, using the JSON type. In DB, JSON is serialized in binary using Databend's jsonb representation.
I want to access this data from a program that uses the postgresql interface. However, this program understands jsonb and I want to obtain the jsonb binary data directly.
I suggest that you add a JSON function like
json_to_binary
orjson_to_jsonb
that would be take a JSON value as input and returns its jsonb encoding as binary data.Implementation challenges
No response
The text was updated successfully, but these errors were encountered: