本文整理汇总了Java中com.taobao.tddl.optimizer.core.expression.ExtraFunctionManager类的典型用法代码示例。如果您正苦于以下问题:Java ExtraFunctionManager类的具体用法?Java ExtraFunctionManager怎么用?Java ExtraFunctionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExtraFunctionManager类属于com.taobao.tddl.optimizer.core.expression包,在下文中一共展示了ExtraFunctionManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import com.taobao.tddl.optimizer.core.expression.ExtraFunctionManager; //导入依赖的package包/类
@Override
public ISchematicCursor handle(IDataNodeExecutor executor, ExecutionContext executionContext) throws TddlException {
ShowWithoutTable show = (ShowWithoutTable) executor;
ArrayResultCursor result = new ArrayResultCursor("TABLES", executionContext);
result.addColumn("Tables_in_" + executor.getDataNode(), DataType.StringType);
result.initMeta();
Set<String> tableNames = OptimizerContext.getContext().getRule().mergeTableRule(new ArrayList<String>());
Like like = null;
String likeExpr = null;
boolean full = show.isFull();
if (StringUtils.isNotEmpty(show.getPattern())) {
like = (Like) ExtraFunctionManager.getExtraFunction("LIKE");
if (show.getPattern().charAt(0) == '\'' && show.getPattern().charAt(show.getPattern().length() - 1) == '\'') {
likeExpr = show.getPattern().substring(1, show.getPattern().length() - 1);
} else {
likeExpr = show.getPattern();
}
}
for (String table : tableNames) {
if (like != null) {
boolean bool = (Boolean) like.compute(new Object[] { table, likeExpr }, executionContext);
if (!bool) {
continue;
}
}
if (full) {
String type = "BASE TABLE";
result.addRow(new Object[] { table, type });
} else {
result.addRow(new Object[] { table });
}
}
return result;
}
示例2: getExtraFunction
import com.taobao.tddl.optimizer.core.expression.ExtraFunctionManager; //导入依赖的package包/类
@Override
public IExtraFunction getExtraFunction() {
if (extraFunction == null) {
extraFunction = ExtraFunctionManager.getExtraFunction(getFunctionName());
extraFunction.setFunction(this);// 不可能为null
}
return extraFunction;
}
示例3: test_extension
import com.taobao.tddl.optimizer.core.expression.ExtraFunctionManager; //导入依赖的package包/类
@Test
public void test_extension() {
IExtraFunction func = ExtraFunctionManager.getExtraFunction("DUMMY");
Assert.assertEquals(DummyTest.class, func.getClass());
func = ExtraFunctionManager.getExtraFunction("NOT_EXIST");
Assert.assertEquals(DummyTest.class, func.getClass());
}