sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szvasas <...@git.apache.org>
Subject [GitHub] sqoop pull request #60: SQOOP-3396: Add parquet numeric support for Parquet ...
Date Mon, 03 Dec 2018 16:25:13 GMT
Github user szvasas commented on a diff in the pull request:

    https://github.com/apache/sqoop/pull/60#discussion_r237907910
  
    --- Diff: src/java/org/apache/sqoop/hive/HiveTypes.java ---
    @@ -79,8 +85,42 @@ public static String toHiveType(int sqlType) {
               default:
             // TODO(aaron): Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT,
             // BLOB, ARRAY, STRUCT, REF, JAVA_OBJECT.
    -        return null;
    +            return null;
    +      }
    +  }
    +
    +  private static String mapDecimalsToHiveType(int sqlType, SqoopOptions options) {
    +    if (options.getConf().getBoolean(ConfigurationConstants.PROP_ENABLE_PARQUET_LOGICAL_TYPE_DECIMAL,
false)
    +        && (sqlType == Types.NUMERIC || sqlType == Types.DECIMAL)){
    +      return HIVE_TYPE_DECIMAL;
    +    }
    +    return HIVE_TYPE_DOUBLE;
    +  }
    +
    +
    +  public static String toHiveType(Schema schema) {
    +    if (schema.getType() == Schema.Type.UNION) {
    +      for (Schema subSchema : schema.getTypes()) {
    +        if (subSchema.getLogicalType() != null && subSchema.getLogicalType()
instanceof Decimal) {
    --- End diff --
    
    Redundant null check: if subSchema.getLogicalType() is null then subSchema.getLogicalType()
instanceof Decimal will be false


---

Mime
View raw message