okumin commented on code in PR #6461:
URL: https://github.com/apache/hive/pull/6461#discussion_r3187840777
##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java:
##########
@@ -2516,6 +2520,24 @@ public static <I> Class<? extends I>
getClass(Configuration conf, ConfVars var,
conf.getClass(var.varname, defaultValue, xface);
}
+ /**
+ * Get class instances based on a configuration value
+ * @param conf configuration file to retrieve it from
+ * @param var variable to retrieve
+ * @return instances of the classes
+ */
+ public static Class<?>[] getClasses(Configuration conf, ConfVars var) {
+ assert var.defaultVal.getClass() == String.class;
+ Class<?> defaultClass;
+ try {
+ defaultClass = Class.forName((String) var.defaultVal);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("The default class " + var.defaultVal + "
does not exist");
+ }
+ String val = conf.get(var.varname);
+ return val == null ? conf.getClasses(var.hiveName, defaultClass) :
conf.getClasses(var.varname, defaultClass);
Review Comment:
Added this method so that HMS can pick up fallback variables.
```
% docker run --rm -p 9001:9001 --env
SERVICE_OPTS='-Dmetastore.iceberg.catalog.metrics.reporters=org.apache.iceberg.rest.metrics.LoggingMetricsReporter,org.apache.iceberg.rest.metrics.LoggingMetricsReporter'
apache/hive:standalone-metastore-4.3.0-SNAPSHOT
...
2026-05-05T10:41:32,238 INFO [qtp515442419-63]
metrics.LoggingMetricsReporter: Event reported at
2026-05-05T10:41:32.238290053Z: catalog=hive, table=default.test,
report=ScanReport{tableName=default.test, snapshotId=1000000000001,
filter=true, schemaId=0, projectedFieldIds=[1], projectedFieldNames=[id],
scanMetrics=ScanMetricsResult{totalPlanningDuration=TimerResult{timeUnit=NANOSECONDS,
totalDuration=PT2.644235116S, count=1},
resultDataFiles=CounterResult{unit=COUNT, value=3},
resultDeleteFiles=CounterResult{unit=COUNT, value=0},
totalDataManifests=CounterResult{unit=COUNT, value=1},
totalDeleteManifests=CounterResult{unit=COUNT, value=0},
scannedDataManifests=CounterResult{unit=COUNT, value=1},
skippedDataManifests=CounterResult{unit=COUNT, value=0},
totalFileSizeInBytes=null, totalDeleteFileSizeInBytes=null,
skippedDataFiles=null, skippedDeleteFiles=null, scannedDeleteManifests=null,
skippedDeleteManifests=null, indexedDeleteFiles=null, equalityDeleteFiles=null,
positionalDele
teFiles=null, dvs=null}, metadata={source=dummy-curl, user=test-user,
trace-id=dummy-trace-001}}
2026-05-05T10:41:32,244 INFO [qtp515442419-63]
metrics.LoggingMetricsReporter: Event reported at
2026-05-05T10:41:32.238290053Z: catalog=hive, table=default.test,
report=ScanReport{tableName=default.test, snapshotId=1000000000001,
filter=true, schemaId=0, projectedFieldIds=[1], projectedFieldNames=[id],
scanMetrics=ScanMetricsResult{totalPlanningDuration=TimerResult{timeUnit=NANOSECONDS,
totalDuration=PT2.644235116S, count=1},
resultDataFiles=CounterResult{unit=COUNT, value=3},
resultDeleteFiles=CounterResult{unit=COUNT, value=0},
totalDataManifests=CounterResult{unit=COUNT, value=1},
totalDeleteManifests=CounterResult{unit=COUNT, value=0},
scannedDataManifests=CounterResult{unit=COUNT, value=1},
skippedDataManifests=CounterResult{unit=COUNT, value=0},
totalFileSizeInBytes=null, totalDeleteFileSizeInBytes=null,
skippedDataFiles=null, skippedDeleteFiles=null, scannedDeleteManifests=null,
skippedDeleteManifests=null, indexedDeleteFiles=null, equalityDeleteFiles=null,
positionalDele
teFiles=null, dvs=null}, metadata={source=dummy-curl, user=test-user,
trace-id=dummy-trace-001}}
...
2026-05-05T10:41:36,132 INFO [JettyShutdownThread]
metrics.LoggingMetricsReporter: Closing
org.apache.iceberg.rest.metrics.LoggingMetricsReporter
2026-05-05T10:41:36,133 INFO [JettyShutdownThread]
metrics.LoggingMetricsReporter: Closing
org.apache.iceberg.rest.metrics.LoggingMetricsReporter
```
```
$ docker run --rm -p 9001:9001 --env
SERVICE_OPTS='-Dhive.metastore.iceberg.catalog.metrics.reporters=org.apache.iceberg.rest.metrics.LoggingMetricsReporter,org.apache.iceberg.rest.metrics.LoggingMetricsReporter'
apache/hive:standalone-metastore-4.3.0-SNAPSHOT
...
2026-05-05T10:50:10,614 INFO [qtp515442419-63]
metrics.LoggingMetricsReporter: Event reported at
2026-05-05T10:50:10.614012292Z: catalog=hive, table=default.test,
report=ScanReport{tableName=default.test, snapshotId=1000000000001,
filter=true, schemaId=0, projectedFieldIds=[1], projectedFieldNames=[id],
scanMetrics=ScanMetricsResult{totalPlanningDuration=TimerResult{timeUnit=NANOSECONDS,
totalDuration=PT2.644235116S, count=1},
resultDataFiles=CounterResult{unit=COUNT, value=3},
resultDeleteFiles=CounterResult{unit=COUNT, value=0},
totalDataManifests=CounterResult{unit=COUNT, value=1},
totalDeleteManifests=CounterResult{unit=COUNT, value=0},
scannedDataManifests=CounterResult{unit=COUNT, value=1},
skippedDataManifests=CounterResult{unit=COUNT, value=0},
totalFileSizeInBytes=null, totalDeleteFileSizeInBytes=null,
skippedDataFiles=null, skippedDeleteFiles=null, scannedDeleteManifests=null,
skippedDeleteManifests=null, indexedDeleteFiles=null, equalityDeleteFiles=null,
positionalDele
teFiles=null, dvs=null}, metadata={source=dummy-curl, user=test-user,
trace-id=dummy-trace-001}}
2026-05-05T10:50:10,619 INFO [qtp515442419-63]
metrics.LoggingMetricsReporter: Event reported at
2026-05-05T10:50:10.614012292Z: catalog=hive, table=default.test,
report=ScanReport{tableName=default.test, snapshotId=1000000000001,
filter=true, schemaId=0, projectedFieldIds=[1], projectedFieldNames=[id],
scanMetrics=ScanMetricsResult{totalPlanningDuration=TimerResult{timeUnit=NANOSECONDS,
totalDuration=PT2.644235116S, count=1},
resultDataFiles=CounterResult{unit=COUNT, value=3},
resultDeleteFiles=CounterResult{unit=COUNT, value=0},
totalDataManifests=CounterResult{unit=COUNT, value=1},
totalDeleteManifests=CounterResult{unit=COUNT, value=0},
scannedDataManifests=CounterResult{unit=COUNT, value=1},
skippedDataManifests=CounterResult{unit=COUNT, value=0},
totalFileSizeInBytes=null, totalDeleteFileSizeInBytes=null,
skippedDataFiles=null, skippedDeleteFiles=null, scannedDeleteManifests=null,
skippedDeleteManifests=null, indexedDeleteFiles=null, equalityDeleteFiles=null,
positionalDele
teFiles=null, dvs=null}, metadata={source=dummy-curl, user=test-user,
trace-id=dummy-trace-001}}
...
2026-05-05T10:50:13,075 INFO [JettyShutdownThread]
metrics.LoggingMetricsReporter: Closing
org.apache.iceberg.rest.metrics.LoggingMetricsReporter
2026-05-05T10:50:13,075 INFO [JettyShutdownThread]
metrics.LoggingMetricsReporter: Closing
org.apache.iceberg.rest.metrics.LoggingMetricsReporter
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]