Search in sources :

Example 41 with SQLExprTableSource

use of com.alibaba.druid.sql.ast.statement.SQLExprTableSource in project druid by alibaba.

the class HiveSchemaStatVisitor method visit.

@Override
public boolean visit(HiveInsert x) {
    setMode(x, TableStat.Mode.Insert);
    SQLExprTableSource tableSource = x.getTableSource();
    SQLExpr tableName = tableSource != null ? tableSource.getExpr() : null;
    if (tableName instanceof SQLName) {
        TableStat stat = getTableStat((SQLName) tableName);
        stat.incrementInsertCount();
    }
    for (SQLAssignItem partition : x.getPartitions()) {
        partition.accept(this);
    }
    accept(x.getQuery());
    return false;
}
Also used : SQLAssignItem(com.alibaba.druid.sql.ast.statement.SQLAssignItem) SQLName(com.alibaba.druid.sql.ast.SQLName) TableStat(com.alibaba.druid.stat.TableStat) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource) SQLExpr(com.alibaba.druid.sql.ast.SQLExpr)

Example 42 with SQLExprTableSource

use of com.alibaba.druid.sql.ast.statement.SQLExprTableSource in project druid by alibaba.

the class OdpsSchemaStatVisitor method visit.

@Override
public boolean visit(OdpsUnloadStatement x) {
    SQLExprTableSource table = (SQLExprTableSource) x.getFrom();
    TableStat stat = getTableStatWithUnwrap(table.getExpr());
    if (stat != null) {
        stat.incrementSelectCount();
    }
    resolvePartitions(table, x.getPartitions());
    return false;
}
Also used : TableStat(com.alibaba.druid.stat.TableStat) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource)

Example 43 with SQLExprTableSource

use of com.alibaba.druid.sql.ast.statement.SQLExprTableSource in project druid by alibaba.

the class OdpsSchemaStatVisitor method visit.

@Override
public boolean visit(OdpsExstoreStatement x) {
    SQLExprTableSource table = x.getTable();
    TableStat stat = getTableStatWithUnwrap(table.getExpr());
    if (stat != null) {
        stat.incrementSelectCount();
    }
    resolvePartitions(table, x.getPartitions());
    return false;
}
Also used : TableStat(com.alibaba.druid.stat.TableStat) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource)

Example 44 with SQLExprTableSource

use of com.alibaba.druid.sql.ast.statement.SQLExprTableSource in project druid by alibaba.

the class OracleLockTableStatement method setTable.

public void setTable(SQLName table) {
    this.setTable(new SQLExprTableSource(table));
    this.table.setParent(this);
}
Also used : SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource)

Example 45 with SQLExprTableSource

use of com.alibaba.druid.sql.ast.statement.SQLExprTableSource in project druid by alibaba.

the class OracleSelectQueryBlock method setFrom.

public void setFrom(String tableName) {
    SQLExprTableSource from;
    if (tableName == null || tableName.length() == 0) {
        from = null;
    } else {
        from = new OracleSelectTableReference(new SQLIdentifierExpr(tableName));
    }
    this.setFrom(from);
}
Also used : SQLIdentifierExpr(com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr) SQLExprTableSource(com.alibaba.druid.sql.ast.statement.SQLExprTableSource)

Aggregations

SQLExprTableSource (com.alibaba.druid.sql.ast.statement.SQLExprTableSource)51 SQLIdentifierExpr (com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr)17 MySqlStatementParser (com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser)12 SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)11 SQLTableSource (com.alibaba.druid.sql.ast.statement.SQLTableSource)10 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)9 TableStat (com.alibaba.druid.stat.TableStat)8 SQLNonTransientException (java.sql.SQLNonTransientException)8 SQLName (com.alibaba.druid.sql.ast.SQLName)7 SQLSelectQuery (com.alibaba.druid.sql.ast.statement.SQLSelectQuery)7 SQLStatementParser (com.alibaba.druid.sql.parser.SQLStatementParser)7 SQLSelectQueryBlock (com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock)5 MySqlSelectQueryBlock (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock)5 TableConfig (com.actiontech.dble.config.model.TableConfig)4 SQLObject (com.alibaba.druid.sql.ast.SQLObject)4 SQLVariantRefExpr (com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr)4 SQLCreateTableStatement (com.alibaba.druid.sql.ast.statement.SQLCreateTableStatement)4 SQLDeleteStatement (com.alibaba.druid.sql.ast.statement.SQLDeleteStatement)4 SQLSelectStatement (com.alibaba.druid.sql.ast.statement.SQLSelectStatement)4 RouteResultsetNode (io.mycat.route.RouteResultsetNode)4