Repository navigation
Conversation
Spark's parse_url fails on a bad URL only when ANSI mode (failOnError) is on; otherwise it returns NULL. Wire enable_ansi_mode into ParseUrl the same way elt/round do, and map parse errors to NULL when ANSI is disabled. Argument-count and type errors still fail regardless of ANSI. Closes apache#26341.
Member
|
Closing due to
It's impossible to contribute responsibly in such PR volume, please don't do automated contribution in this project. |
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.
Which issue does this PR close?
Rationale for this change
Spark's
parse_urltreats a malformed URL as an error only when ANSI modeis enabled (
failOnError). With ANSI off (DataFusion's default), Sparkreturns NULL instead. Our
parse_urlalways raised, so queries that Sparkwould tolerate failed here.
try_parse_urlalready maps parse failures toNULL;
parse_urlshould do the same whenever ANSI is off.What changes are included in this PR?
ParseUrl::invoke_with_argsreadsenable_ansi_mode(same pattern aselt/round) and passes it intospark_parse_url.Wrong arity / non-string args still error either way.
space-in-scheme URL and an out-of-range port.
What is the testing strategy for this PR?
cargo test -p datafusion-spark --lib function::url::parse_urlcargo test -p datafusion-sqllogictest --test sqllogictests -- spark/url/parse_urlAre there any user-facing changes?
Yes — with the default (
enable_ansi_mode = false),parse_urlon amalformed URL now returns NULL instead of an Execution error. Callers that
need the strict behavior can set
datafusion.execution.enable_ansi_mode = trueor use
try_parse_urlwhen they always want NULL.AI assistance
Used AI tooling to locate the bug against Spark semantics and draft the
change; I reviewed the patch, ran the tests above, and wrote this description.