【发布时间】:2015-08-17 04:38:24
【问题描述】:
我有一个存储在 parquet 文件中的二进制节俭字段。 Parquet 将其写为二进制 (UTF8),我想使用 Hive UDF 将其转换为 Base64 字符串。应该很基础但是不知道为什么我的代码不起作用,这是我尝试过的,
public class Base64Encode extends UDF {
public Text evaluate(Text bin) {
if (bin != null) {
String encoded = new String(Base64.getEncoder().encode(bin.getBytes()));
if (encoded != null) {
return new Text(encoded);
}
}
return null;
}
}
【问题讨论】:
标签: java utf-8 hive base64 parquet