Moves conditions with * table alias to respective real aliases if possible
359225
private void preprocessFixedValueConditions(
            String tableAlias,
            Map<String, String> tableAliases,
            Map<String, Map<String, Set<Object>>> fixedValuesConditions
    ) {
        if (fixedValuesConditions.containsKey(ANY_TABLE)) {
            HashSet<String> columnsWithAnyTable = new HashSet<>(fixedValuesConditions.get(ANY_TABLE).keySet());
            columnsWithAnyTable.forEach(columnName -> {
                Set<String> columnTableAliases = getColumnTableAliases(columnName, tableAliases);
                if (columnTableAliases.size() == 1) {
                    Map<String, Set<Object>> additionalValues = new HashMap<String, Set<Object>>(){
                        {
                            put(columnName, fixedValuesConditions.get(ANY_TABLE).remove(columnName));
                        }
                    };
                    fixedValuesConditions.merge(tableAlias, additionalValues, ExpressionUtils::mergeFixedValueConditions);
                }
            });

            if (fixedValuesConditions.get(ANY_TABLE).isEmpty()) {
                fixedValuesConditions.remove(ANY_TABLE);
            }
        }
    }
687216
def merge_conditions(conditions)
      @conditions = Conditions::Operation.new(:and) << @conditions unless @conditions.nil?

      conditions.compact!
      conditions.each do |condition|
        case condition
          when Conditions::AbstractOperation, Conditions::AbstractComparison
            add_condition(condition)

          when Hash
            condition.each { |key, value| append_condition(key, value) }

          when Array
            statement, *bind_values = *condition
            raw_condition = [ statement ]
            raw_condition << bind_values if bind_values.size > 0
            add_condition(raw_condition)
            @raw = true
        end
      end
    end
1029413
def filter(self, table, mappings, filter_string):
        """"""
        q = filter_string.lower()
        return [mapping for mapping in mappings
                if q in mapping.ud.lower()]
422120
def transform_except_subquery(sql, func):
    """"""
    start = 0
    out = []
    while sql.find('(SELECT', start) > -1:
        pos = sql.find('(SELECT', start)
        out.append(func(sql[start:pos]))
        start, pos = find_closing_parenthesis(sql, pos)
        out.append(sql[start:pos])
        start = pos
    out.append(func(sql[start:len(sql)]))
    return ''.join(out)
1265478
def hash_to_condition(table, hash)
      conditions = hash.map do |attr, value|
        if value.is_a?(Array) && value.size > 1
          table[attr].in(value)
        elsif value.is_a?(Array)
          table[attr].eq(value[0])
        else
          table[attr].eq(value)
        end
      end

      conditions.reduce { |memo, cond| memo.and(cond) }
    end
30857
def p_fromtable(self,t):
    
    if len(t)==6: t[0]=AliasX(t[2],t[5])
    elif len(t)==2: t[0]=t[1]
    else: raise NotImplementedError('unk_len',len(t)) # pragma: no cover
850608
def handle_aliases_in_calls(name, import_alias_mapping):
    
    for key, val in import_alias_mapping.items():
        # e.g. Foo == Foo
        # e.g. Foo.Bar startswith Foo.
        if name == key or \
                name.startswith(key + '.'):

            # Replace key with val in name
            # e.g. StarbucksVisitor.Tea -> Eataly.Tea because
            #   "from .nested_folder import StarbucksVisitor as Eataly"
            return name.replace(key, val)
    return None
151775
def _compare_mp_alias(br_i, br_j, analysis_set, analysis_set_subdir, unique_ajps, verbose):
    
    return br_i.compare(br_j, analysis_set, analysis_set_subdir, unique_ajps, verbose = verbose, compile_pdf = verbose)
572515
@Override
  protected void addSiblingConditions(List<String> conditions, QueryNode node,
    QueryNode target, Sibling join, QueryData queryData)
  {
    Sibling sibling = (Sibling) join;
    String componentName = sibling.getName();
    
    // "parent" column is unique over all component IDs, thus don't add an extra join
    addComponentPredicates(conditions, node, target, componentName, "d", false);

    conditions.add(join("=", tables(node).aliasedColumn(RANK_TABLE, "parent"),
      tables(target).aliasedColumn(RANK_TABLE, "parent")));

    if (!allowIdenticalSibling)
    {
      joinOnNode(conditions, node, target, "<>", "id", "id");
    }
  }
1237940
private StmtTableScan resolveStmtTableScanByAlias(String tableAlias) {
        StmtTableScan tableScan = getStmtTableScanByAlias(tableAlias);
        if (tableScan != null) {
            return tableScan;
        }
        if (m_parentStmt != null) {
            // This may be a correlated subquery
            return m_parentStmt.resolveStmtTableScanByAlias(tableAlias);
        }
        return null;
    }
156530
def bind_aliases(decls):
    

    visited = set()
    typedefs = [
        decl for decl in decls if isinstance(decl, declarations.typedef_t)]
    for decl in typedefs:
        type_ = declarations.remove_alias(decl.decl_type)
        if not isinstance(type_, declarations.declarated_t):
            continue
        cls_inst = type_.declaration
        if not isinstance(cls_inst, declarations.class_types):
            continue
        if id(cls_inst) not in visited:
            visited.add(id(cls_inst))
            del cls_inst.aliases[:]
        cls_inst.aliases.append(decl)
830725
def replace_aliases(cut_dict, aliases):
    """"""
    for k, v in cut_dict.items():
        for k0, v0 in aliases.items():
            cut_dict[k] = cut_dict[k].replace(k0, '(%s)' % v0)
422791
function reassignConditionalStatementIds(conditionalStatement) {
        conditionalStatement.sourceField = tempFieldPageIdsMap[conditionalStatement.sourceField] || conditionalStatement.sourceField;
        return conditionalStatement;
      }
377795
def by_alias(cls, name: str) -> "TxType":
        """"""
        return {
            "get": TxType.Get,
            "check": TxType.Check,
            "delete": TxType.Delete,
            "save": TxType.Update,
        }[name]
327888
def as_alias_handler(alias_list):
    """"""
    list_ = list()
    for alias in alias_list:
        if alias.asname:
            list_.append(alias.asname)
        else:
            list_.append(alias.name)
    return list_
577970
def update_aliases(aliases,aonly,x):
    ""
    if isinstance(x,basestring): aliases[x]=x
    elif isinstance(x,sqparse2.AliasX):
      if not isinstance(x.alias,basestring): raise TypeError('alias not string',type(x.alias))
      if isinstance(x.name,sqparse2.NameX): aliases.update({x.alias:x.name.name,x.name.name:x.name.name})
      elif isinstance(x.name,sqparse2.SelectX):
        aliases.update({x.alias:x.alias})
        aonly[x.alias]=x.name
      else: raise TypeError('aliasx_unk_thing',type(x.name)) # pragma: no cover
    else: raise TypeError(type(x)) # pragma: no cover
1192455
def _get_aliased_pivot_columns(self):
        
        defaults = [self._foreign_key, self._other_key]

        columns = []

        for column in defaults + self._pivot_columns:
            value = '%s.%s AS pivot_%s' % (self._table, column, column)
            if value not in columns:
                columns.append('%s.%s AS pivot_%s' % (self._table, column, column))

        return columns