Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink Common

pyflink.table.expressions.json_object_agg#

json_object_agg(on_null: pyflink.table.expression.JsonOnNull, key_expr: Union[str, pyflink.table.expression.Expression[str]], value_expr) → pyflink.table.expression.Expression[source]#

Builds a JSON object string by aggregating key-value expressions into a single JSON object.

The key expression must return a non-nullable character string. Value expressions can be arbitrary, including other JSON functions. If a value is NULL, the on_null behavior defines what to do.

Note that keys must be unique. If a key occurs multiple times, an error will be thrown.

This function is currently not supported in OVER windows.

Examples:

>>> # '{"Apple":2,"Banana":17,"Orange":0}'
>>> orders.select(json_object_agg(JsonOnNull.NULL, col("product"), col("cnt")))

New in version 1.12.0.

previous

pyflink.table.expressions.json_object

next

pyflink.table.expressions.json_array

Show Source

Created using Sphinx 4.5.0.