risingwavelabs / risingwave

Best-in-class stream processing, analytics, and management. Perform continuous analytics, or build event-driven applications, real-time ETL pipelines, and feature stores in minutes. Unified streaming and batch. PostgreSQL compatible.
https://go.risingwave.com/slack
Apache License 2.0
7.06k stars 581 forks source link

feat(expr): support wildcard parameter in `jsonb_agg` #19496

Open KeXiangWang opened 1 day ago

KeXiangWang commented 1 day ago

Example:

select jsonb_agg(t.*) from t

Currently,

dev=> select jsonb_agg(t.*) from t;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Failed to bind expression: jsonb_agg(t.*)
  2: Invalid input syntax: unexpected wildcard t.*
fuyufjh commented 1 day ago

Tried the workaround but it doesn't work, too.

dev=> select jsonb_agg(jsonb_build_object(t.*)) from t;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Failed to bind expression: jsonb_agg(jsonb_build_object(t.*))
  2: Invalid input syntax: unexpected wildcard t.*

However,

dev=> select jsonb_agg(jsonb_build_object(k,v)) from t;
 jsonb_agg
-----------
 []
(1 row)

So it looks like a miss of binder's feature i.e. expand the asterisk * to concrete columns.

yuhao-su commented 1 day ago

jsonb_build_object is different from this proposal. A more close one is SELECT json_agg(row_to_json(T)) FROM T;. But we don't have row_to_json either.

xiangjinwu commented 23 hours ago

Using wildcard as function argument is a special syntax: #10847