本文整理汇总了Java中org.apache.calcite.sql.SqlNodeList.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java SqlNodeList.EMPTY属性的具体用法?Java SqlNodeList.EMPTY怎么用?Java SqlNodeList.EMPTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.calcite.sql.SqlNodeList
的用法示例。
在下文中一共展示了SqlNodeList.EMPTY属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSql
SqlString generateSql() {
final SqlNodeList selectList =
new SqlNodeList(
Collections.singletonList(
new SqlIdentifier("*", SqlParserPos.ZERO)),
SqlParserPos.ZERO);
SqlSelect node =
new SqlSelect(SqlParserPos.ZERO, SqlNodeList.EMPTY, selectList,
tableName(), null, null, null, null, null, null, null);
final SqlPrettyWriter writer = new SqlPrettyWriter(dataSource.getDialect());
node.unparse(writer, 0, 0);
return writer.toSqlString();
}
示例2: generateSql
SqlString generateSql() {
final SqlNodeList selectList =
new SqlNodeList(
Collections.singletonList(SqlIdentifier.star(SqlParserPos.ZERO)),
SqlParserPos.ZERO);
SqlSelect node =
new SqlSelect(SqlParserPos.ZERO, SqlNodeList.EMPTY, selectList,
tableName(), null, null, null, null, null, null, null);
final SqlPrettyWriter writer = new SqlPrettyWriter(jdbcSchema.dialect);
node.unparse(writer, 0, 0);
return writer.toSqlString();
}
示例3: rewriteSingleValueExpr
@Override public SqlNode rewriteSingleValueExpr(SqlNode aggCall) {
final SqlNode operand = ((SqlBasicCall) aggCall).operand(0);
final SqlLiteral nullLiteral = SqlLiteral.createNull(SqlParserPos.ZERO);
final SqlNode unionOperand = new SqlSelect(SqlParserPos.ZERO, SqlNodeList.EMPTY,
SqlNodeList.of(nullLiteral), null, null, null, null, SqlNodeList.EMPTY, null, null, null);
// For MySQL, generate
// CASE COUNT(*)
// WHEN 0 THEN NULL
// WHEN 1 THEN <result>
// ELSE (SELECT NULL UNION ALL SELECT NULL)
// END
final SqlNode caseExpr =
new SqlCase(SqlParserPos.ZERO,
SqlStdOperatorTable.COUNT.createCall(SqlParserPos.ZERO, operand),
SqlNodeList.of(
SqlLiteral.createExactNumeric("0", SqlParserPos.ZERO),
SqlLiteral.createExactNumeric("1", SqlParserPos.ZERO)
),
SqlNodeList.of(
nullLiteral,
operand
),
SqlStdOperatorTable.SCALAR_QUERY.createCall(SqlParserPos.ZERO,
SqlStdOperatorTable.UNION_ALL
.createCall(SqlParserPos.ZERO, unionOperand, unionOperand)));
LOGGER.debug("SINGLE_VALUE rewritten into [{}]", caseExpr);
return caseExpr;
}