Repository: systemml
Updated Branches:
  refs/heads/master 8ffa3d158 -> afbe7bf2f


[SYSTEMML-2162] Fix deserialization of compressed blocks w/ shared dict

Compressed matrix blocks might be encoded with heterogeneous encoding
formats per column group. For blocks with multiple DDC1 groups and
common value domains, SYSTEMML-1919 introduced the concept of shared
dictionaries which significantly reduced the total compressed size
especially with small block sizes. 

This patch fixes an issue of deserializing compressed blocks with such
shared DDC1 dictionaries in the presence of groups with other encoding
formats which causes crashes if these other groups were read after the
first DDC1 group with shared dictionary was read.


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

Branch: refs/heads/master
Commit: afbe7bf2fbb7d6ca863e2482aaaf981864a80b46
Parents: 8ffa3d1
Author: Matthias Boehm <[email protected]>
Authored: Tue Feb 27 19:38:47 2018 -0800
Committer: Matthias Boehm <[email protected]>
Committed: Tue Feb 27 19:48:38 2018 -0800

----------------------------------------------------------------------
 .../sysml/runtime/compress/CompressedMatrixBlock.java       | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/afbe7bf2/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java 
b/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java
index de99391..29c95e4 100644
--- a/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java
+++ b/src/main/java/org/apache/sysml/runtime/compress/CompressedMatrixBlock.java
@@ -844,11 +844,12 @@ public class CompressedMatrixBlock extends MatrixBlock 
implements Externalizable
                        grp.readFields(in);
                        
                        //use shared DDC1 dictionary if applicable
-                       if( _sharedDDC1Dict && grp.getNumCols()==1 ) {
+                       if( _sharedDDC1Dict && grp.getNumCols()==1
+                               && grp instanceof ColGroupDDC1 ) {
                                if( sharedDict == null )
-                                       sharedDict = 
((ColGroupDDC1)grp).getValues();
+                                       sharedDict = 
((ColGroupValue)grp).getValues();
                                else
-                                       
((ColGroupDDC1)grp).setValues(sharedDict);
+                                       
((ColGroupValue)grp).setValues(sharedDict);
                        }
                        
                        _colGroups.add(grp);
@@ -906,7 +907,7 @@ public class CompressedMatrixBlock extends MatrixBlock 
implements Externalizable
        public void writeExternal(ObjectOutput os) 
                throws IOException
        {
-               write(os);      
+               write(os);
        }
        
        public Iterator<IJV> getIterator(int rl, int ru, boolean inclZeros) {

Reply via email to