fresh-borzoni commented on code in PR #611:
URL: https://github.com/apache/fluss-rust/pull/611#discussion_r3442350467
##########
bindings/cpp/test/test_kv_table.cpp:
##########
@@ -212,24 +214,776 @@ TEST_F(KvTableTest, LookupWithNestedArrayArrayView) {
fluss::LookupResult result;
ASSERT_OK(lookuper.Lookup(key, result));
ASSERT_TRUE(result.Found());
- EXPECT_EQ(result.GetArraySize("matrix"), 2u);
- EXPECT_EQ(result.GetArrayElementType("matrix"), fluss::TypeId::Array);
-
- auto outer = result.GetArrayView("matrix");
+ auto outer = result.GetValue("matrix");
+ EXPECT_EQ(outer.Type(), fluss::TypeId::Array);
ASSERT_EQ(outer.Size(), 2u);
- EXPECT_EQ(outer.ElementType(), fluss::TypeId::Array);
- auto first = outer.GetArray(0);
+ auto first = outer.At(0);
+ EXPECT_EQ(first.Type(), fluss::TypeId::Array);
ASSERT_EQ(first.Size(), 2u);
- EXPECT_EQ(first.ElementType(), fluss::TypeId::Int);
- EXPECT_EQ(first.GetInt32(0), 11);
- EXPECT_EQ(first.GetInt32(1), 12);
+ EXPECT_EQ(first.At(0).GetInt32(), 11);
+ EXPECT_EQ(first.At(1).GetInt32(), 12);
- auto second = outer.GetArray(1);
+ auto second = outer.At(1);
ASSERT_EQ(second.Size(), 2u);
- EXPECT_EQ(second.ElementType(), fluss::TypeId::Int);
- EXPECT_EQ(second.GetInt32(0), 21);
- EXPECT_EQ(second.GetInt32(1), 22);
+ EXPECT_EQ(second.At(0).GetInt32(), 21);
+ EXPECT_EQ(second.At(1).GetInt32(), 22);
+
+ ASSERT_OK(adm.DropTable(table_path, false));
+}
+
+TEST_F(KvTableTest, LookupComplexTypesMatrix) {
+ auto& adm = admin();
+ auto& conn = connection();
+
+ fluss::TablePath table_path("fluss", "test_lookup_complex_matrix_cpp");
+
+ auto row_seq_label = arrow::struct_(
+ {arrow::field("seq", arrow::int32()), arrow::field("label",
arrow::utf8())});
+
+ auto arrow_schema = arrow::schema({
+ arrow::field("id", arrow::int32()),
+ arrow::field("m_str_int", arrow::map(arrow::utf8(), arrow::int32())),
+ arrow::field("m_str_row", arrow::map(arrow::utf8(), row_seq_label)),
+ arrow::field("m_str_map",
+ arrow::map(arrow::utf8(), arrow::map(arrow::utf8(),
arrow::int32()))),
+ arrow::field("m_str_arr", arrow::map(arrow::utf8(),
arrow::list(arrow::int32()))),
+ arrow::field("arr_map", arrow::list(arrow::map(arrow::utf8(),
arrow::int32()))),
Review Comment:
Hmm, actually it's C++ specific thing, so after another thought - it's worth
adding still
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]