Skip to content

[GLUTEN-12909][VL] Support HiveGenericUDTF in HiveUDFTransformer - #12910

Open
WangGuangxin wants to merge 2 commits into
apache:mainfrom
WangGuangxin:hive_generic_udf
Open

[GLUTEN-12909][VL] Support HiveGenericUDTF in HiveUDFTransformer#12910
WangGuangxin wants to merge 2 commits into
apache:mainfrom
WangGuangxin:hive_generic_udf

Conversation

@WangGuangxin

@WangGuangxin WangGuangxin commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

This PR extends HiveUDFTransformer to recognize HiveGenericUDTF in addition to
HiveSimpleUDF and HiveGenericUDF.

Previously, HiveUDFTransformer only handled Hive simple UDFs and generic UDFs
when checking whether an expression is a Hive UDF and when extracting the Hive
function name and implementation class. As a result, HiveGenericUDTF could not
be recognized or mapped through the same transformer path.

This patch updates HiveUDFTransformer so that:

  • isHiveUDF returns true for HiveGenericUDTF
  • getHiveUDFNameAndClassName can extract the function name and class name from
    HiveGenericUDTF

In addition, this PR adds unit tests to verify that HiveGenericUDTF is properly
recognized, mapped, and converted through HiveUDFTransformer across supported
Spark versions.

How was this patch tested?

Added unit tests in gluten-ut for Spark 3.3, 3.4, 3.5, 4.0, and 4.1 to verify:

  • a HiveGenericUDTF can be found from the analyzed plan
  • HiveUDFTransformer.isHiveUDF recognizes it correctly
  • HiveUDFTransformer.getHiveUDFNameAndClassName returns the expected function
    name and implementation class
  • HiveUDFTransformer.replaceWithExpressionTransformer can map it to a
    GenericExpressionTransformer

Was this patch authored or co-authored using generative AI tooling?

Generated-by: TraeCode GPT-5

Related issue: #12909

@github-actions github-actions Bot added the CORE works for Gluten Core label Aug 27, 2026
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

1 similar comment
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@WangGuangxin

Copy link
Copy Markdown
Contributor Author

@philo-he @jinchengchenghh please review this when you are convenient

@philo-he philo-he left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good overall. Just one minor suggestion on the test. Please check if it makes sense. Thanks.

@@ -53,6 +57,47 @@ class GlutenHiveUDFSuite
}
}

testGluten("HiveGenericUDTF is recognized and mapped by HiveUDFTransformer") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume such test is independent of the supported Spark versions, and we don't need to extend HiveUDFSuite for enabling this test. Then, can we move the new tests to a new test suite under gluten-ut/test to avoid duplicate?

Generally, gluten-ut/sparkxxx should hold the corresponding Spark UTs and their variants.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86


@SlowHiveTest
class GlutenHiveUDFTransformerSuite
extends HiveUDFSuite

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we remove extending HiveUDFSuite if this test don't really depend on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants