当前位置: 首页>>代码示例>>Java>>正文


Java SqlNodeList.EMPTY属性代码示例

本文整理汇总了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();
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:13,代码来源:OctopusJdbcTable.java

示例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();
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:JdbcTable.java

示例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;
}
 
开发者ID:apache,项目名称:calcite,代码行数:30,代码来源:MysqlSqlDialect.java


注:本文中的org.apache.calcite.sql.SqlNodeList.EMPTY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。