package parser
- Alphabetic
- By Inheritance
- parser
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract class AbstractSqlParser extends AbstractParser with ParserInterface
Base class for all ANTLR4 ParserInterface implementations.
- class AstBuilder extends DataTypeAstBuilder with SQLConfHelper with Logging with DataTypeErrorsBase
The AstBuilder converts an ANTLR4 ParseTree into a catalyst Expression, LogicalPlan or TableIdentifier.
- class CatalystSqlParser extends AbstractSqlParser
Concrete SQL parser for Catalyst-only SQL statements.
- class CompoundBodyParsingContext extends AnyRef
- implicit final class EnhancedLogicalPlan extends AnyVal
Some syntactic sugar which makes it easier to work with optional clauses for LogicalPlans.
- case class HybridParameterContext(args: Seq[Expression], paramNames: Seq[String]) extends ParameterContext with Product with Serializable
Context that supports both named and positional parameters.
Context that supports both named and positional parameters. This is used by EXECUTE IMMEDIATE where the parameter type is determined by the inner query.
- args
Expression values from USING clause (already evaluated and resolved to Literals)
- paramNames
Parameter names from USING clause (empty strings for positional)
- case class NamedParameterContext(params: Map[String, Expression]) extends ParameterContext with Product with Serializable
Context for named parameters (e.g., :paramName).
Context for named parameters (e.g., :paramName).
- params
Map of parameter names to their expression values
- sealed trait ParameterContext extends AnyRef
Context for passing parameter values to the SQL parser.
Context for passing parameter values to the SQL parser. This allows parameter substitution to happen during the parsing phase rather than during analysis.
- trait ParserInterface extends DataTypeParserInterface
Interface for a parser.
Interface for a parser.
- Annotations
- @DeveloperApi()
- case class PositionalParameterContext(params: Seq[Expression]) extends ParameterContext with Product with Serializable
Context for positional parameters (e.g., ?).
Context for positional parameters (e.g., ?).
- params
Sequence of expression values in order
- class SqlScriptingConditionContext extends AnyRef
- class SqlScriptingLabelContext extends AnyRef
- class SqlScriptingParsingContext extends AnyRef
- class SubstituteParamsParser extends Logging
A parameter substitution parser that replaces parameter markers in SQL text with their values.
A parameter substitution parser that replaces parameter markers in SQL text with their values. This parser finds parameter markers and substitutes them with provided values to produce a modified SQL string ready for execution.
Value Members
- object CatalystSqlParser extends CatalystSqlParser
For test-only.
- object ParameterExpectation extends Enumeration
Parameter expectation types.
- object ParameterHandler
Handler for parameter substitution across different Spark SQL contexts.
Handler for parameter substitution across different Spark SQL contexts.
This object consolidates the common parameter handling logic used by SparkSqlParser, SparkConnectPlanner, and ExecuteImmediate. It provides a single, consistent API for all parameter substitution operations in Spark SQL.
Key features: - Automatic parameter type detection (named vs positional) - Uses CompoundOrSingleStatement parsing for all SQL constructs - Consistent error handling and validation - Support for complex data types (arrays, maps, nested structures) - Thread-safe operations with position-aware error context
The handler integrates with the parser through callback mechanisms stored in CurrentOrigin to ensure error positions are correctly mapped back to the original SQL text.
Basic usage:
val context = NamedParameterContext(Map("param1" -> Literal(42))) val result = ParameterHandler.substituteParameters("SELECT :param1", context) // result: "SELECT 42"
- See also
SubstituteParamsParser for the underlying parameter substitution logic
Example: - object ParserUtils extends SparkParserUtils
A collection of utility methods for use during the parsing process.
- object SqlScriptingLabelContext
- object SubstituteParamsParser