d-c-manning commented on code in PR #1755:
URL: https://github.com/apache/phoenix/pull/1755#discussion_r1423261183
##########
phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixTableLevelMetricsIT.java:
##########
@@ -1218,6 +1216,62 @@ private static void assertMetricValue(Metric m,
MetricType checkType, long compa
}
}
+ @Test public void testMetricsWithIndexUsage() throws Exception {
+ // Generate unique names for the table and index
+ String dataTable = generateUniqueName();
+ String indexName = generateUniqueName() + "_IDX";
+
+
+ try (Connection conn = getConnFromTestDriver()) {
+ // Create a mutable table with one key and one column
+ String tableDdl = "CREATE TABLE "
+ + dataTable
+ + " (K VARCHAR NOT NULL, V INTEGER, CONSTRAINT PK PRIMARY
KEY(K))" + " IMMUTABLE_ROWS = true";
+ conn.createStatement().execute(tableDdl);
+
+ // Create an index for the column 'V'
+ String indexDdl = "CREATE INDEX " + indexName + " ON " + dataTable
+ " (V)";
+ conn.createStatement().execute(indexDdl);
+ }
+
+ // Insert data into the table
+ String insertData = "UPSERT INTO " + dataTable + " VALUES (?, ?)";
+ try (Connection conn = getConnFromTestDriver()) {
+ PreparedStatement stmt = conn.prepareStatement(insertData);
Review Comment:
nit: should PreparedStatement also be in try-with-resources, as it is in the
subsequent block of code?
```suggestion
try (Connection conn = getConnFromTestDriver()); PreparedStatement
stmt = conn.prepareStatement(insertData)) {
```
--
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]