gjacoby126 commented on code in PR #9452: URL: https://github.com/apache/iceberg/pull/9452#discussion_r1453711116
########## flink/v1.16/flink/src/main/java/org/apache/iceberg/flink/util/FlinkPackage.java: ########## @@ -19,15 +19,31 @@ package org.apache.iceberg.flink.util; import org.apache.flink.streaming.api.datastream.DataStream; +import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; public class FlinkPackage { - /** Choose {@link DataStream} class because it is one of the core Flink API. */ - private static final String VERSION = DataStream.class.getPackage().getImplementationVersion(); + + public static final String FLINK_UNKNOWN_VERSION = "Flink-UNKNOWN"; private FlinkPackage() {} /** Returns Flink version string like x.y.z */ public static String version() { - return VERSION; + try { + String version = getVersionFromJar(); + /* If we can't detect the exact implementation version from the jar (this can happen if the DataStream class + appears multiple times in the same classpath such as with shading), then the best we can do is say it's + unknown + */ + return version != null ? version : FLINK_UNKNOWN_VERSION; Review Comment: @nastra @stevenzwu - Iceberg's checkstyle config forbids naming a non-final static variable an all-caps name; it wants camel-case. Should I: 1. name it "version" OR 2. Name it VERSION and add a SuppressWarning flag OR 3. Name it VERSION and fix the checkstyle.xml to use the same regex as static constants use -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org