Repository navigation
[spark] Bind SQL parameters and time travel suffixes through the Paimon parser - #11696
Open
LuciferYang wants to merge 1 commit into
Open
LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Spark 4.1's
ParserInterface.parsePlanWithParametersdefaults toparsePlan, which drops the parameters.spark.sql(text, args),EXECUTE IMMEDIATE ... USINGand Spark Connect use it, so markers in Spark-parsed statements failed with UNBOUND_SQL_PARAMETER with Paimon's extensions enabled. Spark 4.3'sparseTemporalTableIdentifierdefault does not recognize the@v1suffix, sospark.read.table("t@v1")failed to parse.The change extracts
parsePlanWithDelegate(sqlText)(delegateParse): Paimon commands and parser rules stay on that path, the 4.1/4.2 and 4.3 parsers forwardparsePlanWithParametersto the delegate, 4.3 forwardsparseTemporalTableIdentifiertoo, and the 3.4-4.1 CREATE TABLE LIKE fallback parses its rebuilt statement through the same function soTBLPROPERTIESkeep the caller's arguments. Spark 4.0 and earlier bind afterparsePlanand are unaffected.Known limitation:
CALL sys.*and tag DDL reject markers in Paimon's grammar;COPY INTOand materialized views re-parse their embedded query without the caller's arguments. Either needs a design decision; a materialized view definition lives inmaterialized-table.definition-query, a format Flink reads. Tracked in #11695.Tests
ParserDelegationTestinpaimon-spark-ut, plus a subclass inpaimon-spark-4.2that the 4.3 module compiles and runs too, covers:spark.sql(text, args)with named arguments (including an INSERT) and with positional arguments;CREATE TABLE IDENTIFIER(:t) LIKE ...creates the table in the Paimon catalog;CREATE TABLE LIKE ... TBLPROPERTIES (...)bound by named and by positional arguments, asserting the stored table options;EXECUTE IMMEDIATE ... USINGwith positional and named arguments;spark.read.table("t@v1")andspark.table("t@v1")on Spark 4.3.Cases that need a Spark version the suite does not run on are skipped with
assume.