Skip to content

feat: support url encode expression - #3496

Closed
YutaLin wants to merge 4 commits into
apache:mainfrom
YutaLin:feat/url_encode_expression
Closed

YutaLin wants to merge 4 commits into
apache:mainfrom
YutaLin:feat/url_encode_expression

Conversation

@YutaLin

@YutaLin YutaLin commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #3185.

Rationale for this change

Comet does not currently support the Spark url_encode function, causing queries using this function to fall back to Spark's JVM execution instead of running natively on DataFusion.

The UrlEncode expression performs URL encoding (percent encoding) on a string input, converting special characters to their percent-encoded equivalents. This expression is implemented as a runtime replaceable expression that delegates to the UrlCodec.encode method for the actual encoding logic.

What changes are included in this PR?

Add native url encode function and staticinvoke urlencode object

How are these changes tested?

add url encode sql test and rs test

@YutaLin

YutaLin commented Feb 12, 2026

Copy link
Copy Markdown
Contributor Author

Hi @hsiang-c, can you take a look, thanks!

@YutaLin
YutaLin force-pushed the feat/url_encode_expression branch from 7a928b5 to 620c577 Compare February 12, 2026 04:57
/// - Special characters '.', '-', '*', '_' are not encoded
/// - All other characters are percent-encoded using UTF-8 bytes
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct SparkUrlEncode {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like DataFusion has it: apache/datafusion#17399

Maybe we can just use it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened a draft PR for url_decode using DataFusion 52+ built-in method: #3592. It's blocked on the DataFusion upgrade. @YutaLin You might want to consider the same serde-only approach for url_encode — it would be much less code to maintain.

@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.

@github-actions github-actions Bot added the Stale label Apr 27, 2026
@github-actions github-actions Bot closed this May 4, 2026
@YutaLin
YutaLin deleted the feat/url_encode_expression branch May 20, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support Spark expression: url_encode

3 participants