HIVE-15929. Fix HiveDecimalWritable compatibility. Fixes #149
Signed-off-by: Owen O'Malley <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/39c9ba93 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/39c9ba93 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/39c9ba93 Branch: refs/heads/storage-branch-2.2 Commit: 39c9ba93a3d5c14c316f20130035ec974931db2a Parents: b7e12fa Author: Owen O'Malley <[email protected]> Authored: Tue Feb 14 17:25:46 2017 -0800 Committer: Owen O'Malley <[email protected]> Committed: Thu Feb 16 10:29:51 2017 -0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/39c9ba93/storage-api/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java ---------------------------------------------------------------------- diff --git a/storage-api/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java b/storage-api/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java index 94d61b4..ffbe31a 100644 --- a/storage-api/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java +++ b/storage-api/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java @@ -947,10 +947,13 @@ public final class HiveDecimalWritable extends FastHiveDecimal return fastHashCode(); } + private static final byte[] EMPTY_ARRAY = new byte[0]; + @HiveDecimalWritableVersionV1 public byte[] getInternalStorage() { if (!isSet()) { - throw new RuntimeException("no value set"); + // don't break old callers that are trying to reuse storages + return EMPTY_ARRAY; } if (internalScratchLongs == null) {
