hyperscaledesignhub commented on code in PR #8:
URL: https://github.com/apache/fluss-benchmarks/pull/8#discussion_r3413006953


##########
e2e-iot/fluss_flink_realtime/src/main/java/org/apache/fluss/benchmark/e2eplatformaws/inspect/FlussTableBucketChecker.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.fluss.benchmark.e2eplatformaws.inspect;
+
+import org.apache.fluss.client.Connection;
+import org.apache.fluss.client.ConnectionFactory;
+import org.apache.fluss.client.admin.Admin;
+import org.apache.fluss.config.ConfigOptions;
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.metadata.TablePath;
+
+import java.util.Collections;
+
+/**
+ * Simple CLI utility to check the number of buckets in a Fluss table.
+ * Uses Fluss Admin API to query table metadata directly.
+ */
+public final class FlussTableBucketChecker {
+
+    private FlussTableBucketChecker() {}
+
+    public static void main(String[] args) throws Exception {
+        if (args.length != 3) {
+            System.err.println("Usage: FlussTableBucketChecker 
<bootstrap-host:port> <database> <table>");
+            System.err.println("Example: FlussTableBucketChecker 
localhost:9124 iot sensor_readings");
+            System.exit(1);
+        }
+
+        String bootstrap = args[0];
+        String database = args[1];
+        String table = args[2];
+
+        Configuration conf = new Configuration();
+        conf.set(ConfigOptions.BOOTSTRAP_SERVERS, 
Collections.singletonList(bootstrap));
+
+        TablePath tablePath = TablePath.of(database, table);
+
+        try (Connection connection = ConnectionFactory.createConnection(conf);
+                Admin admin = connection.getAdmin()) {
+            
+            // Check if table exists
+            boolean tableExists = admin.tableExists(tablePath).get();
+            if (!tableExists) {
+                System.err.println("ERROR: Table '" + tablePath + "' does not 
exist");
+                System.exit(1);
+            }
+
+            // Get table info and bucket count
+            var tableInfo = admin.getTableInfo(tablePath).get();
+            int bucketCount = tableInfo.getNumBuckets();
+
+            // Output result
+            System.out.println("========================================");
+            System.out.println("Fluss Table Bucket Count Check");
+            System.out.println("========================================");
+            System.out.println("Bootstrap:  " + bootstrap);
+            System.out.println("Database:   " + database);
+            System.out.println("Table:      " + table);
+            System.out.println("Buckets:    " + bucketCount);
+            System.out.println("========================================");
+            
+            if (bucketCount == 48) {

Review Comment:
   FlussTableBucketChecker to default to 128 buckets (matching our table 
creation scripts) and accept an expected bucket count via CLI, instead of 
hardcoding 48.



-- 
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]

Reply via email to