Skip to content

VariableSubstitutor

Variable Substitution (substitute)

String substitute(
  KsqlParser.ParsedStatement parsedStatement,
  Map<String, String> valueMap)
String substitute(
  String string,
  Map<String, String> valueMap)

substitute replaces variables in the SQL text (either as a ParsedStatement or a String using SqlSubstitutorVisitor).

substitute is used when:

SqlSubstitutorVisitor

SqlSubstitutorVisitor is a SqlBaseBaseVisitor (that VariableSubstitutor uses for variable substitution).

ANTLR

SqlBaseBaseVisitor is generated from SqlBase.g4 SQL grammar by ANTLR at build time.

replace

String replace(
  SqlBaseParser.SingleStatementContext singleStatementContext)

replace walks the statement tree (using visit) and then uses StringSubstitutor.replace (Commons Text) to substitute variables.

Back to top