[Bug] parse_url ignores the key for a part other than QUERY, Spark returns NULL
维护者通常 1 天内回复
评估
调研方向
阅读 crates/spark/src/function/url/parse_url.rs,尤其是 L87-L90 和 L110-L113 处的 QUERY 分支,以及重复同一 match 的 try_parse_url。由于开放的 PR #390 会把该 match 移到 extract_url_part,请先检查它,以便修复落在正确的位置而不是产生冲突。完成意味着第三个 key 参数对除 QUERY 之外的每个部分都返回 NULL;请用 issue 中的查询在 sqllogictest runner 下以 simplify 和 evaluate 两种模式验证。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
With a third key argument, Spark's parse_url returns NULL unless the part is QUERY. datafusion-spark ignores the key for the other parts and returns the part itself.
The key is only read in the two QUERY arms: L87-L90 for schemeless URLs and L110-L113 otherwise. The other arms return their part whatever the key is. try_parse_url does the same.
To Reproduce
SELECT parse_url('http://spark.apache.org/path?query=1', 'HOST', 'query'),
parse_url('http://spark.apache.org/path?query=1', 'PATH', 'query'),
parse_url('http://spark.apache.org/path?query=1', 'PROTOCOL', 'query'),
parse_url('http://spark.apache.org/path?query=1', 'QUERY', 'query');
SELECT parse_url('/path?query=1', 'PATH', 'query');
SELECT try_parse_url('http://spark.apache.org/path?query=1', 'HOST', 'query');
datafusion-spark returns:
spark.apache.org /path http 1
/path
spark.apache.org
Expected behavior
As in Spark:
NULL NULL NULL 1
NULL
NULL
Spark versions
Spark 4.0.0: ParseUrlEvaluator.evaluate with a key starts with if (path != QUERY) return null (UrlExpressionEvalUtils.scala#L77). Spark 3.5.0 has the same check (urlExpressions.scala#L279). Spark 4.0's try_parse_url is ParseUrl(children, failOnError = false) (urlExpressions.scala#L184), so the same check applies. Spark 3.5 has no try_parse_url. Not run on a live Spark.
datafusion-spark version
main at 2129f38
Additional context
Open PR #390 moves this match into extract_url_part. Found with the sqllogictest runner, in both simplify and evaluate modes.
cc @andygrove
- 主要语言
- Rust
- 星标
- 13
- 派生
- 31
- 平均合并
- 2 天 2 小时
- 30 天内合并 PR
- 96
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion-spark 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 84/100
apache/datafusion-spark#440 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
apache/datafusion-spark#439 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
apache/datafusion-spark#431 ·
维护者通常 1 天内回复
-
[Bug] width_bucket returns NULL for an infinite value可能已有人在做 @vaidik787 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
apache/datafusion-spark#424 ·
维护者通常 1 天内回复
-
[Bug] format_string with %#e puts the decimal point after the exponent可能已有人在做 @vaidik787 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
apache/datafusion-spark#423 ·
维护者通常 1 天内回复
查看 apache/datafusion-spark 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
roc-lang/basic-webserver#277 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
samkerrcode/opengent#113 ·
维护者通常 1 天内回复
-
app bug session
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复