Source:
<code>public void translate(SamzaSqlQueryParser.QueryInfo queryInfo, StreamGraph streamGraph) { QueryPlanner planner = new QueryPlanner(schemaResolversBySystem, schemaConvertersBySystem, sqlConfig.getInputSystemStreamConfigBySource(), sqlConfig.getUdfMetadata()); final RelRoot relRoot = planner.plan(queryInfo.getSelectQuery()); final TranslatorContext context = new TranslatorContext(streamGraph, relRoot); final RelNode node = relRoot.project(); node.accept(new RelShuttleImpl() { @Override public RelNode visit(TableScan scan) { RelNode node = super.visit(scan); scanTranslator.translate(scan, context); return node; } @Override public RelNode visit(LogicalFilter filter) { RelNode node = visitChild(filter, 0, filter.getInput()); new FilterTranslator().translate(filter, context); return node; } <START> <END> @Override public RelNode visit(LogicalProject project) { RelNode node = super.visit(project); new ProjectTranslator().translate(project, context); return node; } }); SystemStreamConfig outputSystemConfig = sqlConfig.getOutputSystemStreamConfigsBySource().get(queryInfo.getOutputSource()); String outputStreamName = outputSystemConfig.getStreamName(); String outputSystemName = outputSystemConfig.getSystemName(); Optional<String> outputSchema = schemaResolversBySystem.get(outputSystemName).fetchSchema(outputSystemName, outputStreamName); RelToSamzaMsgConverter samzaMsgConverter = relToSamzaMsgConvertersBySystem.get(outputSystemConfig.getSystemName()).get(); MessageStreamImpl<SamzaSqlRelMessage> stream = (MessageStreamImpl<SamzaSqlRelMessage>) context.getMessageStream(node.getId()); stream.sendTo(streamGraph.getOutputStream(outputSystemConfig.getStreamName(), m -> samzaMsgConverter.extactKey(outputStreamName, outputSchema, m), m -> samzaMsgConverter.convert(outputStreamName, outputSchema, m))); }</code><technical_language>I expect output translated "insert into" (TableAlter relNode?) sendTo() operator</technical_language>

Target:
public void translate(SamzaSqlQueryParser.QueryInfo queryInfo, StreamGraph streamGraph) { QueryPlanner planner = new QueryPlanner(sqlConfig.getRelSchemaProviders(), sqlConfig.getInputSystemStreamConfigBySource(), sqlConfig.getUdfMetadata()); final SamzaSqlExecutionContext executionContext = new SamzaSqlExecutionContext(this.sqlConfig); final RelRoot relRoot = planner.plan(queryInfo.getSelectQuery()); final TranslatorContext context = new TranslatorContext(streamGraph, relRoot, executionContext); final RelNode node = relRoot.project(); node.accept(new RelShuttleImpl() { @Override public RelNode visit(TableScan scan) { RelNode node = super.visit(scan); scanTranslator.translate(scan, context); return node; } @Override public RelNode visit(LogicalFilter filter) { RelNode node = visitChild(filter, 0, filter.getInput()); new FilterTranslator().translate(filter, context); return node; } @Override public RelNode visit(LogicalProject project) { RelNode node = super.visit(project); new ProjectTranslator().translate(project, context); return node; } }); SqlSystemStreamConfig outputSystemConfig = sqlConfig.getOutputSystemStreamConfigsBySource().get(queryInfo.getOutputSource()); SamzaRelConverter samzaMsgConverter = sqlConfig.getSamzaRelConverters().get(outputSystemConfig.getSystemStream()); MessageStreamImpl<SamzaSqlRelMessage> stream = (MessageStreamImpl<SamzaSqlRelMessage>) context.getMessageStream(node.getId()); MessageStream<KV<Object, Object>> outputStream = stream.map(samzaMsgConverter::convertToSamzaMessage); outputStream.sendTo(streamGraph.getOutputStream(outputSystemConfig.getStreamName())); }