[
https://issues.apache.org/jira/browse/PHOENIX-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17795548#comment-17795548
]
ASF GitHub Bot commented on PHOENIX-7144:
-----------------------------------------
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)) {
```
> TableLevel Phoenix Metrics returns base tableName when queried for Index
> Table.
> -------------------------------------------------------------------------------
>
> Key: PHOENIX-7144
> URL: https://issues.apache.org/jira/browse/PHOENIX-7144
> Project: Phoenix
> Issue Type: Improvement
> Reporter: vikas meka
> Assignee: vikas meka
> Priority: Major
> Fix For: 5.2.0
>
>
> TableClient Metrics returns BaseTable Name when Indexes are used. Phoenix
> Result set uses Index TableName while storing as DDL queries use BaseTable
> Name while storing metrics in HashMap.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)