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

[SPARK-37061][SQL] Fix CustomMetrics when using Inner Classes #34345

Closed
wants to merge 1 commit into from

Conversation

RussellSpitzer
Copy link
Member

What changes were proposed in this pull request?

Previously CustomMetrics use Class.getCanonicalName when attempting to get the
class name of CustomMetric implementations. These names replace special characters
for marking inner classes like ($) with ".". While those names are appropriate for
referring to classes within source files, they will not work during reflection where
the Class.getName output should be used.

Why are the changes needed?

InnerClasses could never be found in when they are used as Custom Metrics

Does this PR introduce any user-facing change?

No

How was this patch tested?

Tests modified so they access both an independent metric class as well as an inner class.

Previously CustomMetrics use Class.getCanonicalName when attempting to get the
class name of CustomMetric implementations. These names replace special characters
for marking inner classes like ($) with ".". While those names are appropriate for
referring to classes withing source files, they will not work during reflection where
the Class.getName output should be used.
@dongjoon-hyun dongjoon-hyun changed the title SPARK-37061: Fix CustomMetrics when using Inner Classes [SPARK-37061][CORE] Fix CustomMetrics when using Inner Classes Oct 21, 2021
@dongjoon-hyun
Copy link
Member

Thank you for making a PR, @RussellSpitzer .

cc @viirya

@viirya viirya changed the title [SPARK-37061][CORE] Fix CustomMetrics when using Inner Classes [SPARK-37061][SQL] Fix CustomMetrics when using Inner Classes Oct 21, 2021
Copy link
Member

@viirya viirya left a comment

Choose a reason for hiding this comment

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

Thanks for catching and fixing it!

dongjoon-hyun pushed a commit that referenced this pull request Oct 21, 2021
### What changes were proposed in this pull request?
Previously CustomMetrics use Class.getCanonicalName when attempting to get the
class name of CustomMetric implementations. These names replace special characters
for marking inner classes like ($) with ".". While those names are appropriate for
referring to classes within source files, they will not work during reflection where
the Class.getName output should be used.

### Why are the changes needed?
InnerClasses could never be found in when they are used as Custom Metrics

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Tests modified so they access both an independent metric class as well as an inner class.

Closes #34345 from RussellSpitzer/SPARK-37061.

Authored-by: Russell Spitzer <russell.spitzer@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 2ce551e)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@dongjoon-hyun
Copy link
Member

Merged to master/3.2.

@RussellSpitzer RussellSpitzer deleted the SPARK-37061 branch October 21, 2021 03:10
@SparkQA
Copy link

SparkQA commented Oct 21, 2021

Test build #144475 has finished for PR 34345 at commit b3b5b75.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

sunchao pushed a commit to sunchao/spark that referenced this pull request Dec 8, 2021
### What changes were proposed in this pull request?
Previously CustomMetrics use Class.getCanonicalName when attempting to get the
class name of CustomMetric implementations. These names replace special characters
for marking inner classes like ($) with ".". While those names are appropriate for
referring to classes within source files, they will not work during reflection where
the Class.getName output should be used.

### Why are the changes needed?
InnerClasses could never be found in when they are used as Custom Metrics

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Tests modified so they access both an independent metric class as well as an inner class.

Closes apache#34345 from RussellSpitzer/SPARK-37061.

Authored-by: Russell Spitzer <russell.spitzer@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 2ce551e)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit b776709)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
catalinii pushed a commit to lyft/spark that referenced this pull request Feb 22, 2022
### What changes were proposed in this pull request?
Previously CustomMetrics use Class.getCanonicalName when attempting to get the
class name of CustomMetric implementations. These names replace special characters
for marking inner classes like ($) with ".". While those names are appropriate for
referring to classes within source files, they will not work during reflection where
the Class.getName output should be used.

### Why are the changes needed?
InnerClasses could never be found in when they are used as Custom Metrics

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Tests modified so they access both an independent metric class as well as an inner class.

Closes apache#34345 from RussellSpitzer/SPARK-37061.

Authored-by: Russell Spitzer <russell.spitzer@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 2ce551e)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
catalinii pushed a commit to lyft/spark that referenced this pull request Mar 4, 2022
### What changes were proposed in this pull request?
Previously CustomMetrics use Class.getCanonicalName when attempting to get the
class name of CustomMetric implementations. These names replace special characters
for marking inner classes like ($) with ".". While those names are appropriate for
referring to classes within source files, they will not work during reflection where
the Class.getName output should be used.

### Why are the changes needed?
InnerClasses could never be found in when they are used as Custom Metrics

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Tests modified so they access both an independent metric class as well as an inner class.

Closes apache#34345 from RussellSpitzer/SPARK-37061.

Authored-by: Russell Spitzer <russell.spitzer@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 2ce551e)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants