You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2019/01/29 02:52:05 UTC

[GitHub] qiuchenjian commented on a change in pull request #3111: [HOTFIX] SDV framework for presto cluster test suite

qiuchenjian commented on a change in pull request #3111: [HOTFIX] SDV framework for presto cluster test suite
URL: https://github.com/apache/carbondata/pull/3111#discussion_r251675324
 
 

 ##########
 File path: integration/spark-common-cluster-test/src/test/scala/org/apache/spark/sql/common/util/QueryTest.scala
 ##########
 @@ -220,4 +218,74 @@ object QueryTest {
 
     return None
   }
+
+  /**
+   * execute the query by establishing the jdbc connection
+   *
+   * @param query
+   * @return
+   */
+  def executeQuery(dbName: String, query: String): List[Map[String, Any]] = {
+    Try {
+      val conn: Connection = if (System.getProperty("presto.jdbc.url") != null) {
+        createJdbcConnection(dbName, System.getProperty("presto.jdbc.url"))
+      } else {
+        createJdbcConnection(dbName, "localhost:8086")
+      }
+      val statement = conn.createStatement()
+      val result: ResultSet = statement.executeQuery(query)
+      convertResultSetToList(result)
 
 Review comment:
   better to close the result and statement

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services