Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support invalid partToExtract for parse_url #11661

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration_tests/src/main/python/url_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

url_gen = StringGen(url_pattern)

supported_parts = ['PROTOCOL', 'HOST', 'QUERY', 'PATH']
supported_parts = ['PROTOCOL', 'HOST', 'QUERY', 'PATH', 'invalid', 'path']
unsupported_parts = ['REF', 'FILE', 'AUTHORITY', 'USERINFO']

@pytest.mark.parametrize('data_gen', [url_gen, edge_cases_gen], ids=idfn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3379,7 +3379,7 @@ object GpuOverrides extends Logging {
willNotWorkOnGpu("Fail on error is not supported on GPU when parsing urls.")
}

extractStringLit(a.children(1)).map(_.toUpperCase) match {
extractStringLit(a.children(1)) match {
// In Spark, the key in parse_url could act like a regex, but GPU will match the key
// exactly. When key is literal, GPU will check if the key contains regex special and
// fallbcak to CPU if it does, but we are not able to fallback when key is column.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ object GpuParseUrl {

def isSupportedPart(part: String): Boolean = {
part match {
case PROTOCOL | HOST | QUERY | PATH =>
true
case _ =>
case REF | FILE | AUTHORITY | USERINFO =>
false
case _ => // PROTOCOL, HOST, QUERY, PATH and invalid parts are supported
true
}
}
}
Expand Down Expand Up @@ -73,7 +73,7 @@ case class GpuParseUrl(children: Seq[Expression])
throw new UnsupportedOperationException(s"$this is not supported partToExtract=$part. " +
s"Only PROTOCOL, HOST, QUERY and PATH are supported")
case _ =>
throw new IllegalArgumentException(s"Invalid partToExtract: $partToExtract")
return GpuColumnVector.columnVectorFromNull(url.getRowCount.toInt, StringType)
}
}

Expand Down