ParserInterface Contract — SQL Parsers

ParserInterface is the abstraction of SQL parsers that can convert (parse) textual representation of SQL statements into Expressions, LogicalPlans, TableIdentifiers, FunctionIdentifier, StructType, and DataType.

Table 1. ParserInterface Contract
Method Description

parseDataType

parseDataType(
  sqlText: String): DataType

Parses a SQL text to an DataType

Used when:

parseExpression

parseExpression(
  sqlText: String): Expression

Parses a SQL text to an Expression

Used in the following:

parseFunctionIdentifier

parseFunctionIdentifier(
  sqlText: String): FunctionIdentifier

Parses a SQL text to an FunctionIdentifier

Used when:

parsePlan

parsePlan(
  sqlText: String): LogicalPlan

Parses a SQL text to a LogicalPlan

Used when:

parseTableIdentifier

parseTableIdentifier(
  sqlText: String): TableIdentifier

Parses a SQL text to a TableIdentifier

Used when:

parseTableSchema

parseTableSchema(
  sqlText: String): StructType

Parses a SQL text to a schema (StructType)

Used when:

Note
AbstractSqlParser is the base extension of the ParserInterface contract in Spark SQL.

ParserInterface is available as sqlParser property of SessionState.

scala> :type spark
org.apache.spark.sql.SparkSession

scala> :type spark.sessionState.sqlParser
org.apache.spark.sql.catalyst.parser.ParserInterface

results matching ""

    No results matching ""