drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #819: DRILL-5419: Calculate return string length for lite...
Date Thu, 27 Apr 2017 16:17:40 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/819#discussion_r113606842
  
    --- Diff: contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveUtilities.java
---
    @@ -294,10 +296,21 @@ public static MajorType getMajorTypeFromHiveTypeInfo(final TypeInfo
typeInfo, fi
             MajorType.Builder typeBuilder = MajorType.newBuilder().setMinorType(minorType)
                 .setMode(DataMode.OPTIONAL); // Hive columns (both regular and partition)
could have null values
     
    -        if (primitiveTypeInfo.getPrimitiveCategory() == PrimitiveCategory.DECIMAL) {
    -          DecimalTypeInfo decimalTypeInfo = (DecimalTypeInfo) primitiveTypeInfo;
    -          typeBuilder.setPrecision(decimalTypeInfo.precision())
    -              .setScale(decimalTypeInfo.scale()).build();
    +        switch (primitiveTypeInfo.getPrimitiveCategory()) {
    +          case CHAR:
    +          case VARCHAR:
    +            BaseCharTypeInfo baseCharTypeInfo = (BaseCharTypeInfo) primitiveTypeInfo;
    +            typeBuilder.setPrecision(baseCharTypeInfo.getLength());
    +            break;
    +          case STRING:
    +            typeBuilder.setPrecision(HiveVarchar.MAX_VARCHAR_LENGTH);
    +            break;
    +          case DECIMAL:
    +            DecimalTypeInfo decimalTypeInfo = (DecimalTypeInfo) primitiveTypeInfo;
    +            typeBuilder.setPrecision(decimalTypeInfo.getPrecision()).setScale(decimalTypeInfo.getScale());
    --- End diff --
    
    We are now considering decimal precision and scale. The precision determines which Decimal
minor type must be used. Shouldn't the Hive-to-Drill type conversion consider the precision
and scale earlier?


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