This is an automated email from the ASF dual-hosted git repository.

yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 7ae4e22de [#4202] feat(trino-connector): Add addition parameters in 
TrinoQueryTestTool (#4203)
7ae4e22de is described below

commit 7ae4e22de808d113296bead0dd64de734bc42706
Author: Yuhui <[email protected]>
AuthorDate: Tue Jul 23 20:54:31 2024 +0800

    [#4202] feat(trino-connector): Add addition parameters in 
TrinoQueryTestTool (#4203)
    
    ### What changes were proposed in this pull request?
    
    Add addition parameters in TrinoQueryTestTool
    You need to passing the arguments like :
    --params=key1,value1;key2,value2... on run the TrinoQueryTestTool
    ### Why are the changes needed?
    
    Fix: #4202
    
    ### Does this PR introduce _any_ user-facing change?
    
    Update the command output and error information of TrinoQueryTestTool
    
    ### How was this patch tested?
    
    Manually Test
---
 .../integration/test/trino/TrinoQueryIT.java       | 12 +++++------
 .../integration/test/trino/TrinoQueryTestTool.java | 24 +++++++++++++++++++++-
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryIT.java
 
b/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryIT.java
index 141916457..b7575f94f 100644
--- 
a/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryIT.java
+++ 
b/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryIT.java
@@ -54,19 +54,19 @@ import org.slf4j.LoggerFactory;
 public class TrinoQueryIT extends TrinoQueryITBase {
   private static final Logger LOG = 
LoggerFactory.getLogger(TrinoQueryIT.class);
 
-  protected static String testsetsDir = "";
-  protected AtomicInteger passCount = new AtomicInteger(0);
-  protected AtomicInteger totalCount = new AtomicInteger(0);
-  protected static boolean exitOnFailed = true;
+  static String testsetsDir = "";
+  AtomicInteger passCount = new AtomicInteger(0);
+  AtomicInteger totalCount = new AtomicInteger(0);
+  static boolean exitOnFailed = true;
 
   // key: tester name, value: tester result
   private static Map<String, TestStatus> allTestStatus = new TreeMap<>();
 
   private static int testParallelism = 2;
 
-  private static Map<String, String> queryParams = new HashMap<>();
+  static Map<String, String> queryParams = new HashMap<>();
 
-  public static Set<String> ciTestsets = new HashSet<>();
+  static Set<String> ciTestsets = new HashSet<>();
 
   static {
     testsetsDir = 
TrinoQueryIT.class.getClassLoader().getResource("trino-ci-testset").getPath();
diff --git 
a/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryTestTool.java
 
b/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryTestTool.java
index 0bda5f28c..236e994b0 100644
--- 
a/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryTestTool.java
+++ 
b/integration-test/src/test/java/org/apache/gravitino/integration/test/trino/TrinoQueryTestTool.java
@@ -73,6 +73,12 @@ public class TrinoQueryTestTool {
       options.addOption("tester_id", true, "Specify the tester file name 
prefix to select to test");
       options.addOption("catalog", true, "Specify the catalog name to test");
 
+      options.addOption(
+          "params",
+          true,
+          "Additional parameters that can replace the value of ${key} in the 
testers contents, "
+              + "example: --params=key1,v1;key2,v2");
+
       options.addOption("help", false, "Print this help message");
 
       CommandLineParser parser = new PosixParser();
@@ -113,7 +119,7 @@ public class TrinoQueryTestTool {
             break;
           default:
             System.out.println("The value of --auto must be 'all', 'gravitino' 
or 'none'");
-            return;
+            System.exit(1);
         }
       }
 
@@ -139,6 +145,22 @@ public class TrinoQueryTestTool {
       TrinoQueryIT.postgresqlUri =
           Strings.isBlank(postgresqlUri) ? TrinoQueryIT.postgresqlUri : 
postgresqlUri;
 
+      String params = commandLine.getOptionValue("params");
+      if (Strings.isNotBlank(params)) {
+        for (String param : params.split(";")) {
+          String[] split = param.split(",");
+          String key = split[0].trim();
+          String value = split[1].trim();
+          if (Strings.isNotBlank(key) && Strings.isNotBlank(value)) {
+            TrinoQueryIT.queryParams.put(key, value);
+          } else {
+            System.out.println(
+                "Invalid parameters:" + param + "The format should like 
--params=key1,v1;key2,v2");
+            System.exit(1);
+          }
+        }
+      }
+
       String testSet = commandLine.getOptionValue("test_set");
       String testerId = commandLine.getOptionValue("tester_id", "");
       String catalog = commandLine.getOptionValue("catalog", "");

Reply via email to