Skip to content

Commit 97b3ad5

Browse files
committed
Update tests with new nested convertations
1 parent 0eac064 commit 97b3ad5

File tree

1 file changed

+26
-87
lines changed

1 file changed

+26
-87
lines changed

ydb/core/kqp/ut/arrow/kqp_result_set_formats_ut.cpp

Lines changed: 26 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ UuidNotNullValue: [
14821482

14831483
/**
14841484
* More tests for different types with correctness and convertations between Arrow and UV :
1485-
* ydb/library/yql/dq/runtime/dq_arrow_helpers_ut.cpp
1485+
* ydb/core/kqp/common/result_set_format/ut/kqp_formats_arrow_ut.cpp
14861486
*/
14871487

14881488
// Optional<T>
@@ -1565,58 +1565,8 @@ column1: -- is_valid: all not null
15651565
}
15661566
}
15671567

1568-
// Optional<Optional<Optional<Optional<T>>>>
1569-
Y_UNIT_TEST(ArrowFormat_Types_Optional_3) {
1570-
auto kikimr = CreateKikimrRunner(/* withSampleTables */ true);
1571-
auto client = kikimr.GetQueryClient();
1572-
1573-
{
1574-
auto batches = ExecuteAndCombineBatches(client, R"(
1575-
SELECT Just(Just(Just(Key1))), Just(Just(Just(Name))) FROM Join2
1576-
WHERE Key1 IN [104, 106, 108]
1577-
ORDER BY Key1;
1578-
)", /* assertSize */ false, 1);
1579-
1580-
UNIT_ASSERT_C(!batches.empty(), "Batches must not be empty");
1581-
1582-
const auto& batch = batches.front();
1583-
1584-
UNIT_ASSERT_VALUES_EQUAL(batch->num_rows(), 3);
1585-
UNIT_ASSERT_VALUES_EQUAL(batch->num_columns(), 2);
1586-
1587-
ValidateOptionalColumn(batch->column(0), 3, false);
1588-
ValidateOptionalColumn(batch->column(1), 3, false);
1589-
1590-
const TString expected =
1591-
R"(column0: -- is_valid: all not null
1592-
-- child 0 type: struct<opt: struct<opt: uint32 not null> not null>
1593-
-- is_valid: all not null
1594-
-- child 0 type: struct<opt: uint32 not null>
1595-
-- is_valid: all not null
1596-
-- child 0 type: uint32
1597-
[
1598-
104,
1599-
106,
1600-
108
1601-
]
1602-
column1: -- is_valid: all not null
1603-
-- child 0 type: struct<opt: struct<opt: binary not null> not null>
1604-
-- is_valid: all not null
1605-
-- child 0 type: struct<opt: binary not null>
1606-
-- is_valid: all not null
1607-
-- child 0 type: binary
1608-
[
1609-
4E616D6533,
1610-
4E616D6533,
1611-
null
1612-
]
1613-
)";
1614-
UNIT_ASSERT_VALUES_EQUAL(batch->ToString(), expected);
1615-
}
1616-
}
1617-
16181568
// Optional<Variant<T, F>>
1619-
Y_UNIT_TEST(ArrowFormat_Types_Optional_4) {
1569+
Y_UNIT_TEST(ArrowFormat_Types_Optional_3) {
16201570
auto kikimr = CreateKikimrRunner(/* withSampleTables */ false);
16211571
auto client = kikimr.GetQueryClient();
16221572

@@ -1656,7 +1606,7 @@ R"(column0: -- is_valid: all not null
16561606
}
16571607

16581608
// Optional<Optional<Variant<T, F, G>>>
1659-
Y_UNIT_TEST(ArrowFormat_Types_Optional_5) {
1609+
Y_UNIT_TEST(ArrowFormat_Types_Optional_4) {
16601610
auto kikimr = CreateKikimrRunner(/* withSampleTables */ false);
16611611
auto client = kikimr.GetQueryClient();
16621612

@@ -1676,7 +1626,7 @@ R"(column0: -- is_valid: all not null
16761626

16771627
const TString expected =
16781628
R"(column0: -- is_valid: all not null
1679-
-- child 0 type: struct<opt: dense_union<bar: uint8 not null=0, foo: int32 not null=1, foobar: binary not null=2> not null>
1629+
-- child 0 type: struct<opt: dense_union<bar: uint8 not null=0, foo: int32 not null=1, foobar: binary not null=2>>
16801630
-- is_valid: all not null
16811631
-- child 0 type: dense_union<bar: uint8 not null=0, foo: int32 not null=1, foobar: binary not null=2>
16821632
-- is_valid: all not null
@@ -1899,29 +1849,24 @@ R"(column0: -- is_valid: all not null
18991849

19001850
UNIT_ASSERT_VALUES_EQUAL(batch->num_rows(), 1);
19011851
UNIT_ASSERT_VALUES_EQUAL(batch->num_columns(), 1);
1902-
UNIT_ASSERT_C(batch->column(0)->type()->id() == arrow::Type::STRUCT, "Column type must be arrow::Type::STRUCT");
1852+
UNIT_ASSERT_C(batch->column(0)->type()->id() == arrow::Type::LIST, "Column type must be arrow::Type::LIST");
19031853

19041854
const TString expected =
1905-
R"(column0: -- is_valid: all not null
1906-
-- child 0 type: map<binary, int32>
1907-
[
1908-
keys:
1855+
R"(column0: [
1856+
-- is_valid: all not null
1857+
-- child 0 type: binary
19091858
[
19101859
61,
19111860
63,
19121861
62
19131862
]
1914-
values:
1863+
-- child 1 type: int32
19151864
[
19161865
1,
19171866
3,
19181867
2
19191868
]
1920-
]
1921-
-- child 1 type: uint64
1922-
[
1923-
0
1924-
]
1869+
]
19251870
)";
19261871

19271872
UNIT_ASSERT_VALUES_EQUAL(batch->ToString(), expected);
@@ -1944,30 +1889,24 @@ R"(column0: -- is_valid: all not null
19441889

19451890
UNIT_ASSERT_VALUES_EQUAL(batch->num_rows(), 1);
19461891
UNIT_ASSERT_VALUES_EQUAL(batch->num_columns(), 1);
1947-
UNIT_ASSERT_C(batch->column(0)->type()->id() == arrow::Type::STRUCT, "Column type must be arrow::Type::STRUCT");
1892+
UNIT_ASSERT_C(batch->column(0)->type()->id() == arrow::Type::LIST, "Column type must be arrow::Type::LIST");
19481893

19491894
const TString expected =
1950-
R"(column0: -- is_valid: all not null
1951-
-- child 0 type: list<item: struct<key: binary, payload: int32 not null>>
1952-
[
1953-
-- is_valid: all not null
1954-
-- child 0 type: binary
1955-
[
1956-
61,
1957-
62,
1958-
null
1959-
]
1960-
-- child 1 type: int32
1961-
[
1962-
1,
1963-
2,
1964-
3
1965-
]
1966-
]
1967-
-- child 1 type: uint64
1968-
[
1969-
0
1970-
]
1895+
R"(column0: [
1896+
-- is_valid: all not null
1897+
-- child 0 type: binary
1898+
[
1899+
61,
1900+
62,
1901+
null
1902+
]
1903+
-- child 1 type: int32
1904+
[
1905+
1,
1906+
2,
1907+
3
1908+
]
1909+
]
19711910
)";
19721911

19731912
UNIT_ASSERT_VALUES_EQUAL(batch->ToString(), expected);

0 commit comments

Comments
 (0)