我的底层数据是使用 HIVE 输出格式(org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat)写入的)
尝试使用本机 Java Map Reduce 读取此数据
byte[] b = value.getBinary(value.getType().getFieldIndex(field), 0).getBytes();
HiveDecimal hd = HiveDecimal.create(b, true);
这里的值是org.apache.parquet.example.data.Group
在这种情况下,HD类型变为NULL。
但是下面适用于字符串/整数类型。
value.getValueToString(value.getType().getFieldIndex(field), 0);
没关系,我找到了一种方法,使用 DecimalUtils 来自Parquet Decimal Type 到 Java BigDecimal 在 Pig 中的转换。
添加链接用于DecimalUtils的Github链接