drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinfengni <...@git.apache.org>
Subject [GitHub] drill pull request #805: Drill-4139: Exception while trying to prune partiti...
Date Fri, 19 May 2017 22:14:57 GMT
Github user jinfengni commented on a diff in the pull request:

    https://github.com/apache/drill/pull/805#discussion_r117578486
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java
---
    @@ -548,23 +567,57 @@ public void populatePruningVector(ValueVector v, int index, SchemaPath
column, S
             NullableVarCharVector varCharVector = (NullableVarCharVector) v;
             Object s = partitionValueMap.get(f).get(column);
             byte[] bytes;
    -        if (s instanceof String) { // if the metadata was read from a JSON cache file
it maybe a string type
    -          bytes = ((String) s).getBytes();
    -        } else if (s instanceof Binary) {
    -          bytes = ((Binary) s).getBytes();
    -        } else if (s instanceof byte[]) {
    -          bytes = (byte[]) s;
    +        if (s == null) {
    +          varCharVector.getMutator().setNull(index);
    +          return;
             } else {
    -          throw new UnsupportedOperationException("Unable to create column data for type:
" + type);
    +          bytes = getBytes(type, s);
             }
             varCharVector.getMutator().setSafe(index, bytes, 0, bytes.length);
             return;
           }
    +      case INTERVAL: {
    +        NullableIntervalVector intervalVector = (NullableIntervalVector) v;
    +        Object s = partitionValueMap.get(f).get(column);
    +        byte[] bytes;
    +        if (s == null) {
    +          intervalVector.getMutator().setNull(index);
    +          return;
    +        } else {
    +          bytes = getBytes(type, s);
    +        }
    +        intervalVector.getMutator().setSafe(index, 1,
    +          ParquetReaderUtility.getIntFromLEBytes(bytes, 0),
    +          ParquetReaderUtility.getIntFromLEBytes(bytes, 4),
    +          ParquetReaderUtility.getIntFromLEBytes(bytes, 8));
    +        return;
    +      }
           default:
             throw new UnsupportedOperationException("Unsupported type: " + type);
         }
       }
     
    +  /**
    +   * Returns the sequence of bytes received from {@code Object source}.
    +   *
    +   * @param type   the column type
    +   * @param source the source of the bytes sequence
    +   * @return bytes sequence obtained from {@code Object source}
    +   */
    +  private byte[] getBytes(MinorType type, Object source) {
    +    byte[] bytes;
    +    if (source instanceof String) { // if the metadata was read from a JSON cache file
it maybe a string type
    +      bytes = Base64.decodeBase64(((String) source).getBytes());
    --- End diff --
    
    Any reason you call Base4.decodeBase64, in stead of calling String.getBytes()? 


---
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