Skip to content

Variable Substitution

Spark SQL (and Spark Thrift Server) supports Variable Substitution in SQL commands using syntax like ${var}, ${system:var}, and ${env:var}.

Note

VariableSubstitution is meant for SQL commands mainly (if not exclusively) since in programming languages there are other means to achieve it (e.g., String Interpolation in Scala).

spark.sql.variable.substitute

spark.sql.variable.substitute configuration property is used to enable variable substitution.