drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [drill] vdiravka commented on a change in pull request #1672: DRILL-7049 return VARBINARY as a string with escaped non printable bytes
Date Tue, 12 Mar 2019 12:29:29 GMT
vdiravka commented on a change in pull request #1672: DRILL-7049 return VARBINARY as a string
with escaped non printable bytes
URL: https://github.com/apache/drill/pull/1672#discussion_r264637111
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/util/ValueVectorElementFormatter.java
 ##########
 @@ -52,28 +52,42 @@ public ValueVectorElementFormatter(OptionManager options) {
    * @return the formatted value, null if failed
    */
   public String format(Object value, TypeProtos.MinorType minorType) {
+    String str = null;
     switch (minorType) {
       case TIMESTAMP:
         if (value instanceof LocalDateTime) {
-          return format((LocalDateTime) value,
+          str = format((LocalDateTime) value,
                         options.getString(ExecConstants.WEB_DISPLAY_FORMAT_TIMESTAMP),
                         (v, p) -> v.format(getTimestampFormatter(p)));
         }
+        break;
       case DATE:
         if (value instanceof LocalDate) {
-          return format((LocalDate) value,
+          str = format((LocalDate) value,
                         options.getString(ExecConstants.WEB_DISPLAY_FORMAT_DATE),
                         (v, p) -> v.format(getDateFormatter(p)));
         }
+        break;
       case TIME:
         if (value instanceof LocalTime) {
-          return format((LocalTime) value,
+          str = format((LocalTime) value,
                         options.getString(ExecConstants.WEB_DISPLAY_FORMAT_TIME),
                         (v, p) -> v.format(getTimeFormatter(p)));
         }
-      default:
-        return value.toString();
+        break;
+      case VARBINARY:
+        if (value instanceof byte[]) {
+          byte[] bytes = (byte[]) value;
+          str = org.apache.drill.common.util.DrillStringUtils.toBinaryString(bytes);
+        }
+        break;
+    }
+
+    if(str == null) {
 
 Review comment:
   ```suggestion
       if (str == null) {
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message