drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sohami <...@git.apache.org>
Subject [GitHub] drill pull request #851: DRILL-5518: Test framework enhancements
Date Thu, 22 Jun 2017 00:30:17 GMT
Github user sohami commented on a diff in the pull request:

    https://github.com/apache/drill/pull/851#discussion_r123397036
  
    --- Diff: exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/impl/TupleReaderImpl.java
---
    @@ -101,8 +88,61 @@ public String getAsString(int colIndex) {
           return "\"" + colReader.getString() + "\"";
         case DECIMAL:
           return colReader.getDecimal().toPlainString();
    +    case ARRAY:
    +      return getArrayAsString(colReader.array());
         default:
           throw new IllegalArgumentException("Unsupported type " + colReader.valueType());
         }
       }
    +
    +  private String bytesToString(byte[] value) {
    +    StringBuilder buf = new StringBuilder()
    +        .append("[");
    +    int len = Math.min(value.length, 20);
    +    for (int i = 0; i < len;  i++) {
    +      if (i > 0) {
    +        buf.append(", ");
    +      }
    +      buf.append((int) value[i]);
    +    }
    +    if (value.length > len) {
    +      buf.append("...");
    +    }
    +    buf.append("]");
    +    return buf.toString();
    +  }
    +
    +  private String getArrayAsString(ArrayReader array) {
    +    StringBuilder buf = new StringBuilder();
    +    buf.append("[");
    +    for (int i = 0; i < array.size(); i++) {
    +      if (i > 0) {
    +        buf.append( ", " );
    +      }
    +      switch (array.valueType()) {
    --- End diff --
    
    For `getObject()` implementation it's throwing specifically `UnsupportedOperationException`
for Map and Array type whereas for default type it throws `IllegalArgumentException`. I thought
the idea was Map and Array are valid ArgumentType but not supported for now, hence the comment.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message