AstSanitizer.RewriterPlugin¶
AstSanitizer.RewriterPlugin
is a AstVisitor to validate INSERT INTO statements (and column aliases).
private static final class
AstSanitizer.RewriterPlugin
is a private static final class
of AstSanitizer.
Creating Instance¶
AstSanitizer.RewriterPlugin
takes the following to be created:
AstSanitizer.RewriterPlugin
is created when:
AstSanitizer
is requested to sanitize a KSQL statement
Validating INSERT INTO Statement¶
Optional<AstNode> visitInsertInto(
InsertInto node,
StatementRewriter.Context<SanitizerContext> ctx)
visitInsertInto
is part of the AstVisitor abstraction.
visitInsertInto
throws a UnknownSourceException
when the target DataSource (of the given InsertInto) could not be found in the MetaStore:
Source [target] does not exist.
visitInsertInto
throws a KsqlException
when the getDataSourceType of the target DataSource (of the given InsertInto) is not KSTREAM:
INSERT INTO can only be used to insert into a stream.
[target] is a table.
visitInsertInto
throws a KsqlException
when the target DataSource (of the given InsertInto) has got header columns:
Cannot insert into [target] because it has header columns