ParserInterface — SQL Parser Contract

ParserInterface is the contract of SQL parsers that can parse Expressions, LogicalPlans, TableIdentifiers, and StructTypes given the textual representation of SQL statements.

package org.apache.spark.sql.catalyst.parser

trait ParserInterface {
  def parseExpression(sqlText: String): Expression
  def parsePlan(sqlText: String): LogicalPlan
  def parseTableIdentifier(sqlText: String): TableIdentifier
  def parseTableSchema(sqlText: String): StructType
}
Note
AbstractSqlParser is the one and only known extension of the ParserInterface Contract in Spark SQL.

ParserInterface is available as sqlParser in SessionState.

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

scala> :type spark.sessionState.sqlParser
org.apache.spark.sql.catalyst.parser.ParserInterface
Table 1. ParserInterface Contract
Method Description

parseExpression

Parses a SQL text to an Expression

Used in the following:

parsePlan

Parses a SQL text to a LogicalPlan

Used when:

parseTableIdentifier

Parses a SQL text to a TableIdentifier

Used when:

parseTableSchema

Parses a SQL text to a StructType

Used when:

results matching ""

    No results matching ""