Skip to content


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 is a SqlBaseBaseVisitor (that VariableSubstitutor uses for variable substitution).


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


String replace(
  SqlBaseParser.SingleStatementContext singleStatementContext)

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