@@ -418,39 +418,39 @@ public static void setDataTableScanFilter(
418418 final boolean explicit_tags ,
419419 final boolean enable_fuzzy_filter ,
420420 final int end_time ) {
421-
421+
422422 // no-op
423- if ((group_bys == null || group_bys .isEmpty ())
424- && (row_key_literals == null || row_key_literals .isEmpty ())) {
423+ if ((group_bys == null || group_bys .isEmpty ())
424+ && (row_key_literals == null || row_key_literals .isEmpty ())) {
425425 return ;
426426 }
427-
427+
428428 if (group_bys != null ) {
429429 Collections .sort (group_bys , Bytes .MEMCMP );
430430 }
431431
432432 final int prefix_width = Const .SALT_WIDTH () + TSDB .metrics_width () +
433- Const .TIMESTAMP_BYTES ;
433+ Const .TIMESTAMP_BYTES ;
434434
435435 final FuzzyRowFilter fuzzy_filter ;
436436 if (explicit_tags &&
437- enable_fuzzy_filter &&
438- row_key_literals != null &&
439- !row_key_literals .isEmpty ()) {
437+ enable_fuzzy_filter &&
438+ row_key_literals != null &&
439+ !row_key_literals .isEmpty ()) {
440440
441441 final byte [] fuzzy_key = new byte [prefix_width + (row_key_literals .size () *
442- (TSDB .tagk_width () + TSDB .tagv_width ()))];
442+ (TSDB .tagk_width () + TSDB .tagv_width ()))];
443443 System .arraycopy (scanner .getCurrentKey (), 0 , fuzzy_key , 0 ,
444- scanner .getCurrentKey ().length );
444+ scanner .getCurrentKey ().length );
445445
446446 final List <FuzzyFilterPair > fuzzy_filter_pairs =
447- buildFuzzyFilters (row_key_literals , fuzzy_key );
447+ buildFuzzyFilters (row_key_literals , fuzzy_key );
448448
449449 // The Fuzzy Filter list is sorted: the first and last filters row key
450450 // can be used to build the stop key for the scanner
451451 final byte [] stop_key = Arrays .copyOf (
452- fuzzy_filter_pairs .get (fuzzy_filter_pairs .size () - 1 ).getRowKey (),
453- fuzzy_key .length );
452+ fuzzy_filter_pairs .get (fuzzy_filter_pairs .size () - 1 ).getRowKey (),
453+ fuzzy_key .length );
454454 System .arraycopy (scanner .getCurrentKey (), 0 , stop_key , 0 , prefix_width );
455455 Internal .setBaseTime (stop_key , end_time );
456456 int idx = prefix_width + TSDB .tagk_width ();
@@ -474,66 +474,25 @@ public static void setDataTableScanFilter(
474474 if (!Strings .isNullOrEmpty (regex )) {
475475 if (LOG .isDebugEnabled ()) {
476476 LOG .debug ("Regex for scanner: " + scanner + ": " +
477- byteRegexToString (regex ));
477+ byteRegexToString (regex ));
478478 }
479479 regex_filter = new KeyRegexpFilter (regex .toString (),
480- Const .ASCII_CHARSET );
480+ Const .ASCII_CHARSET );
481481 } else {
482482 regex_filter = null ;
483483 }
484484
485485 if (fuzzy_filter != null && !Strings .isNullOrEmpty (regex )) {
486486 final FilterList filter = new FilterList (Lists .newArrayList (fuzzy_filter ,
487- regex_filter ),Operator .MUST_PASS_ALL );
487+ regex_filter ), Operator .MUST_PASS_ALL );
488488 scanner .setFilter (filter );
489489 } else if (fuzzy_filter != null ) {
490490 scanner .setFilter (fuzzy_filter );
491491 } else if (!Strings .isNullOrEmpty (regex )) {
492492 scanner .setFilter (regex_filter );
493493 }
494-
495- if (explicit_tags && enable_fuzzy_filter ) {
496- final List <FuzzyFilterPair > fuzzy_filter_pairs =
497- buildFuzzyFilters (row_key_literals );
498-
499- // The Fuzzy Filter list is sorted: the first and last filters row key
500- // can be used to build a start and stop keys for the scanner
501- final byte [] start_key = Arrays .copyOf (
502- fuzzy_filter_pairs .get (0 ).getRowKey (),
503- fuzzy_filter_pairs .get (0 ).getRowKey ().length );
504- System .arraycopy (scanner .getCurrentKey (), 0 , start_key , 0 , prefix_width );
505-
506- final byte [] stop_key = Arrays .copyOf (
507- fuzzy_filter_pairs .get (fuzzy_filter_pairs .size ()-1 ).getRowKey (),
508- start_key .length );
509- System .arraycopy (scanner .getCurrentKey (), 0 ,
510- stop_key , 0 , prefix_width );
511- Internal .setBaseTime (stop_key , end_time );
512- int idx = prefix_width + TSDB .tagk_width ();
513- // max out the tag values
514- while (idx < stop_key .length ) {
515- for (int i = 0 ; i < TSDB .tagv_width (); i ++) {
516- stop_key [idx ++] = (byte ) 0xFF ;
517- }
518- idx += TSDB .tagk_width ();
519- }
520-
521- scanner .setStartKey (start_key );
522- scanner .setStopKey (stop_key );
523- scanner .setFilter (new FuzzyRowFilter (fuzzy_filter_pairs ));
524- } else {
525- final String regex = getRowKeyUIDRegex (row_key_literals , explicit_tags );
526- final KeyRegexpFilter regex_filter = new KeyRegexpFilter (
527- regex .toString (), Const .ASCII_CHARSET );
528- if (LOG .isDebugEnabled ()) {
529- LOG .debug ("Regex for scanner: " + scanner + ": " +
530- byteRegexToString (regex ));
531- }
532-
533- scanner .setFilter (regex_filter );
534- }
535494 }
536-
495+
537496 /**
538497 * Creates a regular expression with a list of or'd TUIDs to compare
539498 * against the rows in storage.
0 commit comments