我在尝试创建关系代数的地方有以下代码: 最终的RelNode relNode = relBuilder.scan(index).build();
我正在寻找一个示例代码,可以在上面的代码中创建SELECE和WHERE子句。
答案 0 :(得分:0)
您读过the documentation吗?那里有几个例子。
final RelNode node = builder .scan("EMP") .aggregate(builder.groupKey("DEPTNO"), builder.count(false, "C"), builder.sum(false, "S", builder.field("SAL"))) .filter( builder.call(SqlStdOperatorTable.GREATER_THAN, builder.field("C"), builder.literal(10))) .build(); System.out.println(RelOptUtil.toString(node));
等同于SQL
SELECT deptno, count(*) AS c, sum(sal) AS s FROM emp GROUP BY deptno HAVING count(*) > 10