Skip to content

Commit

Permalink
[BugFix] fix replaceNullType2Boolean when handle struct type (#50506)
Browse files Browse the repository at this point in the history
Signed-off-by: luohaha <[email protected]>
  • Loading branch information
luohaha committed Sep 2, 2024
1 parent 907648b commit a3e7988
Show file tree
Hide file tree
Showing 6 changed files with 748 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public int getPosition() {
return position;
}

public int getFieldId() {
return fieldId;
}

public void setPosition(int position) {
this.position = position;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,8 @@ public static Type replaceNullType2Boolean(Type type) {
} else if (type.isStructType()) {
ArrayList<StructField> 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);
}
Expand Down
325 changes: 325 additions & 0 deletions test/common/data/stream_load/sr_struct_schema_change_data1.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
}
}
Loading

0 comments on commit a3e7988

Please sign in to comment.