@Override protected Void visitCreateStreamAsSelect(final CreateStreamAsSelect node, final Integer indent) { builder.append("CREATE STREAM "); if (node.isNotExists()) { builder.append("IF NOT EXISTS "); } builder.append(node.getName()); if (!node.getProperties().isEmpty()) { builder.append(" WITH ("); Joiner.on(", ") .appendTo(builder, transform( node.getProperties().entrySet(), entry -> entry.getKey() + " = " + ExpressionFormatter .formatExpression(entry.getValue()))); builder.append(")"); } builder.append(" AS "); process(node.getQuery(), indent); return null; }
protected R visitCreateStreamAsSelect(final CreateStreamAsSelect node, final C context) { process(node.getQuery(), context); node.getProperties().values().forEach(expression -> process(expression, context)); return null; }
protected Node visitCreateStreamAsSelect(final CreateStreamAsSelect node, final Node parent) { node.setParent(parent); process(node.getQuery(), node); node.getProperties().values().forEach(expression -> process(expression, node)); return null; }
protected Node visitCreateStreamAsSelect(final CreateStreamAsSelect node, final Object context) { return new CreateStreamAsSelect( node.getLocation(), node.getName(), (Query) process(node.getQuery(), context), node.isNotExists(), node.getProperties().entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, e -> (Expression) process(e.getValue(), context) )), node.getPartitionByColumn().isPresent() ? Optional.ofNullable( (Expression) process(node.getPartitionByColumn().get(), context)) : Optional.empty() ); }
private CreateStreamAsSelect mockCSAS(final String name) { final CreateStreamAsSelect mockStatement = mock(CreateStreamAsSelect.class); expect(mockStatement.getName()).andStubReturn(QualifiedName.of(name)); expect(mockStatement.getQuery()).andStubReturn(mockCSASQuery(name)); expect(mockStatement.getProperties()).andStubReturn(Collections.emptyMap()); expect(mockStatement.getPartitionByColumn()).andStubReturn(Optional.empty()); return mockStatement; }