Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package apache
    Definition Classes
    org
  • package spark
    Definition Classes
    apache
  • package sql
    Definition Classes
    spark
  • package catalyst

    Catalyst is a library for manipulating relational query plans.

    Catalyst is a library for manipulating relational query plans. All classes in catalyst are considered an internal API to Spark SQL and are subject to change between minor releases.

    Definition Classes
    sql
  • package analysis

    Provides a logical query plan Analyzer and supporting classes for performing analysis.

    Provides a logical query plan Analyzer and supporting classes for performing analysis. Analysis consists of translating UnresolvedAttributes and UnresolvedRelations into fully typed objects using information in a schema Catalog.

    Definition Classes
    catalyst
  • package catalog
    Definition Classes
    catalyst
  • package csv
    Definition Classes
    catalyst
  • package dsl

    A collection of implicit conversions that create a DSL for constructing catalyst data structures.

    A collection of implicit conversions that create a DSL for constructing catalyst data structures.

    scala> import org.apache.spark.sql.catalyst.dsl.expressions._
    
    // Standard operators are added to expressions.
    scala> import org.apache.spark.sql.catalyst.expressions.Literal
    scala> Literal(1) + Literal(1)
    res0: org.apache.spark.sql.catalyst.expressions.Add = (1 + 1)
    
    // There is a conversion from 'symbols to unresolved attributes.
    scala> 'a.attr
    res1: org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute = 'a
    
    // These unresolved attributes can be used to create more complicated expressions.
    scala> 'a === 'b
    res2: org.apache.spark.sql.catalyst.expressions.EqualTo = ('a = 'b)
    
    // SQL verbs can be used to construct logical query plans.
    scala> import org.apache.spark.sql.catalyst.plans.logical._
    scala> import org.apache.spark.sql.catalyst.dsl.plans._
    scala> LocalRelation($"key".int, $"value".string).where('key === 1).select('value).analyze
    res3: org.apache.spark.sql.catalyst.plans.logical.LogicalPlan =
    Project [value#3]
     Filter (key#2 = 1)
      LocalRelation [key#2,value#3], []
    Definition Classes
    catalyst
  • package encoders
    Definition Classes
    catalyst
  • package expressions

    A set of classes that can be used to represent trees of relational expressions.

    A set of classes that can be used to represent trees of relational expressions. A key goal of the expression library is to hide the details of naming and scoping from developers who want to manipulate trees of relational operators. As such, the library defines a special type of expression, a NamedExpression in addition to the standard collection of expressions.

    Standard Expressions

    A library of standard expressions (e.g., Add, EqualTo), aggregates (e.g., SUM, COUNT), and other computations (e.g. UDFs). Each expression type is capable of determining its output schema as a function of its children's output schema.

    Named Expressions

    Some expression are named and thus can be referenced by later operators in the dataflow graph. The two types of named expressions are AttributeReferences and Aliases. AttributeReferences refer to attributes of the input tuple for a given operator and form the leaves of some expression trees. Aliases assign a name to intermediate computations. For example, in the SQL statement SELECT a+b AS c FROM ..., the expressions a and b would be represented by AttributeReferences and c would be represented by an Alias.

    During analysis, all named expressions are assigned a globally unique expression id, which can be used for equality comparisons. While the original names are kept around for debugging purposes, they should never be used to check if two attributes refer to the same value, as plan transformations can result in the introduction of naming ambiguity. For example, consider a plan that contains subqueries, both of which are reading from the same table. If an optimization removes the subqueries, scoping information would be destroyed, eliminating the ability to reason about which subquery produced a given attribute.

    Evaluation

    The result of expressions can be evaluated using the Expression.apply(Row) method.

    Definition Classes
    catalyst
  • package json
    Definition Classes
    catalyst
  • package optimizer
    Definition Classes
    catalyst
  • package parser
    Definition Classes
    catalyst
  • AbstractSqlParser
  • AstBuilder
  • CatalystSqlParser
  • CompoundBodyParsingContext
  • EnhancedLogicalPlan
  • HybridParameterContext
  • NamedParameterContext
  • ParameterContext
  • ParameterExpectation
  • ParameterHandler
  • ParserInterface
  • ParserUtils
  • PositionalParameterContext
  • SqlScriptingConditionContext
  • SqlScriptingLabelContext
  • SqlScriptingParsingContext
  • SubstituteParamsParser
  • package planning

    Contains classes for enumerating possible physical plans for a given logical query plan.

    Contains classes for enumerating possible physical plans for a given logical query plan.

    Definition Classes
    catalyst
  • package plans

    A collection of common abstractions for query plans as well as a base logical plan representation.

    A collection of common abstractions for query plans as well as a base logical plan representation.

    Definition Classes
    catalyst
  • package rules

    A framework for applying batches rewrite rules to trees, possibly to fixed point.

    A framework for applying batches rewrite rules to trees, possibly to fixed point.

    Definition Classes
    catalyst
  • package streaming
    Definition Classes
    catalyst
  • package trees

    A library for easily manipulating trees of operators.

    A library for easily manipulating trees of operators. Operators that extend TreeNode are granted the following interface:

    • Scala collection like methods (foreach, map, flatMap, collect, etc)

    - transform - accepts a partial function that is used to generate a new tree. When the partial function can be applied to a given tree segment, that segment is replaced with the result. After attempting to apply the partial function to a given node, the transform function recursively attempts to apply the function to that node's children.

    • debugging support - pretty printing, easy splicing of trees, etc.
    Definition Classes
    catalyst
  • package types
    Definition Classes
    catalyst
  • package util
    Definition Classes
    catalyst
  • package xml
    Definition Classes
    catalyst

package parser

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. parser
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. abstract class AbstractSqlParser extends AbstractParser with ParserInterface

    Base class for all ANTLR4 ParserInterface implementations.

  2. class AstBuilder extends DataTypeAstBuilder with SQLConfHelper with Logging with DataTypeErrorsBase

    The AstBuilder converts an ANTLR4 ParseTree into a catalyst Expression, LogicalPlan or TableIdentifier.

  3. class CatalystSqlParser extends AbstractSqlParser

    Concrete SQL parser for Catalyst-only SQL statements.

  4. class CompoundBodyParsingContext extends AnyRef
  5. implicit final class EnhancedLogicalPlan extends AnyVal

    Some syntactic sugar which makes it easier to work with optional clauses for LogicalPlans.

  6. 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)

  7. 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

  8. 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.

  9. trait ParserInterface extends DataTypeParserInterface

    Interface for a parser.

    Interface for a parser.

    Annotations
    @DeveloperApi()
  10. 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

  11. class SqlScriptingConditionContext extends AnyRef
  12. class SqlScriptingLabelContext extends AnyRef
  13. class SqlScriptingParsingContext extends AnyRef
  14. 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

  1. object CatalystSqlParser extends CatalystSqlParser

    For test-only.

  2. object ParameterExpectation extends Enumeration

    Parameter expectation types.

  3. 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.

    Example:
    1. 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

  4. object ParserUtils extends SparkParserUtils

    A collection of utility methods for use during the parsing process.

  5. object SqlScriptingLabelContext
  6. object SubstituteParamsParser

Inherited from AnyRef

Inherited from Any

Ungrouped