本文整理汇总了Java中com.taobao.tddl.optimizer.core.expression.IFunction.getArgs方法的典型用法代码示例。如果您正苦于以下问题:Java IFunction.getArgs方法的具体用法?Java IFunction.getArgs怎么用?Java IFunction.getArgs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.optimizer.core.expression.IFunction
的用法示例。
在下文中一共展示了IFunction.getArgs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
public void buildFunction(IFunction f) {
if (f.getArgs().size() == 0) {
return;
}
List<Object> args = f.getArgs();
for (int i = 0; i < args.size(); i++) {
if (args.get(i) instanceof ISelectable) {
args.set(i, this.buildSelectable((ISelectable) args.get(i)));
if (IFunction.FunctionType.Aggregate.equals(f.getFunctionType()) && (args.get(i) instanceof IColumn)) {
this.columnInAggregate.add((IColumn) args.get(i));
}
}
}
}
示例2: buildFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
public void buildFunction(IFunction f, boolean findInSelectList) {
if (FunctionType.Aggregate == f.getFunctionType()) {
setExistAggregate();
}
if (f.getArgs().size() == 0) {
return;
}
List<Object> args = f.getArgs();
for (int i = 0; i < args.size(); i++) {
if (args.get(i) instanceof ISelectable) {
args.set(i, this.buildSelectable((ISelectable) args.get(i), findInSelectList));
}
}
}
示例3: buildFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
protected void buildFunction(IFunction f, boolean findInSelectList) {
if (FunctionType.Aggregate == f.getFunctionType()) {
setExistAggregate();
}
if (f.getArgs().size() == 0) {
return;
}
List<Object> args = f.getArgs();
for (int i = 0; i < args.size(); i++) {
if (args.get(i) instanceof ISelectable) {
args.set(i, this.buildSelectable((ISelectable) args.get(i), findInSelectList));
} else if (args.get(i) instanceof ISequenceVal) {
setExistSequenceVal();
}
}
}
示例4: buildFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
@Override
public void buildFunction(IFunction f, boolean findInSelectList) {
if (FunctionType.Aggregate == f.getFunctionType()) {
setExistAggregate();
}
for (Object arg : f.getArgs()) {
if (arg instanceof IFunction) {
this.buildSelectable((ISelectable) arg, findInSelectList);
} else if (!this.getNode().isDistinctByShardColumns() && arg instanceof ISelectable) {
// 针对非distinct的函数,没必要下推字段
if (((ISelectable) arg).isDistinct()) {
this.buildSelectable((ISelectable) arg, findInSelectList);
}
}
}
}
示例5: isMiddle
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
private boolean isMiddle(IFunction func) {
if (middleFuncName.contains(func.getFunctionName())) {
if (func.getArgs() != null && func.getArgs().size() == 1) {
return false;
}
return true;
} else {
return false;
}
}
示例6: getColumnNameWithTableName
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
public static String getColumnNameWithTableName(Object column) {
if (column instanceof IColumn) {
IColumn col = getIColumn(column);
String colName = getRealTableName(col.getTableName()) + "." + col.getColumnName();
return colName;
} else if (column instanceof IFunction) {
IFunction func = ((IFunction) column);
StringBuilder sb = new StringBuilder();
sb.append(func.getFunctionName());
sb.append("(");
boolean first = true;
if (func.isDistinct()) {
sb.append("DISTINCT ");
}
for (Object arg : func.getArgs()) {
if (first) {
first = false;
} else {
sb.append(",");
}
sb.append(getColumnName(arg));
}
sb.append(")");
return sb.toString();
} else {
return String.valueOf(column);
}
}
示例7: setFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
private static void setFunction(IFunction f, String tableName) {
for (Object arg : f.getArgs()) {
if (arg instanceof ISelectable) {
if (arg instanceof IColumn) {
setColumn((IColumn) arg, tableName);
} else if (arg instanceof IFilter) {
setFilter((IFilter) arg, tableName);
} else if (arg instanceof IFunction) {
setFunction((IFunction) arg, tableName);
}
}
}
}
示例8: hasArgsAvgFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
private boolean hasArgsAvgFunction(IFunction func) {
for (Object args : func.getArgs()) {
if (args instanceof IFunction && ((IFunction) args).getColumnName().startsWith("AVG(")) {
return true;
}
}
return false;
}
示例9: buildFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
protected void buildFunction(IFunction f) {
if (f.getArgs().size() == 0) {
return;
}
List<Object> args = f.getArgs();
for (int i = 0; i < args.size(); i++) {
args.set(i, this.buildSelectable((ISelectable) args.get(i)));
}
}
示例10: buildFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
public void buildFunction(IFunction f) {
if (f.getArgs().size() == 0) {
return;
}
List<Object> args = f.getArgs();
for (int i = 0; i < args.size(); i++) {
if (args.get(i) instanceof ISelectable) {
args.set(i, this.buildSelectable((ISelectable) args.get(i)));
}
}
}
示例11: findAggregateFunctionsInScalar
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
private void findAggregateFunctionsInScalar(IFunction s, List<IFunction> res) {
if (IFunction.FunctionType.Aggregate.equals(s.getFunctionType())) {
res.add(s);
}
for (Object arg : s.getArgs()) {
if (arg instanceof IFunction) {
this.findAggregateFunctionsInScalar((IFunction) arg, res);
}
}
}
示例12: getColumFullName
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
public static String getColumFullName(Object column) {
if (column instanceof IColumn) {
IColumn col = getIColumn(column);
String colName = col.getTableName() + "." + col.getColumnName();
if (col.getAlias() != null) {
return colName + " as " + col.getAlias();
} else {
return colName;
}
} else if (column instanceof IFunction && !(column instanceof IFilter)) {
IFunction func = ((IFunction) column);
StringBuilder sb = new StringBuilder();
sb.append(func.getFunctionName());
sb.append("(");
boolean first = true;
if (func.isDistinct()) {
sb.append("DISTINCT ");
}
for (Object arg : func.getArgs()) {
if (first) {
first = false;
} else {
sb.append(",");
}
sb.append(getColumnName(arg));
}
sb.append(")");
if (func.getAlias() != null) {
sb.append(" as ").append(func.getAlias());
}
return sb.toString();
} else {
return String.valueOf(column);
}
}
示例13: findAggregateFunctionsInScalar
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
private void findAggregateFunctionsInScalar(IFunction s, List<IFunction> res) {
if (IFunction.FunctionType.Aggregate.equals(s.getFunctionType())) {
res.add(s);
}
for (Object arg : s.getArgs()) {
if (arg instanceof IFunction) {
this.findAggregateFunctionsInScalar((IFunction) arg, res);
}
}
}
示例14: getAllAggregates
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
public List<IFunction> getAllAggregates(List<IFunction> functions) {
List<IFunction> aggregates = new LinkedList<IFunction>();
for (IFunction f : functions) {
List<IFunction> functionsInArgs = new ArrayList<IFunction>(f.getArgs().size());
for (Object arg : f.getArgs()) {
if (arg instanceof IFunction) {
functionsInArgs.add((IFunction) arg);
}
}
List<IFunction> aggregatesInArgs = this.getAllAggregates(functionsInArgs);
aggregates.addAll(aggregatesInArgs);
if (f.getFunctionType().equals(FunctionType.Aggregate)) {
aggregates.add(f);
// 聚合函数不能使用聚合函数作为参数
// 如 max(count(id))是错误的
if (!aggregatesInArgs.isEmpty()) {
throw new RuntimeException("Invalid use of group function");
}
}
}
return aggregates;
}
示例15: buildFunction
import com.taobao.tddl.optimizer.core.expression.IFunction; //导入方法依赖的package包/类
public void buildFunction(IFunction f, boolean findInSelectList) {
for (Object arg : f.getArgs()) {
if (arg instanceof IFunction) {
this.buildSelectable((ISelectable) arg, findInSelectList);
} else if (arg instanceof ISelectable) {
// 针对非distinct的函数,没必要下推字段
if (((ISelectable) arg).isDistinct()) {
this.buildSelectable((ISelectable) arg, findInSelectList);
}
}
}
}