如何在Apache Calcite里不通过SQL执行?使用预处理执行关系表达式

PreparedStatement  statement = connection.unwrap(RelRunner.class).prepare(rootRel);
ResultSet resultSet = statement.executeQuery();

或者直接使用

RelRunners
/*
....................
Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements. 
...................
*/


public class RelRunners {
  private RelRunners() {}

  /** Runs a relational expression by creating a JDBC connection. */
  public static PreparedStatement run(RelNode rel) {
    try (Connection connection = DriverManager.getConnection("jdbc:calcite:")) {
      final RelRunner runner = connection.unwrap(RelRunner.class);
      return runner.prepare(rel);
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
  }
}

 

 

 

你可能感兴趣的:(calcite,Apache,Calcite,Apache,Calcite)