diff --git a/fe/fe-core/src/main/java/com/starrocks/catalog/StructField.java b/fe/fe-core/src/main/java/com/starrocks/catalog/StructField.java index 2a509384985c3..1658f2c7af74d 100644 --- a/fe/fe-core/src/main/java/com/starrocks/catalog/StructField.java +++ b/fe/fe-core/src/main/java/com/starrocks/catalog/StructField.java @@ -73,6 +73,10 @@ public int getPosition() { return position; } + public int getFieldId() { + return fieldId; + } + public void setPosition(int position) { this.position = position; } diff --git a/fe/fe-core/src/main/java/com/starrocks/sql/analyzer/AnalyzerUtils.java b/fe/fe-core/src/main/java/com/starrocks/sql/analyzer/AnalyzerUtils.java index 4e15fbe63e208..a9de758121bf5 100644 --- a/fe/fe-core/src/main/java/com/starrocks/sql/analyzer/AnalyzerUtils.java +++ b/fe/fe-core/src/main/java/com/starrocks/sql/analyzer/AnalyzerUtils.java @@ -1526,7 +1526,8 @@ public static Type replaceNullType2Boolean(Type type) { } else if (type.isStructType()) { ArrayList newFields = Lists.newArrayList(); for (StructField sf : ((StructType) type).getFields()) { - newFields.add(new StructField(sf.getName(), replaceNullType2Boolean(sf.getType()), sf.getComment())); + newFields.add(new StructField(sf.getName(), sf.getFieldId(), + replaceNullType2Boolean(sf.getType()), sf.getComment())); } return new StructType(newFields); } diff --git a/test/common/data/stream_load/sr_struct_schema_change_data1.json b/test/common/data/stream_load/sr_struct_schema_change_data1.json new file mode 100644 index 0000000000000..faf9c0f42be34 --- /dev/null +++ b/test/common/data/stream_load/sr_struct_schema_change_data1.json @@ -0,0 +1,325 @@ +{ + "si": "asdf", + "ss": "asdfasdf", + "ts": "2024-08-30T19:02:13.44Z", + "uid": "dafasdf", + "item_appeasement__sms__a": { + "merchvattot": { + "amount": 120, + "currency": "USD" + }, + "merchdsptot": { + "amount": 5, + "currency": "USD" + }, + "merchprmtot": { + "amount": 10, + "currency": "USD" + }, + "merchvatprmtot": { + "amount": 12, + "currency": "USD" + }, + "merchdspprmtot": { + "amount": 1, + "currency": "USD" + }, + "merchdscntdtot": { + "amount": 2, + "currency": "USD" + }, + "merchvatdscntdtot": { + "amount": 0.4, + "currency": "USD" + }, + "merchdspdscntdtot": { + "amount": 0.2, + "currency": "USD" + }, + "merchtxtot": { + "amount": 0.3, + "currency": "USD" + }, + "merchtxliablty": { + "amount": 0.1, + "currency": "USD" + }, + "txbtot": { + "amount": 0, + "currency": "USD" + }, + "ntxbtot": { + "amount": 0, + "currency": "USD" + }, + "dscntbtot": { + "amount": 0, + "currency": "USD" + }, + "shptot": { + "amount": 15, + "currency": "USD" + }, + "shpvattot": { + "amount": 2.7, + "currency": "USD" + }, + "shpdsptot": { + "amount": 1.5, + "currency": "USD" + }, + "shpprmtot": { + "amount": 0.75, + "currency": "USD" + }, + "shpvatprmtot": { + "amount": 0.15, + "currency": "USD" + }, + "shpdspprmtot": { + "amount": 0.05, + "currency": "USD" + }, + "shpdscntdtot": { + "amount": 1, + "currency": "USD" + }, + "shpvatdscntdtot": { + "amount": 0.2, + "currency": "USD" + }, + "shpdspdscntdtot": { + "amount": 0.1, + "currency": "USD" + }, + "shptxtot": { + "amount": 0.5, + "currency": "USD" + }, + "shptxliablty": { + "amount": 0.2, + "currency": "USD" + }, + "hndtot": { + "amount": 20, + "currency": "USD" + }, + "hndvattot": { + "amount": 4, + "currency": "USD" + }, + "hnddsptot": { + "amount": 2, + "currency": "USD" + }, + "hndprmtot": { + "amount": 1, + "currency": "USD" + }, + "hndvatprmtot": { + "amount": 0.2, + "currency": "USD" + }, + "hnddspprmtot": { + "amount": 0.1, + "currency": "USD" + }, + "hnddscntdtot": { + "amount": 0.5, + "currency": "USD" + }, + "hndvatdscntdtot": { + "amount": 0.1, + "currency": "USD" + }, + "hnddspdscntdtot": { + "amount": 0.05, + "currency": "USD" + }, + "hndtxtot": { + "amount": 0.3, + "currency": "USD" + }, + "hndtxliablty": { + "amount": 0.1, + "currency": "USD" + }, + "ordtot": { + "amount": 150, + "currency": "USD" + }, + "ltyearned": { + "amount": 5, + "currency": "USD" + }, + "ltyused": { + "amount": 1, + "currency": "USD" + }, + "prmtot": { + "amount": 0, + "currency": "USD" + }, + "txtot": { + "amount": 0, + "currency": "USD" + }, + "appitms": [ + { + "item_id": "item1", + "quantity": 2, + "price": 50 + }, + { + "item_id": "item2", + "quantity": 1, + "price": 100 + } + ], + "qty": 3, + "shpqty": 1, + "supcnclqty": 0, + "uom": "pcs", + "txexempt": false, + "prmapp": true, + "mrkdnamt": { + "amount": 0, + "currency": "USD" + }, + "mrkdntot": { + "amount": 0, + "currency": "USD" + }, + "retailprice": { + "amount": 150, + "currency": "USD" + }, + "retailtot": { + "amount": 150, + "currency": "USD" + }, + "merchprice": { + "amount": 100, + "currency": "USD" + }, + "merchtot": { + "amount": 100, + "currency": "USD" + }, + "merchvatdtls": "xxxxxxx", + "merchvatratedtrm": "xxxxx", + "merchvatrate": 20, + "merchpricedvatrate": 15, + "merchvatcntry": "USA", + "merchvatamt": { + "amount": 20, + "currency": "USD" + }, + "merchdspprice": { + "amount": 95, + "currency": "USD" + }, + "merchprmpct": 10, + "merchprmamt": { + "amount": 10, + "currency": "USD" + }, + "merchvatprmamt": { + "amount": 2, + "currency": "USD" + }, + "merchdspprmamt": { + "amount": 1, + "currency": "USD" + }, + "merchtxrate": 5, + "shpvatdtls": "xxxxxxxxx", + "shpvatratedtrm": "Annual", + "shpvatrate": 18, + "shppricedvatrate": 12, + "shpvatcntry": "USA", + "shpprmpct": 5, + "shptxrate": 3, + "hndvatdtls": "xxxxxxxxxx", + "hndvatratedtrm": "Annual", + "hndvatrate": 22, + "hndpricedvatrate": 14, + "hndvatcntry": "USA", + "hndprmpct": 8, + "hndtxrate": 2, + "lnitmtot": { + "amount": 0, + "currency": "USD" + }, + "prmreimb": { + "amount": 0, + "currency": "USD" + }, + "mrltot": { + "amount": 0, + "currency": "USD" + }, + "mrlprmtot": { + "amount": 0, + "currency": "USD" + }, + "mrldscntdtot": { + "amount": 0, + "currency": "USD" + }, + "payment": { + "method": "xxxxxxx", + "amount": 150, + "currency": "USD" + }, + "refund": { + "merchtxtot": { + "amount": 0, + "currency": "USD" + }, + "shptot": { + "amount": 0, + "currency": "USD" + }, + "shptxtot": { + "amount": 0, + "currency": "USD" + }, + "hndtot": { + "amount": 0, + "currency": "USD" + }, + "hndtxtot": { + "amount": 0, + "currency": "USD" + }, + "mrltot": { + "amount": 0, + "currency": "USD" + }, + "mrltxtot": { + "amount": 0, + "currency": "USD" + }, + "rstkfee": { + "amount": 0, + "currency": "USD" + }, + "adjtot": { + "amount": 0, + "currency": "USD" + }, + "ltyclaw": { + "amount": 0, + "currency": "USD" + }, + "lnitms": [ + { + "item_id": "xxxxxxx", + "quantity": 1, + "price": 50 + } + ] + } + } +} \ No newline at end of file diff --git a/test/common/data/stream_load/sr_struct_schema_change_data2.json b/test/common/data/stream_load/sr_struct_schema_change_data2.json new file mode 100644 index 0000000000000..43dfcaa71933f --- /dev/null +++ b/test/common/data/stream_load/sr_struct_schema_change_data2.json @@ -0,0 +1,128 @@ +{ + "v6": null, + "ln": null, + "lo": null, + "account_phone_change_confirm__sms__a": null, + "item_distribution_reship_requested__sms__a": null, + "pt": null, + "tx": null, + "tz": null, + "pv": null, + "order_return_mrl_refund_requested__sms__a": null, + "lt": null, + "ua": null, + "dp": null, + "uc": null, + "ud": null, + "ds": null, + "item_appeasement__sms__a": null, + "order_shipping_address_update_requested__sms__a": null, + "order_fraudstatus_reject__sms__a": null, + "mc": null, + "original_ts": "2024-08-22T23:48:13.437Z", + "ia": "xxxxxxxx-a21f-451a-9b0c-xxxxxxxx", + "id": null, + "s4": null, + "checkoutcs__sms__a": null, + "s6": null, + "item_deliver__sms__a": null, + "ei": null, + "ai": null, + "eo": "shruti", + "notifyme__sms__a": null, + "et": "ACCOUNT_ONE_TIME_CODE_SMS.SMS", + "ix": null, + "item_return_dispositioned__sms__a": null, + "order_recovery_payment_rejected__sms__a": null, + "item_refund_requested__sms__a": null, + "rc": -7194765972940041000, + "order_recovery_payment_error__sms__a": null, + "at": null, + "av": null, + "rq": null, + "bc": null, + "fi": null, + "ns": null, + "order_shipping_method_update_requested__sms__a": null, + "ft": null, + "uid": "xxxxxxxxxxxxxxxxxxxx", + "sg": null, + "si": "xxxxxxxx-883b-4b98-87ad-xxxxxxxxx", + "ka": null, + "account_one_time_code_sms__sms__a": { + "message": "xxxxxx", + "parentPSID": 608111, + "subscriberKeyHash": "", + "sms": "{\"responseURI\":\"/2010-04-01/Accounts/xxxxxxxxxxxx/Messages/xxxxxxxxxxxxxxxxxx.json\",\"sid\":\"xxxxxxxxxx\",\"campaign_name\":\"xxxx\",\"messagingServiceID\":\"xxxxxxxxxxx\"}", + "messageKey": "xxxxxxxxxxxx", + "inputEvent": "xxxxxxx", + "mode": "xxx", + "emailName": "xxxxxxxxx", + "status": 200, + "triggerId": "xxxxxxxxx", + "notificationName": "xxxx", + "trigger": "transaction", + "resendEvent": false, + "loginAttemptId": "xxxxxxx-74e4-4c09-be4f-xxxxxxxxxx", + "sessionId": null + }, + "og": null, + "sm": null, + "oi": null, + "sp": null, + "enriched_attrs": { + "uid": "xxxxxxxxxxxxxxxxxxxx", + "enriched_ts": "2024-08-22T23:48:13.440Z", + "enriched_ts_long": 1724370493440, + "create_ts": 1724370493437, + "message_ts": 1724370493437, + "sessionId": null, + "version": "2.13", + "originRQ": null, + "originRC": "-7194765972940040801", + "rc_str": "9c270e7794d7559f", + "st": "xxxxxxx", + "tm": null, + "og": null, + "dept": null, + "bs": "Unknown", + "bsr": "Unknown", + "sprtnr": "Unknown", + "site_lkp_ts": 1724370281162, + "bot": null, + "errors": null + }, + "ss": null, + "st": 608111, + "c": null, + "os": null, + "d": null, + "account_phone_change_notify__sms__a": null, + "notification__sms__a": null, + "e": null, + "ci": null, + "cl": null, + "order_return_mrl_waive_requested__sms__a": null, + "q": null, + "rpn": null, + "ct": null, + "pa": null, + "s": null, + "pc": null, + "tg": null, + "item_carrier_notified__sms__a": null, + "t": null, + "pd": null, + "fancash__sms__a": null, + "item_cancelled__sms__a": null, + "ti": null, + "x": null, + "tm": null, + "xs": null, + "xt": null, + "da": null, + "item_out_for_delivery__sms__a": null, + "pn": null, + "v4": null, + "ts": "2024-08-22T23:48:13.44Z" +} \ No newline at end of file diff --git a/test/sql/test_schema_change/R/test_struct_schema_change b/test/sql/test_schema_change/R/test_struct_schema_change new file mode 100644 index 0000000000000..b743b402ea15d --- /dev/null +++ b/test/sql/test_schema_change/R/test_struct_schema_change @@ -0,0 +1,167 @@ +-- name: test_struct_schema_change +create database test_struct_schema_change_db; +-- result: +-- !result +CREATE TABLE `test_struct_schema_change_db`.`tab1` ( + `ts` datetime NULL COMMENT "", + `original_ts` datetime NULL COMMENT "", + `si` varchar(65533) NULL COMMENT "", + `et` varchar(65533) NULL COMMENT "", + `e` struct NULL COMMENT "", + `ai` varchar(65533) NULL COMMENT "", + `av` varchar(65533) NULL COMMENT "", + `ci` varchar(65533) NULL COMMENT "", + `cl` varchar(65533) NULL COMMENT "", + `q` varchar(65533) NULL COMMENT "", + `x` varchar(65533) NULL COMMENT "", + `ns` array NULL COMMENT "", + `s` struct NULL COMMENT "", + `c` map NULL COMMENT "", + `ss` varchar(65533) NULL COMMENT "", + `bc` varchar(65533) NULL COMMENT "", + `eo` varchar(65533) NULL COMMENT "", + `ia` varchar(65533) NULL COMMENT "", + `ka` varchar(65533) NULL COMMENT "", + `id` varchar(65533) NULL COMMENT "", + `t` map NULL COMMENT "", + `tz` varchar(65533) NULL COMMENT "", + `da` map NULL COMMENT "", + `rc` bigint(20) NULL COMMENT "", + `ei` varchar(65533) NULL COMMENT "", + `rq` varchar(65533) NULL COMMENT "", + `ua` varchar(65533) NULL COMMENT "", + `ud` varchar(65533) NULL COMMENT "", + `os` tinyint(4) NULL COMMENT "", + `d` struct NULL COMMENT "", + `st` int(11) NULL COMMENT "", + `sg` int(11) NULL COMMENT "", + `sm` array NULL COMMENT "", + `pt` varchar(65533) NULL COMMENT "", + `pv` varchar(65533) NULL COMMENT "", + `pn` varchar(65533) NULL COMMENT "", + `rpn` varchar(65533) NULL COMMENT "", + `sp` smallint(6) NULL COMMENT "", + `og` smallint(6) NULL COMMENT "", + `tm` int(11) NULL COMMENT "", + `at` int(11) NULL COMMENT "", + `pd` varchar(65533) NULL COMMENT "", + `mc` int(11) NULL COMMENT "", + `dp` int(11) NULL COMMENT "", + `ds` int(11) NULL COMMENT "", + `tx` int(11) NULL COMMENT "", + `v4` varchar(65533) NULL COMMENT "", + `v6` varchar(65533) NULL COMMENT "", + `s4` varchar(65533) NULL COMMENT "", + `s6` varchar(65533) NULL COMMENT "", + `lt` float NULL COMMENT "", + `ln` float NULL COMMENT "", + `pc` int(11) NULL COMMENT "", + `lo` varchar(65533) NULL COMMENT "", + `ct` varchar(65533) NULL COMMENT "", + `uc` varchar(65533) NULL COMMENT "", + `oi` varchar(65533) NULL COMMENT "", + `enriched_attrs` struct NULL COMMENT "", + `ti` int(11) NULL COMMENT "", + `pa` int(11) NULL COMMENT "", + `tg` array NULL COMMENT "", + `ix` array NULL COMMENT "", + `fi` varchar(65533) NULL COMMENT "", + `ft` varchar(65533) NULL COMMENT "", + `xs` varchar(65533) NULL COMMENT "", + `xt` varchar(65533) NULL COMMENT "", + `order_return_mrl_refund_requested__sms__a` struct NULL COMMENT "", + `item_deliver__sms__a` struct, dest map, source map, pkgQty struct, qtyList array>>, cInfo struct>, evtT varchar(65533), evtD varchar(65533), estDT varchar(65533), evtTZ varchar(65533)>, cPayld map, prn varchar(65533), dlvdt varchar(65533), dlvdt_ms bigint(20), orddt bigint(20), rmk varchar(65533), plf varchar(65533), omst varchar(65533), fst varchar(65533), tid varchar(65533), vnum varchar(65533), trknum varchar(65533), carnm varchar(65533), carsvc varchar(65533)> NULL COMMENT "", + `fancash__sms__a` struct NULL COMMENT "", + `item_return_dispositioned__sms__a` struct, retailtot struct, merchtot struct, merchvattot struct, merchdsptot struct, merchprmtot struct, merchvatprmtot struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxtot struct, merchtxliablty struct, txbtot struct, ntxbtot struct, dscntbtot struct, shptot struct, shpvattot struct, shpdsptot struct, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxtot struct, shptxliablty struct, hndtot struct, hndvattot struct, hnddsptot struct, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxtot struct, hndtxliablty struct, paysurchrgtot struct, paysurchrgvattot struct, paysurchrgdsptot struct, paysurchrgprmtot struct, paysurchrgvatprmtot struct, paysurchrgdspprmtot struct, paysurchrgdscntdtot struct, paysurchrgvatdscntdtot struct, paysurchrgdspdscntdtot struct, paysurchrgtxtot struct, paysurchrgtxliablty struct, deldutypaidtot struct, deldutypaidvattot struct, deldutypaiddsptot struct, deldutypaidprmtot struct, deldutypaidvatprmtot struct, deldutypaiddspprmtot struct, deldutypaiddscntdtot struct, deldutypaidvatdscntdtot struct, deldutypaiddspdscntdtot struct, deldutypaidtxtot struct, deldutypaidtxliablty struct, rstkfee struct, mrltot struct, mrlprmtot struct, mrldscntdtot struct, mrltxamt struct, ordtot struct, ltyearned struct, ltyused struct, accttot struct, shpnet struct, savetot struct, recvd boolean, rfndb boolean, zcrr boolean, mrlwvd boolean, prmtot struct, txtot struct, lnitms array>, qty int(11), shpqty int(11), uom varchar(65533), txexempt boolean, prmapp boolean, mrkdnamt struct, mrkdntot struct, retailprice struct, retailtot struct, merchprice struct, merchtot struct, merchvatdtls varchar(65533), merchvatratedtrm varchar(65533), merchvatrate float, merchpricedvatrate float, merchvatcntry varchar(65533), merchvatamt struct, merchvattot struct, merchdspprice struct, merchdsptot struct, merchprmpct float, merchprmamt struct, merchprmtot struct, merchvatprmamt struct, merchvatprmtot struct, merchdspprmamt struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxrate float, merchtxtot struct, merchtxliablty struct, shptot struct, shpvatdtls varchar(65533), shpvatratedtrm varchar(65533), shpvatrate float, shppricedvatrate float, shpvatcntry varchar(65533), shpvattot struct, shpdsptot struct, shpprmpct float, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxrate float, shptxtot struct, shptxliablty struct, hndtot struct, hndvatdtls varchar(65533), hndvatratedtrm varchar(65533), hndvatrate float, hndpricedvatrate float, hndvatcntry varchar(65533), hndvattot struct, hnddsptot struct, hndprmpct float, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxrate float, hndtxtot struct, hndtxliablty struct, paysurchrgtot struct, paysurchrgvatdtls varchar(65533), paysurchrgvatratedtrm varchar(65533), paysurchrgvatrate float, paysurchrgpricedvatrate float, paysurchrgvatcntry varchar(65533), paysurchrgvattot struct, paysurchrgdsptot struct, paysurchrgprmpct float, paysurchrgprmtot struct, paysurchrgvatprmtot struct, paysurchrgdspprmtot struct, paysurchrgdscntdtot struct, paysurchrgvatdscntdtot struct, paysurchrgdspdscntdtot struct, paysurchrgtxrate float, paysurchrgtxtot struct, paysurchrgtxliablty struct, deldutypaiddtls struct, deldutypaidrate float, deldutypaidamt struct, deldutypaidtot struct, deldutypaidvatdtls varchar(65533), deldutypaidvatratedtrm varchar(65533), deldutypaidvatrate float, deldutypaidpricedvatrate float, deldutypaidvatcntry varchar(65533), deldutypaidvatamt struct, deldutypaidvattot struct, deldutypaiddspamt struct, deldutypaiddsptot struct, deldutypaidprmpct varchar(65533), deldutypaidprmamt varchar(65533), deldutypaidprmtot struct, deldutypaidvatprmamt struct, deldutypaidvatprmtot struct, deldutypaiddspprmtot struct, deldutypaiddscntdtot struct, deldutypaidvatdscntdtot struct, deldutypaiddspdscntdtot struct, deldutypaidtxrate float, deldutypaidtxtot struct, deldutypaidtxliablty struct, rstkfee struct, lnitmtot struct, ltyearned struct, ltyused struct, prmreimb struct, prmtot struct, txtot struct, cdi array>, fdi array>, autodispitm boolean, mrltot struct, mrlprmtot struct, mrldscntdtot struct, autodispdtls varchar(65533)>>, payment struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>, refund struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>> NULL COMMENT "", + `item_appeasement__sms__a` struct, merchvattot struct, merchdsptot struct, merchprmtot struct, merchvatprmtot struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxtot struct, merchtxliablty struct, txbtot struct, ntxbtot struct, dscntbtot struct, shptot struct, shpvattot struct, shpdsptot struct, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxtot struct, shptxliablty struct, hndtot struct, hndvattot struct, hnddsptot struct, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxtot struct, hndtxliablty struct, ordtot struct, ltyearned struct, ltyused struct, prmtot struct, txtot struct, appitms array>, qty int(11), shpqty int(11), uom varchar(65533), txexempt boolean, prmapp boolean, mrkdnamt struct, mrkdntot struct, retailprice struct, retailtot struct, merchprice struct, merchtot struct, merchvatdtls varchar(65533), merchvatratedtrm varchar(65533), merchvatrate float, merchpricedvatrate float, merchvatcntry varchar(65533), merchvatamt struct, merchvattot struct, merchdspprice struct, merchdsptot struct, merchprmpct float, merchprmamt struct, merchprmtot struct, merchvatprmamt struct, merchvatprmtot struct, merchdspprmamt struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxrate float, merchtxtot struct, merchtxliablty struct, shptot struct, shpvatdtls varchar(65533), shpvatratedtrm varchar(65533), shpvatrate float, shppricedvatrate float, shpvatcntry varchar(65533), shpvattot struct, shpdsptot struct, shpprmpct float, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxrate float, shptxtot struct, shptxliablty struct, hndtot struct, hndvatdtls varchar(65533), hndvatratedtrm varchar(65533), hndvatrate float, hndpricedvatrate float, hndvatcntry varchar(65533), hndvattot struct, hnddsptot struct, hndprmpct float, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxrate float, hndtxtot struct, hndtxliablty struct, lnitmtot struct, ltyearned struct, ltyused struct, prmtot struct, txtot struct, prmreimb struct, mrltot struct, mrlprmtot struct, mrldscntdtot struct>>, payment struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>, refund struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>> NULL COMMENT "", + `order_shipping_address_update_requested__sms__a` struct NULL COMMENT "", + `item_out_for_delivery__sms__a` struct, dest map, source map, pkgQty struct, qtyList array>>, cInfo struct>, evtT varchar(65533), evtD varchar(65533), estDT varchar(65533), evtTZ varchar(65533)>, cPayld map, prn varchar(65533), ofddt varchar(65533), ofddt_ms bigint(20), rmk varchar(65533), plf varchar(65533), omst varchar(65533), fst varchar(65533), tid varchar(65533), vnum varchar(65533), trknum varchar(65533), carnm varchar(65533), carsvc varchar(65533), orig varchar(65533), origst varchar(65533), dest varchar(65533), destst varchar(65533)> NULL COMMENT "", + `item_carrier_notified__sms__a` struct, dest map, source map, pkgQty struct, qtyList array>>, cInfo struct>, evtT varchar(65533), evtD varchar(65533), estDT varchar(65533), evtTZ varchar(65533)>, cPayld struct>>, wt varchar(65533), wtuom varchar(65533), freight float, fuom varchar(65533)>, prn varchar(65533), ntfdt varchar(65533), ntfdt_ms bigint(20), rmk varchar(65533), orddt bigint(20), plf varchar(65533), omst varchar(65533), fst varchar(65533), tid varchar(65533), vnum varchar(65533), poi varchar(65533), osid varchar(65533), ossid varchar(65533), doid varchar(65533), soid varchar(65533), lang varchar(65533), locale varchar(65533), trknum varchar(65533), carnm varchar(65533), carsvc varchar(65533), med varchar(65533), med_ms bigint(20), dmd varchar(65533), ced varchar(65533), ced_ms bigint(20)> NULL COMMENT "", + `order_fraudstatus_reject__sms__a` struct NULL COMMENT "", + `order_shipping_method_update_requested__sms__a` struct NULL COMMENT "", + `item_refund_requested__sms__a` struct NULL COMMENT "", + `account_phone_change_notify__sms__a` struct NULL COMMENT "", + `notifyme__sms__a` struct NULL COMMENT "", + `item_cancelled__sms__a` struct, merchvattot struct, merchdsptot struct, merchprmtot struct, merchvatprmtot struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxtot struct, merchtxliablty struct, txbtot struct, ntxbtot struct, dscntbtot struct, shptot struct, shpvattot struct, shpdsptot struct, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxtot struct, shptxliablty struct, hndtot struct, hndvattot struct, hnddsptot struct, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxtot struct, hndtxliablty struct, ordtot struct, ltyearned struct, ltyused struct, prmtot struct, txtot struct, cnclitms array>, qty int(11), shpqty int(11), supcnclqty int(11), uom varchar(65533), txexempt boolean, prmapp boolean, mrkdnamt struct, mrkdntot struct, retailprice struct, retailtot struct, merchprice struct, merchtot struct, merchvatdtls varchar(65533), merchvatratedtrm varchar(65533), merchvatrate float, merchpricedvatrate float, merchvatcntry varchar(65533), merchvatamt struct, merchvattot struct, merchdspprice struct, merchdsptot struct, merchprmpct float, merchprmamt struct, merchprmtot struct, merchvatprmamt struct, merchvatprmtot struct, merchdspprmamt struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxrate float, merchtxtot struct, merchtxliablty struct, shptot struct, shpvatdtls varchar(65533), shpvatratedtrm varchar(65533), shpvatrate float, shppricedvatrate float, shpvatcntry varchar(65533), shpvattot struct, shpdsptot struct, shpprmpct float, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxrate float, shptxtot struct, shptxliablty struct, hndtot struct, hndvatdtls varchar(65533), hndvatratedtrm varchar(65533), hndvatrate float, hndpricedvatrate float, hndvatcntry varchar(65533), hndvattot struct, hnddsptot struct, hndprmpct float, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxrate float, hndtxtot struct, hndtxliablty struct, lnitmtot struct, ltyearned struct, ltyused struct, prmtot struct, txtot struct, prmreimb struct, mrltot struct, mrlprmtot struct, mrldscntdtot struct>>, shpgrps array, shpgrpitms array>, dmdcd varchar(65533), rsg varchar(65533)>>, payment struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>, refund struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>, extrefval array>> NULL COMMENT "", + `account_phone_change_confirm__sms__a` struct NULL COMMENT "", + `order_return_mrl_waive_requested__sms__a` struct NULL COMMENT "", + `item_distribution_reship_requested__sms__a` struct NULL COMMENT "", + `order_recovery_payment_rejected__sms__a` struct NULL COMMENT "", + `notification__sms__a` struct NULL COMMENT "", + `checkoutcs__sms__a` struct NULL COMMENT "", + `order_recovery_payment_error__sms__a` struct NULL COMMENT "", + `account_one_time_code_sms__sms__a` struct NULL COMMENT "" +) ENGINE=OLAP +DUPLICATE KEY(`ts`) +COMMENT "OLAP" +PARTITION BY time_slice(ts, 720, 'hour', 'floor') +DISTRIBUTED BY HASH(`si`) BUCKETS 9 +PROPERTIES ( +"replication_num" = "1", +"in_memory" = "false", +"enable_persistent_index" = "true", +"replicated_storage" = "true", +"fast_schema_evolution" = "true", +"partition_live_number" = "1", +"compression" = "LZ4" +); +-- result: +-- !result +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "format: json" -T ${root_path}/lib/../common/data/stream_load/sr_struct_schema_change_data1.json -XPUT ${url}/api/test_struct_schema_change_db/tab1/_stream_load +-- result: +0 +{ + "Status": "Success", + "Message": "OK" +} +-- !result +sync; +-- result: +-- !result +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "format: json" -T ${root_path}/lib/../common/data/stream_load/sr_struct_schema_change_data2.json -XPUT ${url}/api/test_struct_schema_change_db/tab1/_stream_load +-- result: +0 +{ + "Status": "Success", + "Message": "OK" +} +-- !result +sync; +-- result: +-- !result +select count(*) from `test_struct_schema_change_db`.`tab1`; +-- result: +2 +-- !result +alter table `test_struct_schema_change_db`.`tab1` modify column item_appeasement__sms__a add field appitms.[*].supcnclqty int(11) AFTER shpqty; +-- result: +-- !result +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "format: json" -T ${root_path}/lib/../common/data/stream_load/sr_struct_schema_change_data1.json -XPUT ${url}/api/test_struct_schema_change_db/tab1/_stream_load +-- result: +0 +{ + "Status": "Success", + "Message": "OK" +} +-- !result +sync; +-- result: +-- !result +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "format: json" -T ${root_path}/lib/../common/data/stream_load/sr_struct_schema_change_data2.json -XPUT ${url}/api/test_struct_schema_change_db/tab1/_stream_load +-- result: +0 +{ + "Status": "Success", + "Message": "OK" +} +-- !result +sync; +-- result: +-- !result +select count(*) from `test_struct_schema_change_db`.`tab1`; +-- result: +4 +-- !result +drop database test_struct_schema_change_db force; +-- result: +-- !result \ No newline at end of file diff --git a/test/sql/test_schema_change/T/test_struct_schema_change b/test/sql/test_schema_change/T/test_struct_schema_change new file mode 100644 index 0000000000000..ebbc662786481 --- /dev/null +++ b/test/sql/test_schema_change/T/test_struct_schema_change @@ -0,0 +1,122 @@ +-- name: test_struct_schema_change +create database test_struct_schema_change_db; +CREATE TABLE `test_struct_schema_change_db`.`tab1` ( + `ts` datetime NULL COMMENT "", + `original_ts` datetime NULL COMMENT "", + `si` varchar(65533) NULL COMMENT "", + `et` varchar(65533) NULL COMMENT "", + `e` struct NULL COMMENT "", + `ai` varchar(65533) NULL COMMENT "", + `av` varchar(65533) NULL COMMENT "", + `ci` varchar(65533) NULL COMMENT "", + `cl` varchar(65533) NULL COMMENT "", + `q` varchar(65533) NULL COMMENT "", + `x` varchar(65533) NULL COMMENT "", + `ns` array NULL COMMENT "", + `s` struct NULL COMMENT "", + `c` map NULL COMMENT "", + `ss` varchar(65533) NULL COMMENT "", + `bc` varchar(65533) NULL COMMENT "", + `eo` varchar(65533) NULL COMMENT "", + `ia` varchar(65533) NULL COMMENT "", + `ka` varchar(65533) NULL COMMENT "", + `id` varchar(65533) NULL COMMENT "", + `t` map NULL COMMENT "", + `tz` varchar(65533) NULL COMMENT "", + `da` map NULL COMMENT "", + `rc` bigint(20) NULL COMMENT "", + `ei` varchar(65533) NULL COMMENT "", + `rq` varchar(65533) NULL COMMENT "", + `ua` varchar(65533) NULL COMMENT "", + `ud` varchar(65533) NULL COMMENT "", + `os` tinyint(4) NULL COMMENT "", + `d` struct NULL COMMENT "", + `st` int(11) NULL COMMENT "", + `sg` int(11) NULL COMMENT "", + `sm` array NULL COMMENT "", + `pt` varchar(65533) NULL COMMENT "", + `pv` varchar(65533) NULL COMMENT "", + `pn` varchar(65533) NULL COMMENT "", + `rpn` varchar(65533) NULL COMMENT "", + `sp` smallint(6) NULL COMMENT "", + `og` smallint(6) NULL COMMENT "", + `tm` int(11) NULL COMMENT "", + `at` int(11) NULL COMMENT "", + `pd` varchar(65533) NULL COMMENT "", + `mc` int(11) NULL COMMENT "", + `dp` int(11) NULL COMMENT "", + `ds` int(11) NULL COMMENT "", + `tx` int(11) NULL COMMENT "", + `v4` varchar(65533) NULL COMMENT "", + `v6` varchar(65533) NULL COMMENT "", + `s4` varchar(65533) NULL COMMENT "", + `s6` varchar(65533) NULL COMMENT "", + `lt` float NULL COMMENT "", + `ln` float NULL COMMENT "", + `pc` int(11) NULL COMMENT "", + `lo` varchar(65533) NULL COMMENT "", + `ct` varchar(65533) NULL COMMENT "", + `uc` varchar(65533) NULL COMMENT "", + `oi` varchar(65533) NULL COMMENT "", + `enriched_attrs` struct NULL COMMENT "", + `ti` int(11) NULL COMMENT "", + `pa` int(11) NULL COMMENT "", + `tg` array NULL COMMENT "", + `ix` array NULL COMMENT "", + `fi` varchar(65533) NULL COMMENT "", + `ft` varchar(65533) NULL COMMENT "", + `xs` varchar(65533) NULL COMMENT "", + `xt` varchar(65533) NULL COMMENT "", + `order_return_mrl_refund_requested__sms__a` struct NULL COMMENT "", + `item_deliver__sms__a` struct, dest map, source map, pkgQty struct, qtyList array>>, cInfo struct>, evtT varchar(65533), evtD varchar(65533), estDT varchar(65533), evtTZ varchar(65533)>, cPayld map, prn varchar(65533), dlvdt varchar(65533), dlvdt_ms bigint(20), orddt bigint(20), rmk varchar(65533), plf varchar(65533), omst varchar(65533), fst varchar(65533), tid varchar(65533), vnum varchar(65533), trknum varchar(65533), carnm varchar(65533), carsvc varchar(65533)> NULL COMMENT "", + `fancash__sms__a` struct NULL COMMENT "", + `item_return_dispositioned__sms__a` struct, retailtot struct, merchtot struct, merchvattot struct, merchdsptot struct, merchprmtot struct, merchvatprmtot struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxtot struct, merchtxliablty struct, txbtot struct, ntxbtot struct, dscntbtot struct, shptot struct, shpvattot struct, shpdsptot struct, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxtot struct, shptxliablty struct, hndtot struct, hndvattot struct, hnddsptot struct, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxtot struct, hndtxliablty struct, paysurchrgtot struct, paysurchrgvattot struct, paysurchrgdsptot struct, paysurchrgprmtot struct, paysurchrgvatprmtot struct, paysurchrgdspprmtot struct, paysurchrgdscntdtot struct, paysurchrgvatdscntdtot struct, paysurchrgdspdscntdtot struct, paysurchrgtxtot struct, paysurchrgtxliablty struct, deldutypaidtot struct, deldutypaidvattot struct, deldutypaiddsptot struct, deldutypaidprmtot struct, deldutypaidvatprmtot struct, deldutypaiddspprmtot struct, deldutypaiddscntdtot struct, deldutypaidvatdscntdtot struct, deldutypaiddspdscntdtot struct, deldutypaidtxtot struct, deldutypaidtxliablty struct, rstkfee struct, mrltot struct, mrlprmtot struct, mrldscntdtot struct, mrltxamt struct, ordtot struct, ltyearned struct, ltyused struct, accttot struct, shpnet struct, savetot struct, recvd boolean, rfndb boolean, zcrr boolean, mrlwvd boolean, prmtot struct, txtot struct, lnitms array>, qty int(11), shpqty int(11), uom varchar(65533), txexempt boolean, prmapp boolean, mrkdnamt struct, mrkdntot struct, retailprice struct, retailtot struct, merchprice struct, merchtot struct, merchvatdtls varchar(65533), merchvatratedtrm varchar(65533), merchvatrate float, merchpricedvatrate float, merchvatcntry varchar(65533), merchvatamt struct, merchvattot struct, merchdspprice struct, merchdsptot struct, merchprmpct float, merchprmamt struct, merchprmtot struct, merchvatprmamt struct, merchvatprmtot struct, merchdspprmamt struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxrate float, merchtxtot struct, merchtxliablty struct, shptot struct, shpvatdtls varchar(65533), shpvatratedtrm varchar(65533), shpvatrate float, shppricedvatrate float, shpvatcntry varchar(65533), shpvattot struct, shpdsptot struct, shpprmpct float, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxrate float, shptxtot struct, shptxliablty struct, hndtot struct, hndvatdtls varchar(65533), hndvatratedtrm varchar(65533), hndvatrate float, hndpricedvatrate float, hndvatcntry varchar(65533), hndvattot struct, hnddsptot struct, hndprmpct float, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxrate float, hndtxtot struct, hndtxliablty struct, paysurchrgtot struct, paysurchrgvatdtls varchar(65533), paysurchrgvatratedtrm varchar(65533), paysurchrgvatrate float, paysurchrgpricedvatrate float, paysurchrgvatcntry varchar(65533), paysurchrgvattot struct, paysurchrgdsptot struct, paysurchrgprmpct float, paysurchrgprmtot struct, paysurchrgvatprmtot struct, paysurchrgdspprmtot struct, paysurchrgdscntdtot struct, paysurchrgvatdscntdtot struct, paysurchrgdspdscntdtot struct, paysurchrgtxrate float, paysurchrgtxtot struct, paysurchrgtxliablty struct, deldutypaiddtls struct, deldutypaidrate float, deldutypaidamt struct, deldutypaidtot struct, deldutypaidvatdtls varchar(65533), deldutypaidvatratedtrm varchar(65533), deldutypaidvatrate float, deldutypaidpricedvatrate float, deldutypaidvatcntry varchar(65533), deldutypaidvatamt struct, deldutypaidvattot struct, deldutypaiddspamt struct, deldutypaiddsptot struct, deldutypaidprmpct varchar(65533), deldutypaidprmamt varchar(65533), deldutypaidprmtot struct, deldutypaidvatprmamt struct, deldutypaidvatprmtot struct, deldutypaiddspprmtot struct, deldutypaiddscntdtot struct, deldutypaidvatdscntdtot struct, deldutypaiddspdscntdtot struct, deldutypaidtxrate float, deldutypaidtxtot struct, deldutypaidtxliablty struct, rstkfee struct, lnitmtot struct, ltyearned struct, ltyused struct, prmreimb struct, prmtot struct, txtot struct, cdi array>, fdi array>, autodispitm boolean, mrltot struct, mrlprmtot struct, mrldscntdtot struct, autodispdtls varchar(65533)>>, payment struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>, refund struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>> NULL COMMENT "", + `item_appeasement__sms__a` struct, merchvattot struct, merchdsptot struct, merchprmtot struct, merchvatprmtot struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxtot struct, merchtxliablty struct, txbtot struct, ntxbtot struct, dscntbtot struct, shptot struct, shpvattot struct, shpdsptot struct, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxtot struct, shptxliablty struct, hndtot struct, hndvattot struct, hnddsptot struct, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxtot struct, hndtxliablty struct, ordtot struct, ltyearned struct, ltyused struct, prmtot struct, txtot struct, appitms array>, qty int(11), shpqty int(11), uom varchar(65533), txexempt boolean, prmapp boolean, mrkdnamt struct, mrkdntot struct, retailprice struct, retailtot struct, merchprice struct, merchtot struct, merchvatdtls varchar(65533), merchvatratedtrm varchar(65533), merchvatrate float, merchpricedvatrate float, merchvatcntry varchar(65533), merchvatamt struct, merchvattot struct, merchdspprice struct, merchdsptot struct, merchprmpct float, merchprmamt struct, merchprmtot struct, merchvatprmamt struct, merchvatprmtot struct, merchdspprmamt struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxrate float, merchtxtot struct, merchtxliablty struct, shptot struct, shpvatdtls varchar(65533), shpvatratedtrm varchar(65533), shpvatrate float, shppricedvatrate float, shpvatcntry varchar(65533), shpvattot struct, shpdsptot struct, shpprmpct float, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxrate float, shptxtot struct, shptxliablty struct, hndtot struct, hndvatdtls varchar(65533), hndvatratedtrm varchar(65533), hndvatrate float, hndpricedvatrate float, hndvatcntry varchar(65533), hndvattot struct, hnddsptot struct, hndprmpct float, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxrate float, hndtxtot struct, hndtxliablty struct, lnitmtot struct, ltyearned struct, ltyused struct, prmtot struct, txtot struct, prmreimb struct, mrltot struct, mrlprmtot struct, mrldscntdtot struct>>, payment struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>, refund struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>> NULL COMMENT "", + `order_shipping_address_update_requested__sms__a` struct NULL COMMENT "", + `item_out_for_delivery__sms__a` struct, dest map, source map, pkgQty struct, qtyList array>>, cInfo struct>, evtT varchar(65533), evtD varchar(65533), estDT varchar(65533), evtTZ varchar(65533)>, cPayld map, prn varchar(65533), ofddt varchar(65533), ofddt_ms bigint(20), rmk varchar(65533), plf varchar(65533), omst varchar(65533), fst varchar(65533), tid varchar(65533), vnum varchar(65533), trknum varchar(65533), carnm varchar(65533), carsvc varchar(65533), orig varchar(65533), origst varchar(65533), dest varchar(65533), destst varchar(65533)> NULL COMMENT "", + `item_carrier_notified__sms__a` struct, dest map, source map, pkgQty struct, qtyList array>>, cInfo struct>, evtT varchar(65533), evtD varchar(65533), estDT varchar(65533), evtTZ varchar(65533)>, cPayld struct>>, wt varchar(65533), wtuom varchar(65533), freight float, fuom varchar(65533)>, prn varchar(65533), ntfdt varchar(65533), ntfdt_ms bigint(20), rmk varchar(65533), orddt bigint(20), plf varchar(65533), omst varchar(65533), fst varchar(65533), tid varchar(65533), vnum varchar(65533), poi varchar(65533), osid varchar(65533), ossid varchar(65533), doid varchar(65533), soid varchar(65533), lang varchar(65533), locale varchar(65533), trknum varchar(65533), carnm varchar(65533), carsvc varchar(65533), med varchar(65533), med_ms bigint(20), dmd varchar(65533), ced varchar(65533), ced_ms bigint(20)> NULL COMMENT "", + `order_fraudstatus_reject__sms__a` struct NULL COMMENT "", + `order_shipping_method_update_requested__sms__a` struct NULL COMMENT "", + `item_refund_requested__sms__a` struct NULL COMMENT "", + `account_phone_change_notify__sms__a` struct NULL COMMENT "", + `notifyme__sms__a` struct NULL COMMENT "", + `item_cancelled__sms__a` struct, merchvattot struct, merchdsptot struct, merchprmtot struct, merchvatprmtot struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxtot struct, merchtxliablty struct, txbtot struct, ntxbtot struct, dscntbtot struct, shptot struct, shpvattot struct, shpdsptot struct, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxtot struct, shptxliablty struct, hndtot struct, hndvattot struct, hnddsptot struct, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxtot struct, hndtxliablty struct, ordtot struct, ltyearned struct, ltyused struct, prmtot struct, txtot struct, cnclitms array>, qty int(11), shpqty int(11), supcnclqty int(11), uom varchar(65533), txexempt boolean, prmapp boolean, mrkdnamt struct, mrkdntot struct, retailprice struct, retailtot struct, merchprice struct, merchtot struct, merchvatdtls varchar(65533), merchvatratedtrm varchar(65533), merchvatrate float, merchpricedvatrate float, merchvatcntry varchar(65533), merchvatamt struct, merchvattot struct, merchdspprice struct, merchdsptot struct, merchprmpct float, merchprmamt struct, merchprmtot struct, merchvatprmamt struct, merchvatprmtot struct, merchdspprmamt struct, merchdspprmtot struct, merchdscntdtot struct, merchvatdscntdtot struct, merchdspdscntdtot struct, merchtxrate float, merchtxtot struct, merchtxliablty struct, shptot struct, shpvatdtls varchar(65533), shpvatratedtrm varchar(65533), shpvatrate float, shppricedvatrate float, shpvatcntry varchar(65533), shpvattot struct, shpdsptot struct, shpprmpct float, shpprmtot struct, shpvatprmtot struct, shpdspprmtot struct, shpdscntdtot struct, shpvatdscntdtot struct, shpdspdscntdtot struct, shptxrate float, shptxtot struct, shptxliablty struct, hndtot struct, hndvatdtls varchar(65533), hndvatratedtrm varchar(65533), hndvatrate float, hndpricedvatrate float, hndvatcntry varchar(65533), hndvattot struct, hnddsptot struct, hndprmpct float, hndprmtot struct, hndvatprmtot struct, hnddspprmtot struct, hnddscntdtot struct, hndvatdscntdtot struct, hnddspdscntdtot struct, hndtxrate float, hndtxtot struct, hndtxliablty struct, lnitmtot struct, ltyearned struct, ltyused struct, prmtot struct, txtot struct, prmreimb struct, mrltot struct, mrlprmtot struct, mrldscntdtot struct>>, shpgrps array, shpgrpitms array>, dmdcd varchar(65533), rsg varchar(65533)>>, payment struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>, refund struct, merchtxtot struct, shptot struct, shptxtot struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct, adjtot struct, ltyclaw struct>, lnitms array, merchtxtot struct, shptot struct, shptxtot struct, litot struct, ltyclaw struct, hndtot struct, hndtxtot struct, mrltot struct, mrltxtot struct, rstkfee struct>>>, extrefval array>> NULL COMMENT "", + `account_phone_change_confirm__sms__a` struct NULL COMMENT "", + `order_return_mrl_waive_requested__sms__a` struct NULL COMMENT "", + `item_distribution_reship_requested__sms__a` struct NULL COMMENT "", + `order_recovery_payment_rejected__sms__a` struct NULL COMMENT "", + `notification__sms__a` struct NULL COMMENT "", + `checkoutcs__sms__a` struct NULL COMMENT "", + `order_recovery_payment_error__sms__a` struct NULL COMMENT "", + `account_one_time_code_sms__sms__a` struct NULL COMMENT "" +) ENGINE=OLAP +DUPLICATE KEY(`ts`) +COMMENT "OLAP" +PARTITION BY time_slice(ts, 720, 'hour', 'floor') +DISTRIBUTED BY HASH(`si`) BUCKETS 9 +PROPERTIES ( +"replication_num" = "1", +"in_memory" = "false", +"enable_persistent_index" = "true", +"replicated_storage" = "true", +"fast_schema_evolution" = "true", +"partition_live_number" = "1", +"compression" = "LZ4" +); + +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "format: json" -T ${root_path}/lib/../common/data/stream_load/sr_struct_schema_change_data1.json -XPUT ${url}/api/test_struct_schema_change_db/tab1/_stream_load +sync; +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "format: json" -T ${root_path}/lib/../common/data/stream_load/sr_struct_schema_change_data2.json -XPUT ${url}/api/test_struct_schema_change_db/tab1/_stream_load +sync; + +select count(*) from `test_struct_schema_change_db`.`tab1`; +alter table `test_struct_schema_change_db`.`tab1` modify column item_appeasement__sms__a add field appitms.[*].supcnclqty int(11) AFTER shpqty; + +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "format: json" -T ${root_path}/lib/../common/data/stream_load/sr_struct_schema_change_data1.json -XPUT ${url}/api/test_struct_schema_change_db/tab1/_stream_load +sync; +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "format: json" -T ${root_path}/lib/../common/data/stream_load/sr_struct_schema_change_data2.json -XPUT ${url}/api/test_struct_schema_change_db/tab1/_stream_load +sync; + +select count(*) from `test_struct_schema_change_db`.`tab1`; + +drop database test_struct_schema_change_db force; \ No newline at end of file