Move all analyticscore references behind a AnalyticsCoreUtil class#16258
Conversation
There was a problem hiding this comment.
i grepped for import.*analyticscore, looks like theres still an import in gcp/src/main/java/org/apache/iceberg/gcp/gcs/GcsInputStreamWrapper.java
i would expect all the imports for analytics-core isolated in AnalyticsCoreUtil.java
EDIT: ok looks like GcsInputStreamWrapper is only called by AnalyticsCoreUtil. no issues here
This is actually a good call, you might as well make GcsinputStreamwrapper an inner class of AnalyticsCoreUtil and remove the possibility of another caller accidentally using it. |
kevinjqliu
left a comment
There was a problem hiding this comment.
i tested this locally by adding this to the build.gradle's `iceberg-gcp' entry:
task testWithoutAnalyticsCore(type: Test) {
useJUnitPlatform()
description = 'Runs tests without gcs-analytics-core on the classpath'
classpath = test.classpath.filter {
// exclude all JARs from the com.google.cloud.gcs.analytics group (analyticscore classes)
!it.path.contains('com.google.cloud.gcs.analytics/')
}
jvmArgs += project.property('extraJvmArgs')
include '**/TestGCSFileIO.class'
include '**/TestGCSInputStream.class'
include '**/TestGCSOutputStream.class'
include '**/TestGCSLocation.class'
}
This filters out the analytics-core library. And everything ran successfully.
talatuyarer
left a comment
There was a problem hiding this comment.
I believe I have addressed all comments.
kevinjqliu
left a comment
There was a problem hiding this comment.
LGTM
have a few minor nits
d2a613f to
6c6289b
Compare
|
|
||
| private AnalyticsCoreUtil() {} | ||
|
|
||
| static AutoCloseable createFileSystem(Map<String, String> properties, Credentials credentials) { |
There was a problem hiding this comment.
Here better to return GcsFileSystem rather than AutoCloseable.
There was a problem hiding this comment.
Returning GcsFileSystem would expose the analytics-core class in the method descriptor, which is the opposite of what we're trying to achieve (e.g., PrefixedStorage.gcsFileSystem()). Could you clarify if there's another reason for the suggestion? @aihuaxu
There was a problem hiding this comment.
@talatuyarer I think you can return GcsFileSystem here but the caller can still use AutoCloseable, right?
But it's nit.
kevinjqliu
left a comment
There was a problem hiding this comment.
LGTM thanks for fixing this
|
Thanks for the fix @talatuyarer and everyone for reviewing |
We dont want to load analytics classes if users does not use analytic feature.
https://lists.apache.org/thread/mv0xhgoqvj2doh74g4wr8pgft3ozj0hz