本文整理汇总了Java中org.apache.calcite.sql.SqlOrderBy类的典型用法代码示例。如果您正苦于以下问题:Java SqlOrderBy类的具体用法?Java SqlOrderBy怎么用?Java SqlOrderBy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlOrderBy类属于org.apache.calcite.sql包,在下文中一共展示了SqlOrderBy类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isOrdered
import org.apache.calcite.sql.SqlOrderBy; //导入依赖的package包/类
public static boolean isOrdered(SqlNode query) {
switch (query.getKind()) {
case SELECT:
return ((SqlSelect) query).getOrderList() != null
&& ((SqlSelect) query).getOrderList().size() > 0;
case WITH:
return isOrdered(((SqlWith) query).body);
case ORDER_BY:
return ((SqlOrderBy) query).orderList.size() > 0;
default:
return false;
}
}
示例2: isOrdered
import org.apache.calcite.sql.SqlOrderBy; //导入依赖的package包/类
public static boolean isOrdered(SqlNode query) {
switch (query.getKind()) {
case SELECT:
return ((SqlSelect) query).getOrderList() != null
&& ((SqlSelect) query).getOrderList().size() > 0;
case WITH:
return isOrdered(((SqlWith) query).body);
case ORDER_BY:
return ((SqlOrderBy) query).orderList.size() > 0;
default:
return false;
}
}
示例3: getInnerSelect
import org.apache.calcite.sql.SqlOrderBy; //导入依赖的package包/类
private SqlSelect getInnerSelect(SqlNode node) {
for (;;) {
if (node instanceof SqlSelect) {
return (SqlSelect) node;
} else if (node instanceof SqlOrderBy) {
node = ((SqlOrderBy) node).query;
} else if (node instanceof SqlWith) {
node = ((SqlWith) node).body;
} else {
return null;
}
}
}
示例4: getFieldOrigin
import org.apache.calcite.sql.SqlOrderBy; //导入依赖的package包/类
private List<String> getFieldOrigin(SqlNode sqlQuery, int i) {
if (sqlQuery instanceof SqlSelect) {
SqlSelect sqlSelect = (SqlSelect) sqlQuery;
final SelectScope scope = getRawSelectScope(sqlSelect);
final List<SqlNode> selectList = scope.getExpandedSelectList();
final SqlNode selectItem = stripAs(selectList.get(i));
if (selectItem instanceof SqlIdentifier) {
final SqlQualified qualified =
scope.fullyQualify((SqlIdentifier) selectItem);
SqlValidatorNamespace namespace = qualified.namespace;
final SqlValidatorTable table = namespace.getTable();
if (table == null) {
return null;
}
final List<String> origin =
new ArrayList<>(table.getQualifiedName());
for (String name : qualified.suffix()) {
namespace = namespace.lookupChild(name);
if (namespace == null) {
return null;
}
origin.add(name);
}
return origin;
}
return null;
} else if (sqlQuery instanceof SqlOrderBy) {
return getFieldOrigin(((SqlOrderBy) sqlQuery).query, i);
} else {
return null;
}
}
示例5: extractOrderBy
import org.apache.calcite.sql.SqlOrderBy; //导入依赖的package包/类
private VirtualDatasetState extractOrderBy(String sql, SqlNode node, final RelDataType relDataType) {
SqlOrderBy orderBy = (SqlOrderBy)node;
return extract(sql, orderBy.query, relDataType);
}