Projects >> druid >>b46c327160606861c416b46ed13f4e4deab443b7

Chunk
Conflicting content
    protected final Set                             columns           = new HashSet();
    protected final Set                          conditions        = new HashSet();
    protected final Set                             orderByColumns    = new HashSet();
<<<<<<< HEAD
    protected final Set                             groupByColumns    = new HashSet();
=======
>>>>>>> 6e3ce2058e48a6172922a4ac9b5c65ae5fb3dec9

    protected final static ThreadLocal> aliasLocal        = new ThreadLocal>();
    protected final static ThreadLocal              currentTableLocal = new ThreadLocal();
Solution content
    protected final Set                             columns           = new HashSet();
    protected final Set                          conditions        = new HashSet();
    protected final Set                             orderByColumns    = new HashSet();
    protected final Set                             groupByColumns    = new HashSet();

    protected final static ThreadLocal> aliasLocal        = new ThreadLocal>();
    protected final static ThreadLocal              currentTableLocal = new ThreadLocal();
File
SchemaStatVisitor.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        public SQLOrderBy getOrderBy() {
            return orderBy;
        }

        public boolean visit(SQLIdentifierExpr x) {
    protected final static ThreadLocal              currentTableLocal = new ThreadLocal();
    protected final static ThreadLocal                modeLocal         = new ThreadLocal();

<<<<<<< HEAD
    public class OrderByStatVisitor extends SQLASTVisitorAdapter {

        private final SQLOrderBy orderBy;

        public OrderByStatVisitor(SQLOrderBy orderBy){
            this.orderBy = orderBy;
        }
            String currentTable = currentTableLocal.get();

            if (currentTable != null) {
                orderByColumns.add(new Column(currentTable, x.getName()));
            }
            return false;
        }

        public boolean visit(SQLPropertyExpr x) {
            if (x.getOwner() instanceof SQLIdentifierExpr) {
                String owner = ((SQLIdentifierExpr) x.getOwner()).getName();

                if (owner != null) {
                    Map aliasMap = aliasLocal.get();
                    if (aliasMap != null) {
                        String table = aliasMap.get(owner);

                        // table == null时是SubQuery
                        if (table != null) {
                            orderByColumns.add(new Column(table, x.getName()));
                        }
                    }
                }
            }

            return false;
        }
    }

    public boolean visit(SQLOrderBy x) {
        OrderByStatVisitor orderByVisitor = new OrderByStatVisitor(x);
        SQLSelectQueryBlock query = null;
        if (x.getParent() instanceof SQLSelectQueryBlock) {
            query = (SQLSelectQueryBlock) x.getParent();
        }
        if (query != null) {
            for (SQLSelectOrderByItem item : x.getItems()) {
                SQLExpr expr = item.getExpr();
                if (expr instanceof SQLIntegerExpr) {
                    int intValue = ((SQLIntegerExpr) expr).getNumber().intValue() - 1;
                    if (intValue < query.getSelectList().size()) {
                        SQLSelectItem selectItem = query.getSelectList().get(intValue);
                        selectItem.getExpr().accept(orderByVisitor);
                    }
                }
            }
        }
        x.accept(orderByVisitor);
        return true;
    }

=======
>>>>>>> 6e3ce2058e48a6172922a4ac9b5c65ae5fb3dec9
    public Set getOrderByColumns() {
        return orderByColumns;
    }
Solution content
    protected final static ThreadLocal              currentTableLocal = new ThreadLocal();
    protected final static ThreadLocal                modeLocal         = new ThreadLocal();

    public class OrderByStatVisitor extends SQLASTVisitorAdapter {

        private final SQLOrderBy orderBy;

        public OrderByStatVisitor(SQLOrderBy orderBy){
            this.orderBy = orderBy;
        }

        public SQLOrderBy getOrderBy() {
            return orderBy;
        }

        public boolean visit(SQLIdentifierExpr x) {
            String currentTable = currentTableLocal.get();

            if (currentTable != null) {
                orderByColumns.add(new Column(currentTable, x.getName()));
            }
            return false;
        }

        public boolean visit(SQLPropertyExpr x) {
            if (x.getOwner() instanceof SQLIdentifierExpr) {
                String owner = ((SQLIdentifierExpr) x.getOwner()).getName();

                if (owner != null) {
                    Map aliasMap = aliasLocal.get();
                    if (aliasMap != null) {
                        String table = aliasMap.get(owner);

                        // table == null时是SubQuery
                        if (table != null) {
                            orderByColumns.add(new Column(table, x.getName()));
                        }
                    }
                }
            }

            return false;
        }
    }

    public boolean visit(SQLOrderBy x) {
        OrderByStatVisitor orderByVisitor = new OrderByStatVisitor(x);
        SQLSelectQueryBlock query = null;
        if (x.getParent() instanceof SQLSelectQueryBlock) {
            query = (SQLSelectQueryBlock) x.getParent();
        }
        if (query != null) {
            for (SQLSelectOrderByItem item : x.getItems()) {
                SQLExpr expr = item.getExpr();
                if (expr instanceof SQLIntegerExpr) {
                    int intValue = ((SQLIntegerExpr) expr).getNumber().intValue() - 1;
                    if (intValue < query.getSelectList().size()) {
                        SQLSelectItem selectItem = query.getSelectList().get(intValue);
                        selectItem.getExpr().accept(orderByVisitor);
                    }
                }
            }
        }
        x.accept(orderByVisitor);
        return true;
    }

    public Set getOrderByColumns() {
        return orderByColumns;
    }
File
SchemaStatVisitor.java
Developer's decision
Version 1
Kind of conflict
Class declaration
Method declaration
Chunk
Conflicting content
        return orderByColumns;
    }

<<<<<<< HEAD
    public Set getGroupByColumns() {
        return groupByColumns;
    }

=======
>>>>>>> 6e3ce2058e48a6172922a4ac9b5c65ae5fb3dec9
    public Set getConditions() {
        return conditions;
    }
Solution content
        return orderByColumns;
    }

    public Set getGroupByColumns() {
        return groupByColumns;
    }

    public Set getConditions() {
        return conditions;
    }
File
SchemaStatVisitor.java
Developer's decision
Version 1
Kind of conflict
Method declaration