Sync portfolio laboratory source
This commit is contained in:
commit
24ddb06c6e
12 changed files with 246 additions and 0 deletions
12
sql/05-change.sql
Normal file
12
sql/05-change.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-- Добавляет сценарий только для одного заказа. Источник TPC-H сохраняет исходные данные.
|
||||
MERGE INTO iceberg.tpch_raw.order_events AS target
|
||||
USING (
|
||||
SELECT batch_id, orderkey, orderdate, orderstatus,
|
||||
cast(totalprice + IF(batch_id = 1, 10, 0) AS decimal(15, 2)) AS totalprice
|
||||
FROM iceberg.tpch_raw.orders
|
||||
CROSS JOIN (VALUES (BIGINT '1'), (BIGINT '2')) AS batches(batch_id)
|
||||
WHERE orderkey = (SELECT min(orderkey) FROM iceberg.tpch_raw.orders)
|
||||
) AS source
|
||||
ON target.orderkey = source.orderkey AND target.batch_id = source.batch_id
|
||||
WHEN NOT MATCHED THEN INSERT (batch_id, orderkey, orderdate, orderstatus, totalprice)
|
||||
VALUES (source.batch_id, source.orderkey, source.orderdate, source.orderstatus, source.totalprice);
|
||||
Loading…
Add table
Add a link
Reference in a new issue