This is an automated email from the ASF dual-hosted git repository. arina pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/drill.git
commit 9844b61c520b27f878e7d6fc657177da05d55dad Author: Jean-Claude <jcc...@gmail.com> AuthorDate: Thu Feb 21 16:55:15 2019 -0500 DRILL-7049 return VARBINARY as a string with escaped non printable bytes --- .../exec/util/ValueVectorElementFormatter.java | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/ValueVectorElementFormatter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/ValueVectorElementFormatter.java index bbb13a7..01921df 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/ValueVectorElementFormatter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/ValueVectorElementFormatter.java @@ -52,28 +52,47 @@ public class ValueVectorElementFormatter { * @return the formatted value, null if failed */ public String format(Object value, TypeProtos.MinorType minorType) { + boolean handled = false; + String str = null; switch (minorType) { case TIMESTAMP: if (value instanceof LocalDateTime) { - return format((LocalDateTime) value, + handled = true; + 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, + handled = true; + 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, + handled = true; + 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[]) { + handled = true; + byte[] bytes = (byte[]) value; + str = org.apache.drill.common.util.DrillStringUtils.toBinaryString(bytes); + } + break; + } + + if (!handled) { + str = value.toString(); } + + return str; } /**