[CARBONDATA-1509] Fixed bug for maintaining compatibility of decimal type with 
older releases of Carbondata

In old Carbondata releases, precision and scale is not stored for decimal data 
type and both values are initialized to -1. In TableSpec.ColumnSpec default 
values for precision and scale are initialized to 0 because of which exception 
is thrown while reading the old store with decimal column. Both precision and 
scale should be initialized to -1.

This closes #1378


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/7f6b08a2
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/7f6b08a2
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/7f6b08a2

Branch: refs/heads/branch-1.2
Commit: 7f6b08a2b5b13799a2a0bbd29d40f45da14d07b1
Parents: 80fa37c
Author: manishgupta88 <[email protected]>
Authored: Fri Sep 22 12:22:39 2017 +0530
Committer: Ravindra Pesala <[email protected]>
Committed: Fri Sep 22 16:28:05 2017 +0530

----------------------------------------------------------------------
 .../java/org/apache/carbondata/core/datastore/TableSpec.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/7f6b08a2/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java 
b/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java
index 2fdf82b..b0b62db 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java
@@ -130,7 +130,9 @@ public class TableSpec {
     }
 
     public ColumnSpec(String fieldName, DataType schemaDataType, ColumnType 
columnType) {
-      this(fieldName, schemaDataType, columnType, 0, 0);
+      // for backward compatibility as the precision and scale is not stored, 
the values should be
+      // initialized with -1 for both precision and scale
+      this(fieldName, schemaDataType, columnType, -1, -1);
     }
 
     public ColumnSpec(String fieldName, DataType schemaDataType, ColumnType 
columnType,

Reply via email to