@@ -44,7 +44,25 @@ Y_UNIT_TEST_SUITE(KqpOlapSparsed) {
4444 return GetUint64 (rows[0 ].at (" count" ));
4545 }
4646
47- ui32 GetDefaultsCount (const TString& fieldName, const TString& defValueStr) const {
47+ ui32 GetDefaultsCount (const TString& fieldName, const TString& defValueStr, std::set<ui32>* notDefaultIds = nullptr ) const {
48+ {
49+ auto selectQueryTmpl = TString (R"( SELECT pk_int FROM `/Root/)" ) + (StoreName.empty () ? " " : StoreName + " /" ) +
50+ R"( olapTable`
51+ WHERE %s != %s
52+ ORDER BY pk_int
53+ )" ;
54+
55+ auto tableClient = Kikimr.GetTableClient ();
56+ auto rows = ExecuteScanQuery (tableClient, Sprintf (selectQueryTmpl.c_str (), fieldName.c_str (), defValueStr.c_str ()));
57+ if (notDefaultIds) {
58+ std::set<ui32> result;
59+ for (auto && i : rows) {
60+ AFL_VERIFY (result.emplace (GetInt64 (i.at (" pk_int" ))).second );
61+ }
62+ *notDefaultIds = result;
63+ }
64+
65+ }
4866 auto selectQueryTmpl = TString (R"(
4967 SELECT
5068 count(*) as count,
@@ -116,12 +134,26 @@ Y_UNIT_TEST_SUITE(KqpOlapSparsed) {
116134 }
117135 }
118136
119- void CheckTable (const TString& fieldName, const TString& defValueStr, bool firstCall, ui32 countExpectation, ui32& defCountStart) {
120- const ui32 defCount = GetDefaultsCount (fieldName, defValueStr);
137+ void CheckTable (const TString& fieldName, const TString& defValueStr, bool firstCall, ui32 countExpectation, ui32& defCountStart, std::set<ui32>* notDefaultValues = nullptr ) {
138+ std::set<ui32> ndvLocal;
139+ const ui32 defCount = GetDefaultsCount (fieldName, defValueStr, &ndvLocal);
121140 if (firstCall) {
122141 defCountStart = defCount;
142+ if (notDefaultValues) {
143+ *notDefaultValues = ndvLocal;
144+ }
123145 } else {
124- AFL_VERIFY (defCountStart == defCount);
146+ AFL_VERIFY (defCountStart == defCount)(" start" , defCountStart)(" current" , defCount);
147+ if (notDefaultValues) {
148+ auto it1 = ndvLocal.begin ();
149+ auto it2 = notDefaultValues->begin ();
150+ while (it1 != ndvLocal.end () && it2 != notDefaultValues->end ()) {
151+ AFL_VERIFY (*it1 == *it2)(" local" , *it1)(" check" , *it2)(" local_size" , ndvLocal.size ())(" check_size" , notDefaultValues->size ());
152+ ++it1;
153+ ++it2;
154+ }
155+ AFL_VERIFY (ndvLocal.size () == notDefaultValues->size ())(" local" , ndvLocal.size ())(" check" , notDefaultValues->size ());
156+ }
125157 }
126158 const ui32 count = GetCount ();
127159 AFL_VERIFY (count == countExpectation)(" expect" , countExpectation)(" count" , count);
@@ -144,35 +176,28 @@ Y_UNIT_TEST_SUITE(KqpOlapSparsed) {
144176 checkTable (true );
145177 printTime (" checkTable" );
146178
147- CSController->EnableBackground (NKikimr::NYDBTest::ICSController::EBackground::Indexation);
148- CSController->WaitIndexation (TDuration::Seconds (5 ));
149- printTime (" wait" );
150-
151- checkTable (false );
152- printTime (" checkTable" );
153-
154179 CSController->EnableBackground (NKikimr::NYDBTest::ICSController::EBackground::Compaction);
155180 CSController->WaitCompactions (TDuration::Seconds (5 ));
156181 printTime (" wait" );
157182
158183 checkTable (false );
159184 printTime (" checkTable" );
160185
161- CSController->DisableBackground (NKikimr::NYDBTest::ICSController::EBackground::Indexation);
162186 CSController->DisableBackground (NKikimr::NYDBTest::ICSController::EBackground::Compaction);
163187 printTime (" wait" );
164188 }
165189
166190 void FillCircle (const double shiftKff, const ui32 countExpectation) {
167191 ui32 defCountStart = (ui32)-1 ;
192+ std::set<ui32> notDefaultValues;
168193 FillCircleImpl ([&]() {
169194 TTypedLocalHelper helper (" Utf8" , Kikimr, " olapTable" , StoreName);
170195 const double frq = 0.9 ;
171196 NArrow::NConstruction::TStringPoolFiller sPool (1000 , 52 , " abcde" , frq);
172197 helper.FillTable (sPool , shiftKff, 10000 );
173198 },
174199 [&](bool firstCall) {
175- CheckTable (" field" , " 'abcde'" , firstCall, countExpectation, defCountStart);
200+ CheckTable (" field" , " 'abcde'" , firstCall, countExpectation, defCountStart, ¬DefaultValues );
176201 });
177202 }
178203
@@ -212,7 +237,8 @@ Y_UNIT_TEST_SUITE(KqpOlapSparsed) {
212237 )
213238 PARTITION BY HASH(pk_int)
214239 WITH (
215- STORE = COLUMN
240+ STORE = COLUMN,
241+ PARTITION_COUNT = 64
216242 ))" ;
217243 auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
218244 UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), NYdb::EStatus::SUCCESS, result.GetIssues ().ToString ());
0 commit comments