本文整理汇总了Java中com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl类的典型用法代码示例。如果您正苦于以下问题:Java MysqlPlanVisitorImpl类的具体用法?Java MysqlPlanVisitorImpl怎么用?Java MysqlPlanVisitorImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MysqlPlanVisitorImpl类属于com.taobao.tddl.repo.mysql.sqlconvertor包,在下文中一共展示了MysqlPlanVisitorImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(IFunction.BuiltInFunction.TIMESTAMPDIFF).append("(");
sb.append(func.getArgs().get(0));
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
sb.append(")");
return sb.toString();
}
示例2: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
Object right = func.getArgs().get(1);
// 右边被提前计算过了,直接用in
if (right instanceof List) {
sb.append(" in ");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
} else {
// 右边没进行计算,还是个子查询,理论上不会发生
sb.append(" = any (");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(")");
}
return sb.toString();
}
示例3: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(IFunction.BuiltInFunction.CHAR).append("(");
int size = func.getArgs().size();
for (int i = 0; i < size - 1; i++) {
// typeinfo1
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(i)).getString());
if (i < size - 2) {
sb.append(",");
}
}
size = func.getArgs().size();
if (!ExecUtils.isNull(func.getArgs().get(size - 1))) {
sb.append(" USING ").append(func.getArgs().get(size - 1));
}
sb.append(")");
return sb.toString();
}
示例4: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(IFunction.BuiltInFunction.TIMESTAMPADD).append("(");
sb.append(func.getArgs().get(0));
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
sb.append(")");
return sb.toString();
}
示例5: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append("TRIM").append("(");
if (func.getArgs().size() == 2) {
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
} else {
sb.append(func.getArgs().get(2)).append(" ");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(" FROM ");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
}
sb.append(")");
return sb.toString();
}
示例6: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
Object right = func.getArgs().get(1);
// 右边被提前计算过了,直接用not in
if (right instanceof List) {
sb.append(" not in ");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
} else {
// 右边没进行计算,还是个子查询,理论上不会发生
sb.append(" != all (");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(")");
}
return sb.toString();
}
示例7: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(IFunction.BuiltInFunction.TIMESTAMPDIFF).append("(");
sb.append(func.getArgs().get(0));
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
sb.append(")");
return sb.toString();
}
示例8: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(IFunction.BuiltInFunction.TIMESTAMPADD).append("(");
sb.append(func.getArgs().get(0));
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
sb.append(")");
return sb.toString();
}
示例9: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
Object right = func.getArgs().get(1);
// 右边被提前计算过了,找出最小值,转成>=
if (right instanceof List) {
DataType type = ((Filter) func.getExtraFunction()).getArgType();
Object min = Collections.min((List) right, type);
sb.append(" >= ");
sb.append(parentVisitor.getNewVisitor(min).getString());
} else {
// 右边没进行计算,还是个子查询,理论上不会发生
sb.append(" >= any (");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(")");
}
return sb.toString();
}
示例10: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
Object right = func.getArgs().get(1);
// 右边被提前计算过了,找出最大值,转成<
if (right instanceof List) {
DataType type = ((Filter) func.getExtraFunction()).getArgType();
Object max = Collections.max((List) right, type);
sb.append(" < ");
sb.append(parentVisitor.getNewVisitor(max).getString());
} else {
// 右边没进行计算,还是个子查询,理论上不会发生
sb.append(" < any (");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(")");
}
return sb.toString();
}
示例11: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
Object right = func.getArgs().get(1);
// 右边被提前计算过了,找出最小值,转成>
if (right instanceof List) {
DataType type = ((Filter) func.getExtraFunction()).getArgType();
Object min = Collections.min((List) right, type);
sb.append(" > ");
sb.append(parentVisitor.getNewVisitor(min).getString());
} else {
// 右边没进行计算,还是个子查询,理论上不会发生
sb.append(" > any (");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(")");
}
return sb.toString();
}
示例12: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
Object right = func.getArgs().get(1);
// 右边被提前计算过了,找出最大值,转成<=
if (right instanceof List) {
DataType type = ((Filter) func.getExtraFunction()).getArgType();
Object max = Collections.max((List) right, type);
sb.append(" <= ");
sb.append(parentVisitor.getNewVisitor(max).getString());
} else {
// 右边没进行计算,还是个子查询,理论上不会发生
sb.append(" <= any (");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(")");
}
return sb.toString();
}
示例13: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(IFunction.BuiltInFunction.CAST).append("(");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
sb.append(" as ");
// typename
sb.append(func.getArgs().get(1));
// typeinfo
if (func.getArgs().size() > 2) {
sb.append("(");
// typeinfo1
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
// typeinfo2
if (func.getArgs().size() > 3) {
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(3)).getString());
}
sb.append(")");
}
sb.append(")");
return sb.toString();
}
示例14: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(IFunction.BuiltInFunction.GET_FORMAT).append("(");
sb.append(func.getArgs().get(0));
sb.append(",");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(")");
return sb.toString();
}
示例15: constructColumnNameForFunction
import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
AtomicInteger bindValSequence,
Map<Integer, ParameterContext> paramMap, IFunction func,
MysqlPlanVisitorImpl parentVisitor) {
StringBuilder sb = new StringBuilder();
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
Object right = func.getArgs().get(1);
// 右边被提前计算过了,找出最大值,转成>
if (right instanceof List) {
DataType type = ((Filter) func.getExtraFunction()).getArgType();
Object max = Collections.max((List) right, type);
sb.append(" > ");
sb.append(parentVisitor.getNewVisitor(max).getString());
} else {
// 右边没进行计算,还是个子查询,理论上不会发生
sb.append(" > all (");
sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
sb.append(")");
}
return sb.toString();
}