Skip to content

Conversation

@majian1998
Copy link
Contributor

Related PR: #13625
Since support for Spark 3.4 will be removed in version 1.11, this fix is only applied to Spark 3.5.

@github-actions github-actions bot added the spark label Nov 3, 2025
@huaxingao
Copy link
Contributor

@majian1998 Is this a clean back-port?

@majian1998
Copy link
Contributor Author

@majian1998 Is this a clean back-port?

@huaxingao Yes, just a straight copy.

Copy link
Contributor

@huaxingao huaxingao left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +77 to +82
ParserInterface next = getNextDelegateParser(current);
if (next == null) {
break;
}

current = next;

Choose a reason for hiding this comment

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

Suggested change
ParserInterface next = getNextDelegateParser(current);
if (next == null) {
break;
}
current = next;
current = getNextDelegateParser(current);

clazz = clazz.getSuperclass();
}
} catch (Exception e) {
// ignore

Choose a reason for hiding this comment

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

shouldn't we at least log something?

Comment on lines +69 to +71
} catch (NoSuchFieldException e) {
clazz = clazz.getSuperclass();
}

Choose a reason for hiding this comment

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

add log to help RCA if something goes wrong

Comment on lines +97 to +99
} catch (NoSuchFieldException e) {
clazz = clazz.getSuperclass();
}

Choose a reason for hiding this comment

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

same as above

Comment on lines +131 to +141
when(icebergParser.parseSortOrder("id ASC NULLS FIRST")).thenReturn(expected);

ParserInterface wrapper = new WrapperParser(icebergParser);

setSessionStateParser(spark.sessionState(), wrapper);

List<ExtendedParser.RawOrderField> result =
ExtendedParser.parseSortOrder(spark, "id ASC NULLS FIRST");
assertThat(result).isSameAs(expected);

verify(icebergParser).parseSortOrder("id ASC NULLS FIRST");

Choose a reason for hiding this comment

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

Suggested change
when(icebergParser.parseSortOrder("id ASC NULLS FIRST")).thenReturn(expected);
ParserInterface wrapper = new WrapperParser(icebergParser);
setSessionStateParser(spark.sessionState(), wrapper);
List<ExtendedParser.RawOrderField> result =
ExtendedParser.parseSortOrder(spark, "id ASC NULLS FIRST");
assertThat(result).isSameAs(expected);
verify(icebergParser).parseSortOrder("id ASC NULLS FIRST");
when(icebergParser.parseSortOrder("id ASC NULLS FIRST")).thenReturn(expected);
verify(icebergParser).parseSortOrder("id ASC NULLS FIRST");
ParserInterface wrapper = new WrapperParser(icebergParser);
setSessionStateParser(spark.sessionState(), wrapper);
List<ExtendedParser.RawOrderField> result =
ExtendedParser.parseSortOrder(spark, "id ASC NULLS FIRST");
assertThat(result).isSameAs(expected);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn’t work as expected—verify needs to go after you actually call the method. Otherwise, there’s nothing to verify yet

Comment on lines +172 to +179
when(icebergParser.parseSortOrder("id ASC NULLS FIRST")).thenReturn(expected);
ParserInterface parser = new GrandChildParser(icebergParser);
setSessionStateParser(spark.sessionState(), parser);

List<ExtendedParser.RawOrderField> result =
ExtendedParser.parseSortOrder(spark, "id ASC NULLS FIRST");
assertThat(result).isSameAs(expected);
verify(icebergParser).parseSortOrder("id ASC NULLS FIRST");

Choose a reason for hiding this comment

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

Suggested change
when(icebergParser.parseSortOrder("id ASC NULLS FIRST")).thenReturn(expected);
ParserInterface parser = new GrandChildParser(icebergParser);
setSessionStateParser(spark.sessionState(), parser);
List<ExtendedParser.RawOrderField> result =
ExtendedParser.parseSortOrder(spark, "id ASC NULLS FIRST");
assertThat(result).isSameAs(expected);
verify(icebergParser).parseSortOrder("id ASC NULLS FIRST");
when(icebergParser.parseSortOrder("id ASC NULLS FIRST")).thenReturn(expected);
verify(icebergParser).parseSortOrder("id ASC NULLS FIRST");
ParserInterface parser = new GrandChildParser(icebergParser);
setSessionStateParser(spark.sessionState(), parser);
List<ExtendedParser.RawOrderField> result =
ExtendedParser.parseSortOrder(spark, "id ASC NULLS FIRST");
assertThat(result).isSameAs(expected);

@huaxingao
Copy link
Contributor

This is a backport PR; let’s merge it unchanged to keep it identical to the previous one.
@majian1998 Could you open a follow‑up PR (for both 3.5 and 4.0) to address @kamcheungting-db's comments?

@huaxingao huaxingao merged commit 13ed667 into apache:main Nov 3, 2025
27 checks passed
@huaxingao
Copy link
Contributor

Merged. Thanks @majian1998 for the PR! Thanks @singhpk234 @kamcheungting-db for the review!
@majian1998 Could you open a follow‑up PR to address @kamcheungting-db's comments?

@majian1998
Copy link
Contributor Author

This is a backport PR; let’s merge it unchanged to keep it identical to the previous one. @majian1998 Could you open a follow‑up PR (for both 3.5 and 4.0) to address @kamcheungting-db's comments?

@huaxingao Got it, I’ll read through the comments and create a follow-up PR for 3.5 and 4.0.

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.

4 participants