Repository navigation
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.
Which issue does this PR close?
Rationale for this change
In Apache Spark,
parse_urldelegates component extraction tojava.net.URI, which tokenizes the authority component without enforcing WHATWG 16-bit integer bounds (0 <= port <= 65535). Consequently, Spark successfully extracts requested components (such asHOST,AUTHORITY,PATH,QUERY,REF, andPROTOCOL) for URLs containing ports above 65535 (e.g.parse_url('http://spark.apache.org:99999/path', 'HOST')->'spark.apache.org').Previously,
datafusion-sparkrelied exclusively on Rust'surl::Url::parse, which fails withParseError::InvalidPortfor any port above 65535, causingparse_urlto returnNULLin non-ANSI mode and raise anInvalidPortexecution error in ANSI mode.What changes are included in this PR?
ParseUrl::parseactivated strictly uponErr(ParseError::InvalidPort):user:pass@), bracketed IPv6 addresses ([::1]:99999), and delimiters (/,?,#).URISyntaxException.:abc,:-80) returnNULLfor host while preserving raw authority, path, query, and ref.:80) in a sanitized URL string for WHATWG component extraction, but injects the verbatim unmutated authority string whenpart == "AUTHORITY".""vs"/") by checkingSelf::pathagainst the original URL.Are these changes tested?
crates/spark/src/function/url/parse_url.rs:test_parse_url_port_overflow_and_spark_parity: tests standard ports (8080, 80), boundary ports (65535, 65536), overflow ports (99999, 1000000), 32-bit overflow ports (9999999999), empty ports, no ports, and non-numeric ports (:abc).test_parse_url_structures_with_overflow_port: tests IPv4, bracketed IPv6, userinfo, encoded path characters, empty paths, and query-only paths with port 99999.test_parse_url_overflow_port_eval_modes: tests legacy, try, and ANSI evaluation modes.crates/sqllogictest/test_files/url/parse_url.slt:# xfail spark: ... (#365)comments on lines 339 and 364 per runner guidelines.'spark.apache.org'for both legacy and ANSI modes.AUTHORITY,PATH,QUERY,REF,PROTOCOL, and bracketed IPv6 with port 99999.java.net.URIexecution and PySpark 4.2.0.Are there any user-facing changes?
Yes.
parse_urlno longer rejects URLs containing ports above 65535, matching Apache Spark behavior.