smarthi commented on a change in pull request #1341: Add exportToTable option
to CLI
URL: https://github.com/apache/incubator-hudi/pull/1341#discussion_r380990440
##########
File path: hudi-cli/src/main/java/org/apache/hudi/cli/HoodiePrintHelper.java
##########
@@ -57,11 +60,38 @@ public static String print(String[] header, String[][]
rows) {
*/
public static String print(TableHeader rowHeader, Map<String,
Function<Object, String>> fieldNameToConverterMap,
String sortByField, boolean isDescending, Integer limit, boolean
headerOnly, List<Comparable[]> rows) {
+ return print(rowHeader, fieldNameToConverterMap, sortByField,
isDescending, limit, headerOnly, rows, "");
+ }
+
+ /**
+ * Serialize Table to printable string and also export a temporary view to
easily write sql queries.
+ *
+ * Ideally, exporting view needs to be outside PrintHelper, but all commands
use this. So this is easy
+ * way to add support for all commands
+ *
+ * @param rowHeader Row Header
+ * @param fieldNameToConverterMap Field Specific Converters
+ * @param sortByField Sorting field
+ * @param isDescending Order
+ * @param limit Limit
+ * @param headerOnly Headers only
+ * @param rows List of rows
+ * @param tempTableName table name to export
+ * @return Serialized form for printing
+ */
+ public static String print(TableHeader rowHeader, Map<String,
Function<Object, String>> fieldNameToConverterMap,
+ String sortByField, boolean isDescending, Integer limit, boolean
headerOnly, List<Comparable[]> rows,
+ String tempTableName) {
if (headerOnly) {
return HoodiePrintHelper.print(rowHeader);
}
+ if (!Strings.isNullOrEmpty(tempTableName)) {
Review comment:
Replace this with StringUtils.isNullOrEmpty() pending PR# 1159
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services