You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "ozenyunus35 (via GitHub)" <gi...@apache.org> on 2026/10/15 00:49:11 UTC
[PR] fix(spark): return NULL from parse_url for a malformed URL unless ANSI [datafusion]
ozenyunus35 opened a new pull request, #26344:
URL: https://github.com/apache/datafusion/pull/26344
## Which issue does this PR close?
- Closes #26341.
## Rationale for this change
In Spark, `parse_url` returns NULL for a malformed URL unless ANSI mode is on, and only then raises `INVALID_URL`. The `datafusion-spark` version always raised, and didn't look at `datafusion.execution.enable_ansi_mode`, so with the default (ANSI off) a query that returns NULL in Spark failed here.
## What changes are included in this PR?
- `ParseUrl::invoke_with_args` reads `enable_ansi_mode` from the config, the same way `elt` does.
- `spark_parse_url` turns a parse error into NULL when ANSI mode is off, like `try_parse_url` does; with ANSI mode on it keeps the current error. Argument count and type errors are not affected.
## What is the testing strategy for this PR?
- `parse_url.slt`: the malformed URL case from the issue now returns NULL by default and still errors with `enable_ansi_mode = true`, and the same for a URL with an out-of-range port (`InvalidPort`). Without the change, the two NULL cases fail.
- New unit test `test_malformed_url_is_null_unless_ansi` checks both modes on a batch with a valid and a malformed URL.
- `cargo test -p datafusion-spark --lib url::parse_url`, the `spark/url` sqllogictests and `cargo clippy -p datafusion-spark --all-targets -- -D warnings` pass.
## Are there any user-facing changes?
Yes: with ANSI mode off (the default), `parse_url` returns NULL for a malformed URL instead of an error, matching Spark.
I used an AI assistant to help draft parts of the code and tests; I reviewed the changes and ran the tests myself.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark): return NULL from parse_url for a malformed URL unless ANSI [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #26344:
URL: https://github.com/apache/datafusion/pull/26344#issuecomment-6506377016
Thanks for the contribution! I am closing this under DataFusion's AI Dump policy.
https://datafusion.apache.org/contributor-guide/ai-policy.html#what-is-an-ai-dump-and-why-it-is-not-helpful
Review capacity is very limited and this is one of three Spark compatibility PRs opened the same day across unrelated functions, with no engagement since. The policy asks new contributors to work with maintainers on one PR at a time rather than opening several at once.
If this fix matters to you, please pick the single change you care most about, reopen or resubmit it with a short description in your own words, and we are happy to help with review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix(spark): return NULL from parse_url for a malformed URL unless ANSI [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed pull request #26344: fix(spark): return NULL from parse_url for a malformed URL unless ANSI
URL: https://github.com/apache/datafusion/pull/26344
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org