Skip to content

Commit b68c615

Browse files
parthchandraclaude
andauthored
feat: make parse_url compatible (#4413)
* feat: make parse_url compatible Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d7147db commit b68c615

8 files changed

Lines changed: 857 additions & 24 deletions

File tree

docs/source/contributor-guide/spark_expressions_support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@
605605

606606
### url_funcs
607607

608-
- [x] parse_url (Incompatible: native diverges from Spark on edge cases)
608+
- [x] parse_url
609609
- [x] try_url_decode
610610
- 4.0.1, 2026-05-05
611611
- [x] url_decode

native/core/src/execution/jni_api.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ use datafusion::{
4242
prelude::{SessionConfig, SessionContext},
4343
};
4444
use datafusion_comet_proto::spark_operator::Operator;
45+
use datafusion_comet_spark_expr::url_funcs::{CometParseUrl, CometTryParseUrl};
4546
use datafusion_spark::function::array::array_contains::SparkArrayContains;
4647
use datafusion_spark::function::bitwise::bit_count::SparkBitCount;
4748
use datafusion_spark::function::bitwise::bit_get::SparkBitGet;
@@ -69,8 +70,6 @@ use datafusion_spark::function::string::char::CharFunc;
6970
use datafusion_spark::function::string::concat::SparkConcat;
7071
use datafusion_spark::function::string::luhn_check::SparkLuhnCheck;
7172
use datafusion_spark::function::string::space::SparkSpace;
72-
use datafusion_spark::function::url::parse_url::ParseUrl as SparkParseUrl;
73-
use datafusion_spark::function::url::try_parse_url::TryParseUrl as SparkTryParseUrl;
7473
use datafusion_spark::function::url::try_url_decode::TryUrlDecode as SparkTryUrlDecode;
7574
use datafusion_spark::function::url::url_decode::UrlDecode as SparkUrlDecode;
7675
use datafusion_spark::function::url::url_encode::UrlEncode as SparkUrlEncode;
@@ -603,8 +602,8 @@ fn register_datafusion_spark_function(session_ctx: &SessionContext) {
603602
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkUrlEncode::default()));
604603
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkTryUrlDecode::default()));
605604
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkCsc::default()));
606-
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkParseUrl::default()));
607-
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkTryParseUrl::default()));
605+
session_ctx.register_udf(ScalarUDF::new_from_impl(CometParseUrl::default()));
606+
session_ctx.register_udf(ScalarUDF::new_from_impl(CometTryParseUrl::default()));
608607
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkFactorial::default()));
609608
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkSec::default()));
610609
session_ctx.register_udf(ScalarUDF::new_from_impl(SparkRint::default()));

native/spark-expr/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ mod map_funcs;
6363
pub use map_funcs::spark_map_sort;
6464
mod math_funcs;
6565
mod nondetermenistic_funcs;
66+
pub mod url_funcs;
6667

6768
pub use array_funcs::*;
6869
pub use conditional_funcs::*;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
mod parse_url;
19+
20+
pub use parse_url::{CometParseUrl, CometTryParseUrl};

0 commit comments

Comments
 (0)