Skip to content

Commit eb46d1e

Browse files
authored
[fix](regression) Stabilize variant hirachinal array output (#63610)
Stabilize the variant predefine hirachinal regression output by serializing `v['c']` through JSON instead of relying on variant string formatting, which can differ in insignificant array whitespace.
1 parent dc6d28a commit eb46d1e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

regression-test/data/variant_p0/predefine/variant_hirachinal.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
6 {"a":1234,"xxxx":"kaana"}
1313

1414
-- !sql --
15-
[1, 2, 3]
15+
[1,2,3]
1616
{"c":456,"d":"null","e":7.111}
1717

1818
-- !sql --

regression-test/suites/variant_p0/predefine/variant_hirachinal.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ suite("regression_test_variant_predefine_hirachinal", "variant_type"){
3333
sql """insert into ${table_name} select * from (select -2, '{"a": 11245, "b" : [123, {"xx" : 1}], "c" : {"c" : 456, "d" : "null", "e" : 7.111}}' as json_str
3434
union all select -1, '{"a": 1123}' as json_str union all select *, '{"a" : 1234, "xxxx" : "kaana"}' as json_str from numbers("number" = "4096"))t order by 1 limit 4098 ;"""
3535
qt_sql "select * from ${table_name} order by k limit 10"
36-
qt_sql "select cast(v['c'] as string) from ${table_name} where k = -3 or k = -2 order by k"
36+
qt_sql "select cast(v['c'] as json) from ${table_name} where k = -3 or k = -2 order by k"
3737
qt_sql "select v['b'] from ${table_name} where k = -3 or k = -2"
3838
sql """insert into ${table_name} values (-3, '{"c" : 12345}')"""
39-
order_qt_sql1 "select cast(v['c'] as string) from var_rs where k = -3 or k = -2 or k = -4 or (k = 1 and v['c'] = 1024) order by k"
40-
order_qt_sql2 "select cast(v['c'] as string) from var_rs where k = -3 or k = -2 or k = 1 order by k, cast(v['c'] as text) limit 3"
41-
}
39+
order_qt_sql1 "select cast(v['c'] as json) from var_rs where k = -3 or k = -2 or k = -4 or (k = 1 and v['c'] = 1024) order by k"
40+
order_qt_sql2 "select cast(v['c'] as json) from var_rs where k = -3 or k = -2 or k = 1 order by k, cast(v['c'] as text) limit 3"
41+
}

0 commit comments

Comments
 (0)