本文整理汇总了Java中com.taobao.tddl.optimizer.core.expression.ISelectable.getAlias方法的典型用法代码示例。如果您正苦于以下问题:Java ISelectable.getAlias方法的具体用法?Java ISelectable.getAlias怎么用?Java ISelectable.getAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.optimizer.core.expression.ISelectable
的用法示例。
在下文中一共展示了ISelectable.getAlias方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColumnsReferedForParent
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
/**
* 列的tablename会设为表别名
*
* @return
*/
public List<ISelectable> getColumnsReferedForParent() {
if (this.getAlias() == null) {
return this.getColumnsRefered();
} else {
List<ISelectable> res = new ArrayList<ISelectable>(this.getColumnsRefered().size());
for (ISelectable s : this.getColumnsRefered()) {
ISelectable a = s.copy();
if (this.getAlias() != null) {
a.setTableName(this.getAlias());
}
if (s.getAlias() != null) {
a.setColumnName(s.getAlias()); // 设置为alias name
a.setAlias(null);
}
res.add(a);
}
return res;
}
}
示例2: getColumnsSelectedForParent
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
/**
* 列的tablename会设为表别名
*
* @return
*/
public List<ISelectable> getColumnsSelectedForParent() {
List<ISelectable> res = new ArrayList<ISelectable>(this.getColumnsSelected().size());
for (ISelectable s : this.getColumnsSelected()) {
ISelectable a = s.copy();
if (this.getAlias() != null) {
a.setTableName(this.getAlias());
}
if (s.getAlias() != null) {
a.setColumnName(s.getAlias()); // 设置为alias name
a.setAlias(null);
}
res.add(a);
}
return res;
}
示例3: putRetColumnInMeta
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
void putRetColumnInMeta(ISelectable column, List<ColumnMeta> metaColumns) {
String columnName;
columnName = column.getColumnName();
DataType type = null;
// 函数在Map和Reduce过程中的返回类型可以不同
// 如Avg,map过程返回String
// reduce过程中返回数字类型
if (this.isMerge()) {
type = column.getDataType();
} else {
if (column instanceof IFunction) {
type = ((IFunction) column).getExtraFunction().getMapReturnType();
} else {
type = column.getDataType();
}
}
ColumnMeta cm = new ColumnMeta(ExecUtils.getLogicTableName(column.getTableName()),
columnName,
type,
column.getAlias(),
true);
metaColumns.add(cm);
}
示例4: buildSelect
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
public void buildSelect(IQueryTree<IQueryTree> query) {
sqlBuilder.append("select ");
boolean hasDistinct = false;
boolean first = true;
StringBuilder sb = new StringBuilder();
for (ISelectable selected : query.getColumns()) {
if (first) {
first = false;
} else {
sb.append(",");
}
if (selected.isDistinct()) {
hasDistinct = true;
}
MysqlPlanVisitorImpl visitor = this.getNewVisitor(selected);
sb.append(visitor.getString());
if (selected.getAlias() != null) {
sb.append(" as ").append(selected.getAlias());
}
}
if (hasDistinct) {
sqlBuilder.append(" distinct ");
}
sqlBuilder.append(sb);
}
示例5: getColumnMetas
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
public static List<ColumnMeta> getColumnMetas(List<ISelectable> columns) {
List<ColumnMeta> _columns = new ArrayList<ColumnMeta>(columns.size());
for (ISelectable c : columns) {
ColumnMeta ic = new ColumnMeta(c.getTableName(), c.getColumnName(), c.getDataType(), c.getAlias(), true);
_columns.add(ic);
}
return _columns;
}
示例6: isSameName
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
@Override
public boolean isSameName(ISelectable select) {
String cn1 = this.getColumnName();
if (TStringUtil.isNotEmpty(this.getAlias())) {
cn1 = this.getAlias();
}
String cn2 = select.getColumnName();
if (TStringUtil.isNotEmpty(select.getAlias())) {
cn2 = select.getAlias();
}
return TStringUtil.equals(cn1, cn2);
}
示例7: putRetColumnInMeta
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
void putRetColumnInMeta(ISelectable column, List<ColumnMeta> metaColumns) {
String columnName;
columnName = column.getColumnName();
DataType type = null;
// 函数在Map和Reduce过程中的返回类型可以不同
// 如Avg,map过程返回String
// reduce过程中返回数字类型
if (this.isMerge()) {
type = column.getDataType();
} else {
if (column instanceof IFunction) {
if (((IFunction) column).getFunctionType().equals(FunctionType.Aggregate)) {
type = ((AggregateFunction) ((IFunction) column).getExtraFunction()).getMapReturnType();
} else {
type = column.getDataType();
}
} else {
type = column.getDataType();
}
}
ColumnMeta cm = new ColumnMeta(ExecUtils.getLogicTableName(column.getTableName()),
columnName,
type,
column.getAlias(),
true);
metaColumns.add(cm);
}
示例8: getColumnFromSelecteList
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
/**
* 从select列表中查找
*/
private ISelectable getColumnFromSelecteList(ISelectable c) {
ISelectable column = null;
for (ISelectable selected : this.getNode().getColumnsSelected()) {
boolean isThis = false;
if (c.getTableName() != null && (!(node instanceof KVIndexNode))) {
if (!c.getTableName().equals(selected.getTableName())) {
continue;
}
}
// 在当前select中查找,先比较column name,再比较alias name
if (selected.getColumnName().equals(c.getColumnName())) {
isThis = true;
} else if (selected.getAlias() != null && selected.getAlias().equals(c.getColumnName())) {
isThis = true;
}
if (isThis) {
column = selected;
return column;
}
}
return column;
}
示例9: getColumnMetaWithLogicTables
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
public static List<ColumnMeta> getColumnMetaWithLogicTables(List<ISelectable> columns) {
List<ColumnMeta> _columns = new ArrayList<ColumnMeta>(columns.size());
for (ISelectable c : columns) {
ColumnMeta ic = new ColumnMeta(getLogicTableName(c.getTableName()),
c.getColumnName(),
c.getDataType(),
c.getAlias(),
true);
_columns.add(ic);
// if (ic.getDataType() == null)
// throw new RuntimeException("fuck!");
}
return _columns;
}
示例10: getColumnMeta
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
public static ColumnMeta getColumnMeta(Object o, String columnAlias) {
ISelectable c = (ISelectable) o;
return new ColumnMeta(c.getTableName(), columnAlias, c.getDataType(), c.getAlias(), true);
}
示例11: getColumnMetaTable
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
public static ColumnMeta getColumnMetaTable(Object o, String tableName) {
ISelectable c = (ISelectable) o;
return new ColumnMeta(tableName, c.getColumnName(), c.getDataType(), c.getAlias(), true);
}
示例12: getColumnMeta
import com.taobao.tddl.optimizer.core.expression.ISelectable; //导入方法依赖的package包/类
public static ColumnMeta getColumnMeta(Object o) {
ISelectable c = (ISelectable) o;
return new ColumnMeta(c.getTableName(), c.getColumnName(), c.getDataType(), c.getAlias(), true);
}