The isHint() method was entirely in Java, so I converted it manually to Python.
Java has a char type which can be used to compare ascii values of characters with integers, but this comparison needs to be done explicitly in Python with chr(...)
Modified the AST to store parsed hint statements by adding a Hint tree node type and a list of hints to SelectExpression.
Summary
This change adds support for parsing Spark SQL hints using the ANTLR parser and our custom SQL AST.
The following changes were made:
antlr4 -Dlanguage=Python3 -visitor SqlBaseLexer.g4 SqlBaseParser.g4 -o generated
.isHint()
method was entirely in Java, so I converted it manually to Python.char
type which can be used to compare ascii values of characters with integers, but this comparison needs to be done explicitly in Python withchr(...)
Hint
tree node type and a list of hints toSelectExpression
.Test Plan
Added some tests for various Spark hints pulled from https://spark.apache.org/docs/latest/sql-ref-syntax-qry-select-hints.html
make check
passesmake test
shows 100% unit test coverageDeployment Plan
N/A