InvisibleProgrammer commented on code in PR #5085:
URL: https://github.com/apache/hive/pull/5085#discussion_r1499112278


##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/utils/TestTxnDbUtil.java:
##########
@@ -338,10 +338,24 @@ public static int countQueryAgent(Configuration conf, 
String countQuery) throws
       closeResources(conn, stmt, rs);
     }
   }
+
   public static String queryToString(Configuration conf, String query) throws 
Exception {
     return queryToString(conf, query, true);
   }
-  public static String queryToString(Configuration conf, String query, boolean 
includeHeader)
+
+  public static String queryToString(Configuration conf, String query, boolean 
includeHeader) throws Exception {
+    return queryToString(conf, query, includeHeader, "   ");
+  }
+
+  public static String queryToCsv(Configuration conf, String query) throws 
Exception {

Review Comment:
   > what are the callers of this new queryToCsv method? I cannot see it used
   
   As the summary says, the intention is to improve debugging experience. 
   With the current queryToString method, if I want to analyze the output, my 
only choice if I want a header or not. But it separates the columns with 4 
spaces. That is far from any usual. 
   So in case I want to use it in a spreadsheet app, I need to manually convert 
4 spaces to a separator character. After that, I can import it into a 
spreadsheet.
   With that method, we can do it in one step. 
   
   > also, basically, I like that you introduced new convenience util methods, 
however, I cannot see their value added to the original queryToString this 
time: what if I would like to create a CSV with ";" separator? currently, I 
should call queryToString with columnSeparator=";" despite the new util methods
   so I believe that queryToCsv doesn't add more value, it just expresses an 
assumption that CSV is always written with comma separators (I know, CSV means 
comma separated, but still, I can see semicolon-separated stuff in many places)
   
   In case you want to use a non-standard characther, like `;`, you can use the 
modified method that accepts the separator character. I choosed `,` as that is 
the original idea of CSV: to separate with colons. 
   
   



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to