Skip to content

[CORE] Merge SubstraitUtil classes#10587

Merged
zhztheplayer merged 1 commit intoapache:mainfrom
kevinwilfong:substrait_utils
Sep 4, 2025
Merged

[CORE] Merge SubstraitUtil classes#10587
zhztheplayer merged 1 commit intoapache:mainfrom
kevinwilfong:substrait_utils

Conversation

@kevinwilfong
Copy link
Copy Markdown
Collaborator

What changes are proposed in this pull request?

There are two classes called SubstraitUtil, one in gluten/utils and one in gluten/substrait/utils. The latter has one method
used in one location. This PR refactors them into a single class.

I ran into this when I tried to import both in the same file.

How was this patch tested?

Existing unit tests, this is just a refactor.

@github-actions github-actions bot added the CORE works for Gluten Core label Aug 29, 2025
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

if (obj == null) return null
var msg: Message = null
obj match {
case Some(s: String) => msg = StringValue.newBuilder.setValue(s).build
Copy link
Copy Markdown
Contributor

@zml1206 zml1206 Sep 1, 2025

Choose a reason for hiding this comment

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

Why use Some here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I'm new to Scala, I was having trouble getting this code to compile and that was something I found that worked. Spoke with someone more knowledgeable than me and they pointed out what I was doing wrong. Fixed.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 2, 2025

Run Gluten Clickhouse CI on x86


def convertJavaObjectToAny(obj: AnyRef): Any = {
if (obj == null) return null
var msg: Message = null
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.

suggestion:

val msg = obj match {
    ***
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I had to leave in the : Message otherwise I got a compiler error I think because the types in the different cases are different, but otherwise made the change.

// TODO: generate the message according to the object type
msg = StringValue.newBuilder.setValue(obj.toString).build
}
if (msg == null) return null
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 think this is redundant.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You're right, I copied that from the original code, but the contract of the build functions is that they don't return null so it's safe to remove it.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 3, 2025

Run Gluten Clickhouse CI on x86

@kevinwilfong
Copy link
Copy Markdown
Collaborator Author

ClickHouse CI failed with

org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /testFile.txt.COPYING could only be replicated to 0 nodes instead of minReplication (=1). There are 0 datanode(s) running and no node(s) are excluded in this operation.

I assume this is transient

@zml1206
Copy link
Copy Markdown
Contributor

zml1206 commented Sep 4, 2025

Run Gluten Clickhouse CI on x86

Copy link
Copy Markdown
Contributor

@zml1206 zml1206 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhztheplayer zhztheplayer merged commit d721f71 into apache:main Sep 4, 2025
55 checks passed
@kevinwilfong
Copy link
Copy Markdown
Collaborator Author

Thanks @zml1206 !

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.

3 participants