如何在Apache Calcite在JDBC连接里使用关系表达式查询?

  SchemaPlus rootSchema1 = connection.getRootSchema();
       //省略设置表关系
        final FrameworkConfig config = Frameworks.newConfigBuilder()
                .parserConfig(SqlParser.configBuilder().setCaseSensitive(false).setLex(Lex.MYSQL).build())
                .defaultSchema(rootSchema1)
                .build();
        RelBuilder relBuilder = RelBuilder.create(config);
        RelNode table = relBuilder
                .scan("testdb","travelrecord")//schema与table的关系不能使用"schema.table"字符串表示
                .scan("testdb","address")
                .join(JoinRelType.INNER, "id")
                .project(relBuilder.field("id"), relBuilder.field("user_id"))
                .build();

 

 

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