RWM Console cluster: risingwave-alinma.alinma-rw.svc.cluster.local

← cluster alinma_bff objects order_execution_summaries_mv
Overview Objects Graph History
materialized view · alinma_bff.order_execution_summaries_mv Explain plan ▶
Parallelism
2
Actors
12 / 12
running
Distribution
HASH
Rows
0
State size
Created
2026-08-06 14:22
Initialized
2026-08-06 14:21
Fragment flags
LOCALITY_PROVIDERMVIEWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
742197 44514 51 running
742198 44514 51 running
742199 44516 51 running
742200 44516 51 running
742201 44515 51 running
742202 44515 51 running
742203 44518 51 running
742204 44518 51 running
742205 44517 51 running
742206 44517 51 running
742207 44519 51 running
742208 44519 51 running
sql · alinma_bff.order_execution_summaries_mv — click to expand
CREATE MATERIALIZED VIEW alinma_bff.order_execution_summaries_mv AS
WITH execution_totals AS (
  SELECT
    ex.order_id,
    SUM(CAST(ex.quantity AS DECIMAL)) AS filled_quantity,
    SUM(
      CAST(ex.quantity AS DECIMAL) * CAST((
        ex.price -> 'amount' ->> 'value'
      ) AS DECIMAL)
    ) AS total_amount,
    MAX(
      COALESCE(ex.price -> 'currencyCode' ->> 'value', ex.price -> 'currency_code' ->> 'value')
    ) AS currency_code
  FROM alinma_bff.order_executions_bounded_mv AS ex
  GROUP BY
    ex.order_id
)
SELECT
  t.order_id,
  JSONB_BUILD_OBJECT(
    'filledQuantity',
    JSONB_BUILD_OBJECT('value', CAST(MAX(t.filled_quantity) AS VARCHAR)),
    'averagePrice',
    JSONB_BUILD_OBJECT(
      'currencyCode',
      JSONB_BUILD_OBJECT('value', COALESCE(MAX(t.currency_code), '')),
      'amount',
      JSONB_BUILD_OBJECT(
        'value',
        CASE
          WHEN MAX(t.filled_quantity) > 0
          THEN CAST((
            MAX(t.total_amount) / MAX(t.filled_quantity)
          ) AS VARCHAR)
          ELSE '0'
        END
      )
    ),
    'totalAmount',
    JSONB_BUILD_OBJECT(
      'currencyCode',
      JSONB_BUILD_OBJECT('value', COALESCE(MAX(t.currency_code), '')),
      'amount',
      JSONB_BUILD_OBJECT('value', CAST(MAX(t.total_amount) AS VARCHAR))
    ),
    'totalFees',
    JSONB_BUILD_OBJECT(
      'currencyCode',
      JSONB_BUILD_OBJECT('value', COALESCE(MAX(t.currency_code), '')),
      'amount',
      JSONB_BUILD_OBJECT('value', CAST(COALESCE(SUM(fl.amount), 0) AS VARCHAR))
    ),
    'fees',
    COALESCE(
      JSONB_AGG(
        JSONB_BUILD_OBJECT(
          'kind',
          fl.kind,
          'amount',
          JSONB_BUILD_OBJECT(
            'currencyCode',
            JSONB_BUILD_OBJECT('value', COALESCE(t.currency_code, '')),
            'amount',
            JSONB_BUILD_OBJECT('value', CAST(fl.amount AS VARCHAR))
          )
        ) ORDER BY fl.kind
      ) FILTER(WHERE
        NOT fl.order_id IS NULL),
      CAST('[]' AS JSONB)
    )
  ) AS execution_summary
FROM execution_totals AS t
LEFT JOIN alinma_bff.order_execution_fee_lines_mv AS fl
  ON fl.order_id = t.order_id
GROUP BY
  t.order_id
Lineage · alinma_bff.order_execution_summaries_mv 4 objects
Direct (1-hop) dependencies from rw_depend, across schemas. Click a neighbor to expand its dependencies; ⌘/Ctrl-click opens its page. Drag to pan, scroll to zoom. External source/sink endpoints (Kafka, Iceberg) are not shown.