sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java
/**
   * Find a string that is either equal to "basePrefix", or basePrefix prepended by underscores, and where nothing in
   * "strings" starts with prefix plus a digit.
   */
Find a string that is either equal to "basePrefix", or basePrefix prepended by underscores, and where nothing in
"strings" starts with prefix plus a digit.
Find a string that is either equal to " basePrefix " or basePrefix prepended by underscores and where nothing in " strings " starts with prefix plus a digit .
public static String findUnusedPrefixForDigits(final String basePrefix, final Iterable<String> strings)
  {
    final NavigableSet<String> navigableStrings;
    if (strings instanceof NavigableSet) {
      navigableStrings = (NavigableSet<String>) strings;
    } else {
      navigableStrings = new TreeSet<>();
      Iterables.addAll(navigableStrings, strings);
    }
    String prefix = basePrefix;
    while (!isUnusedPrefix(prefix, navigableStrings)) {
      prefix = "_" + prefix;
    }
    return prefix;
  }
public static String findUnusedPrefixForDigits ( final String basePrefix , final Iterable < String > strings ) { final NavigableSet < String > navigableStrings ; if ( strings instanceof NavigableSet ) { navigableStrings = ( NavigableSet < String > ) strings ; } else { navigableStrings = new TreeSet < > ( ) ; Iterables . addAll ( navigableStrings , strings ) ; } String prefix = basePrefix ; while ( ! isUnusedPrefix ( prefix , navigableStrings ) ) { prefix = "_" + prefix ; } return prefix ; }
Find a string that is either equal to "basePrefix", or basePrefix prepended by underscores, and where nothing in
 "strings" starts with prefix plus a digit.
Find a string that is either equal to " basePrefix " or basePrefix prepended by underscores and where nothing in " strings " starts with prefix plus a digit .