use of org.apache.calcite.adapter.enumerable.EnumerableRel in project calcite by apache.
the class EnumerableToSparkConverter method implementSpark.
public Result implementSpark(Implementor implementor) {
// Generate:
// Enumerable source = ...;
// return SparkRuntime.createRdd(sparkContext, source);
final BlockBuilder list = new BlockBuilder();
final EnumerableRel child = (EnumerableRel) getInput();
final PhysType physType = PhysTypeImpl.of(implementor.getTypeFactory(), getRowType(), JavaRowFormat.CUSTOM);
// TODO:
final Expression source = null;
final Expression sparkContext = Expressions.call(SparkMethod.GET_SPARK_CONTEXT.method, implementor.getRootExpression());
final Expression rdd = list.append("rdd", Expressions.call(SparkMethod.CREATE_RDD.method, sparkContext, source));
list.add(Expressions.return_(null, rdd));
return implementor.result(physType, list.toBlock());
}
Aggregations