use of io.crate.planner.projection.WriterProjection in project crate by crate.
the class CopyToPlannerTest method testCopyToWithPartitionedGeneratedColumn.
@Test
public void testCopyToWithPartitionedGeneratedColumn() throws Exception {
// test that generated partition column is NOT exported
Merge plan = e.plan("copy parted_generated to directory '/tmp'");
Collect innerPlan = (Collect) plan.subPlan();
RoutedCollectPhase node = ((RoutedCollectPhase) innerPlan.collectPhase());
WriterProjection projection = (WriterProjection) node.projections().get(0);
assertThat(projection.overwrites().size(), is(0));
}
use of io.crate.planner.projection.WriterProjection in project crate by crate.
the class CopyStatementPlanner method planCopyTo.
public Plan planCopyTo(CopyToAnalyzedStatement statement, Planner.Context context) {
WriterProjection.OutputFormat outputFormat = statement.outputFormat();
if (outputFormat == null) {
outputFormat = statement.columnsDefined() ? WriterProjection.OutputFormat.JSON_ARRAY : WriterProjection.OutputFormat.JSON_OBJECT;
}
WriterProjection projection = ProjectionBuilder.writerProjection(statement.subQueryRelation().querySpec().outputs(), statement.uri(), statement.compressionType(), statement.overwrites(), statement.outputNames(), outputFormat);
Plan plan = context.planSubRelation(statement.subQueryRelation(), new ConsumerContext(context));
if (plan == null) {
return null;
}
plan.addProjection(projection, null, null, 1, null);
return Merge.ensureOnHandler(plan, context, Collections.singletonList(MergeCountProjection.INSTANCE));
}
Aggregations