@@ -78,6 +78,43 @@ TEST(LowCardinalityOfNullable, InsertAndQuery) {
7878 });
7979}
8080
81+ TEST (LowCardinalityOfNullable, InsertAndQueryOneRow) {
82+ const auto rowsData = std::vector<std::string> {
83+ " eminem"
84+ };
85+
86+ const auto nulls = std::vector<uint8_t > {
87+ false
88+ };
89+
90+ auto column = buildTestColumn (rowsData, nulls);
91+
92+ Block block;
93+ block.AppendColumn (" words" , column);
94+
95+ Client client (ClientOptions (localHostEndpoint)
96+ .SetBakcwardCompatibilityFeatureLowCardinalityAsWrappedColumn (false )
97+ .SetPingBeforeQuery (true ));
98+
99+ createTable (client);
100+
101+ client.Insert (" lc_of_nullable" , block);
102+
103+ client.Select (" SELECT * FROM lc_of_nullable" , [&](const Block& bl) {
104+ for (size_t row = 0 ; row < bl.GetRowCount (); row++) {
105+ auto lc_col = bl[0 ]->As <ColumnLowCardinality>();
106+ auto item = lc_col->GetItem (row);
107+
108+ if (nulls[row]) {
109+ ASSERT_EQ (Type::Code::Void, item.type );
110+ } else {
111+ ASSERT_EQ (rowsData[row], item.get <std::string_view>());
112+ }
113+ }
114+ });
115+ }
116+
117+
81118TEST (LowCardinalityOfNullable, InsertAndQueryEmpty) {
82119 auto column = buildTestColumn ({}, {});
83120
@@ -113,4 +150,4 @@ TEST(LowCardinalityOfNullable, ThrowOnBackwardsCompatibleLCColumn) {
113150 client.Select (" SELECT * FROM lc_of_nullable" , [&](const Block& bl) {
114151 ASSERT_EQ (bl.GetRowCount (), 0u );
115152 });
116- }
153+ }
0 commit comments