github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/internal/keyspan/testdata/merging_iter (about) 1 # Test a single level. 2 3 define 4 a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)} 5 c-d:{(#4,RANGEKEYSET,@3,coconut)} 6 e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)} 7 h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)} 8 l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)} 9 q-z:{(#14,RANGEKEYSET,@9,mangos)} 10 ---- 11 1 levels 12 13 iter 14 first 15 next 16 next 17 next 18 next 19 next 20 next 21 ---- 22 a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)} 23 c-d:{(#4,RANGEKEYSET,@3,coconut)} 24 e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)} 25 h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)} 26 l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)} 27 q-z:{(#14,RANGEKEYSET,@9,mangos)} 28 <nil> 29 30 # Test snapshot filtering. 31 32 define snapshot=12 33 a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)} 34 c-d:{(#4,RANGEKEYSET,@3,coconut)} 35 e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)} 36 h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)} 37 l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)} 38 q-z:{(#14,RANGEKEYSET,@9,mangos)} 39 ---- 40 1 levels 41 42 iter 43 first 44 next 45 next 46 next 47 next 48 next 49 next 50 ---- 51 a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)} 52 c-d:{(#4,RANGEKEYSET,@3,coconut)} 53 e-f:{} 54 h-j:{} 55 l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)} 56 q-z:{} 57 <nil> 58 59 define 60 b-d:{#10,RANGEKEYSET,@1,apples} 61 e-h:{#8,RANGEKEYDEL} 62 -- 63 a-c:{#3,RANGEKEYUNSET,@1} 64 h-k:{#5,RANGEKEYDEL} 65 ---- 66 2 levels 67 68 iter 69 first 70 next 71 next 72 next 73 next 74 next 75 ---- 76 a-b:{(#3,RANGEKEYUNSET,@1)} 77 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 78 c-d:{(#10,RANGEKEYSET,@1,apples)} 79 e-h:{(#8,RANGEKEYDEL)} 80 h-k:{(#5,RANGEKEYDEL)} 81 <nil> 82 83 iter 84 last 85 prev 86 prev 87 prev 88 prev 89 prev 90 ---- 91 h-k:{(#5,RANGEKEYDEL)} 92 e-h:{(#8,RANGEKEYDEL)} 93 c-d:{(#10,RANGEKEYSET,@1,apples)} 94 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 95 a-b:{(#3,RANGEKEYUNSET,@1)} 96 <nil> 97 98 # Test changing directions at each iterator position, reverse to forward. 99 iter 100 last 101 next 102 last 103 prev 104 next 105 ---- 106 h-k:{(#5,RANGEKEYDEL)} 107 <nil> 108 h-k:{(#5,RANGEKEYDEL)} 109 e-h:{(#8,RANGEKEYDEL)} 110 h-k:{(#5,RANGEKEYDEL)} 111 112 iter 113 last 114 prev 115 prev 116 next 117 ---- 118 h-k:{(#5,RANGEKEYDEL)} 119 e-h:{(#8,RANGEKEYDEL)} 120 c-d:{(#10,RANGEKEYSET,@1,apples)} 121 e-h:{(#8,RANGEKEYDEL)} 122 123 iter 124 last 125 prev 126 prev 127 prev 128 next 129 ---- 130 h-k:{(#5,RANGEKEYDEL)} 131 e-h:{(#8,RANGEKEYDEL)} 132 c-d:{(#10,RANGEKEYSET,@1,apples)} 133 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 134 c-d:{(#10,RANGEKEYSET,@1,apples)} 135 136 iter 137 last 138 prev 139 prev 140 prev 141 prev 142 next 143 ---- 144 h-k:{(#5,RANGEKEYDEL)} 145 e-h:{(#8,RANGEKEYDEL)} 146 c-d:{(#10,RANGEKEYSET,@1,apples)} 147 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 148 a-b:{(#3,RANGEKEYUNSET,@1)} 149 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 150 151 iter 152 last 153 prev 154 prev 155 prev 156 prev 157 prev 158 next 159 ---- 160 h-k:{(#5,RANGEKEYDEL)} 161 e-h:{(#8,RANGEKEYDEL)} 162 c-d:{(#10,RANGEKEYSET,@1,apples)} 163 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 164 a-b:{(#3,RANGEKEYUNSET,@1)} 165 <nil> 166 a-b:{(#3,RANGEKEYUNSET,@1)} 167 168 # Test changing directions at each iterator position, forward to reverse. 169 170 iter 171 first 172 prev 173 first 174 next 175 prev 176 ---- 177 a-b:{(#3,RANGEKEYUNSET,@1)} 178 <nil> 179 a-b:{(#3,RANGEKEYUNSET,@1)} 180 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 181 a-b:{(#3,RANGEKEYUNSET,@1)} 182 183 iter 184 first 185 next 186 next 187 prev 188 ---- 189 a-b:{(#3,RANGEKEYUNSET,@1)} 190 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 191 c-d:{(#10,RANGEKEYSET,@1,apples)} 192 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 193 194 iter 195 first 196 next 197 next 198 next 199 prev 200 ---- 201 a-b:{(#3,RANGEKEYUNSET,@1)} 202 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 203 c-d:{(#10,RANGEKEYSET,@1,apples)} 204 e-h:{(#8,RANGEKEYDEL)} 205 c-d:{(#10,RANGEKEYSET,@1,apples)} 206 207 iter 208 first 209 next 210 next 211 next 212 next 213 next 214 prev 215 ---- 216 a-b:{(#3,RANGEKEYUNSET,@1)} 217 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 218 c-d:{(#10,RANGEKEYSET,@1,apples)} 219 e-h:{(#8,RANGEKEYDEL)} 220 h-k:{(#5,RANGEKEYDEL)} 221 <nil> 222 h-k:{(#5,RANGEKEYDEL)} 223 224 iter 225 first 226 next 227 next 228 next 229 next 230 prev 231 ---- 232 a-b:{(#3,RANGEKEYUNSET,@1)} 233 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 234 c-d:{(#10,RANGEKEYSET,@1,apples)} 235 e-h:{(#8,RANGEKEYDEL)} 236 h-k:{(#5,RANGEKEYDEL)} 237 e-h:{(#8,RANGEKEYDEL)} 238 239 # Test SeekGE. Note that MergingIter's SeekGE implements the FragmentIterator's 240 # SeekGE semantics. It returns the first fragment with a Start key ≥ the search 241 # key, NOT the first fragment that covers a key ≥ the search key. 242 243 iter 244 seek-ge cc 245 ---- 246 e-h:{(#8,RANGEKEYDEL)} 247 248 iter 249 seek-ge 1 250 seek-ge a 251 seek-ge b 252 seek-ge bb 253 seek-ge c 254 seek-ge cc 255 seek-ge e 256 seek-ge f 257 seek-ge h 258 seek-ge i 259 ---- 260 a-b:{(#3,RANGEKEYUNSET,@1)} 261 a-b:{(#3,RANGEKEYUNSET,@1)} 262 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 263 c-d:{(#10,RANGEKEYSET,@1,apples)} 264 c-d:{(#10,RANGEKEYSET,@1,apples)} 265 e-h:{(#8,RANGEKEYDEL)} 266 e-h:{(#8,RANGEKEYDEL)} 267 h-k:{(#5,RANGEKEYDEL)} 268 h-k:{(#5,RANGEKEYDEL)} 269 <nil> 270 271 # Test SeekLT. Note that MergingIter's SeekLT implements the FragmentIterator's 272 # SeekLT semantics. It returns the first fragment with a Start key < the search 273 # key, NOT the first fragment that covers a key < the search key. 274 # 275 # NB: seek-lt bb finds b-c#3.RANGEKEYUNSET (the last fragment with the bounds 276 # [b,c), unlike the above seek-ge b which finds the first). 277 278 iter 279 seek-lt b 280 ---- 281 a-b:{(#3,RANGEKEYUNSET,@1)} 282 283 iter 284 seek-lt 1 285 seek-lt a 286 seek-lt aa 287 seek-lt b 288 seek-lt bb 289 seek-lt c 290 seek-lt cc 291 seek-lt d 292 seek-lt dd 293 seek-lt e 294 seek-lt ee 295 seek-lt h 296 seek-lt hh 297 seek-lt k 298 seek-lt z 299 ---- 300 <nil> 301 <nil> 302 a-b:{(#3,RANGEKEYUNSET,@1)} 303 a-b:{(#3,RANGEKEYUNSET,@1)} 304 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 305 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 306 c-d:{(#10,RANGEKEYSET,@1,apples)} 307 c-d:{(#10,RANGEKEYSET,@1,apples)} 308 c-d:{(#10,RANGEKEYSET,@1,apples)} 309 c-d:{(#10,RANGEKEYSET,@1,apples)} 310 e-h:{(#8,RANGEKEYDEL)} 311 e-h:{(#8,RANGEKEYDEL)} 312 h-k:{(#5,RANGEKEYDEL)} 313 h-k:{(#5,RANGEKEYDEL)} 314 h-k:{(#5,RANGEKEYDEL)} 315 316 define 317 a-f:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)} 318 k-s:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)} 319 ---- 320 1 levels 321 322 iter 323 first 324 prev 325 next 326 ---- 327 a-f:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)} 328 <nil> 329 a-f:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)} 330 331 iter 332 last 333 next 334 prev 335 ---- 336 k-s:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)} 337 <nil> 338 k-s:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)} 339 340 define 341 w-x:{(#5,RANGEKEYDEL) (#3,RANGEKEYDEL)} 342 x-z:{(#5,RANGEKEYDEL)} 343 -- 344 w-y:{(#4,RANGEKEYDEL) (#1,RANGEKEYDEL)} 345 ---- 346 2 levels 347 348 iter 349 last 350 next 351 prev 352 first 353 prev 354 next 355 ---- 356 y-z:{(#5,RANGEKEYDEL)} 357 <nil> 358 y-z:{(#5,RANGEKEYDEL)} 359 w-x:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#3,RANGEKEYDEL) (#1,RANGEKEYDEL)} 360 <nil> 361 w-x:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#3,RANGEKEYDEL) (#1,RANGEKEYDEL)} 362 363 iter 364 seek-ge x 365 prev 366 seek-ge xray 367 prev 368 ---- 369 x-y:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#1,RANGEKEYDEL)} 370 w-x:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#3,RANGEKEYDEL) (#1,RANGEKEYDEL)} 371 y-z:{(#5,RANGEKEYDEL)} 372 x-y:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#1,RANGEKEYDEL)} 373 374 define 375 il-qb:{(#10,RANGEKEYDEL)} 376 sn-wn:{(#10,RANGEKEYDEL)} 377 -- 378 qt-kh:{(#9,RANGEKEYDEL) (#8,RANGEKEYDEL) (#7,RANGEKEYDEL)} 379 ky-sv:{(#8,RANGEKEYDEL) (#7,RANGEKEYDEL)} 380 -- 381 as-fz:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)} 382 hh-ir:{(#4,RANGEKEYDEL)} 383 rf-yx:{(#4,RANGEKEYDEL)} 384 ---- 385 3 levels 386 387 iter 388 seek-ge qp 389 next 390 next 391 next 392 next 393 seek-ge yz 394 prev 395 ---- 396 rf-sn:{(#8,RANGEKEYDEL) (#7,RANGEKEYDEL) (#4,RANGEKEYDEL)} 397 sn-sv:{(#10,RANGEKEYDEL) (#8,RANGEKEYDEL) (#7,RANGEKEYDEL) (#4,RANGEKEYDEL)} 398 sv-wn:{(#10,RANGEKEYDEL) (#4,RANGEKEYDEL)} 399 wn-yx:{(#4,RANGEKEYDEL)} 400 <nil> 401 <nil> 402 wn-yx:{(#4,RANGEKEYDEL)} 403 404 # Test that empty spans from child iterators are preserved 405 define 406 b-d:{#10,RANGEKEYSET,@1,apples} 407 e-f:{} 408 g-h:{#8,RANGEKEYDEL} 409 -- 410 a-c:{#3,RANGEKEYUNSET,@1} 411 h-k:{#5,RANGEKEYDEL} 412 k-m:{} 413 ---- 414 2 levels 415 416 iter 417 first 418 next 419 next 420 next 421 next 422 next 423 next 424 next 425 ---- 426 a-b:{(#3,RANGEKEYUNSET,@1)} 427 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 428 c-d:{(#10,RANGEKEYSET,@1,apples)} 429 e-f:{} 430 g-h:{(#8,RANGEKEYDEL)} 431 h-k:{(#5,RANGEKEYDEL)} 432 k-m:{} 433 <nil> 434 435 iter 436 last 437 prev 438 prev 439 prev 440 prev 441 prev 442 prev 443 prev 444 ---- 445 k-m:{} 446 h-k:{(#5,RANGEKEYDEL)} 447 g-h:{(#8,RANGEKEYDEL)} 448 e-f:{} 449 c-d:{(#10,RANGEKEYSET,@1,apples)} 450 b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)} 451 a-b:{(#3,RANGEKEYUNSET,@1)} 452 <nil>