Skip to content

Commit

Permalink
[CAB-adapter] Include lineitem table refresh in SQL scripts (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamachor authored Oct 29, 2024
1 parent 8104c26 commit 5db67fc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
5 changes: 3 additions & 2 deletions adapters/cab-converter/sql/spark-3.3.1/build/build.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ CREATE
l_shipmode STRING,
l_comment STRING
)
TBLPROPERTIES(
PARTITIONED BY(months(l_shipdate)) TBLPROPERTIES(
'primaryKey' = 'l_orderkey,l_linenumber' ${tblproperties_suffix}
);
INSERT INTO ${catalog}.${database}${stream_num}.lineitem
SELECT *
FROM ${external_catalog}.${external_database}${stream_num}.lineitem;
FROM ${external_catalog}.${external_database}${stream_num}.lineitem
SORT BY l_shipdate;

DROP
TABLE
Expand Down
33 changes: 33 additions & 0 deletions adapters/cab-converter/sql/spark-3.3.1/run/query_23.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,36 @@ FROM
${catalog}.${database}${stream_num}.orders
WHERE
${param1} <= o_orderkey and o_orderkey < ${param2} and mod(o_orderkey, 32) between ${param3} and ${param4};

INSERT
INTO
${catalog}.${database}${stream_num}.lineitem (
SELECT
l_orderkey + 8,
l_partkey,
l_suppkey,
l_linenumber,
l_quantity,
l_extendedprice,
l_discount,
l_tax,
l_returnflag,
l_linestatus,
l_shipdate,
l_commitdate,
l_receiptdate,
l_shipinstruct,
l_shipmode,
l_comment
FROM
${catalog}.${database}${stream_num}.lineitem
WHERE
${param1} <= l_orderkey and l_orderkey < ${param2}
SORT BY
l_shipdate);

DELETE
FROM
${catalog}.${database}${stream_num}.lineitem
WHERE
${param1} <= l_orderkey and l_orderkey < ${param2} and mod(l_orderkey, 32) between ${param3} and ${param4};

0 comments on commit 5db67fc

Please sign in to comment.