Github user arina-ielchiieva commented on a diff in the pull request: https://github.com/apache/drill/pull/819#discussion_r114592925 --- 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 -- In this method we are getting minor type from `HiveUtilities.getMinorTypeFromHivePrimitiveTypeInfo` [1] which in its turn takes into account decimal precision when choosing appropriate minor type [2]. [1] https://github.com/apache/drill/blob/master/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveUtilities.java#L293 [2] https://github.com/apache/drill/blob/master/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveUtilities.java#L332
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---