Repository: incubator-systemml
Updated Branches:
  refs/heads/master 9d1816131 -> e1cad8a8b


[SYSTEMML-1337] Fix frame left indexing w/ heterogeneous column schemas

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

Branch: refs/heads/master
Commit: e1cad8a8b76d2600f6771928df2af25aadfcbcf9
Parents: 9d18161
Author: Matthias Boehm <[email protected]>
Authored: Sun Feb 19 23:40:53 2017 -0800
Committer: Matthias Boehm <[email protected]>
Committed: Sun Feb 19 23:40:53 2017 -0800

----------------------------------------------------------------------
 .../apache/sysml/runtime/matrix/data/FrameBlock.java   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/e1cad8a8/src/main/java/org/apache/sysml/runtime/matrix/data/FrameBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/data/FrameBlock.java 
b/src/main/java/org/apache/sysml/runtime/matrix/data/FrameBlock.java
index 3420e32..99a6f3f 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/data/FrameBlock.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/data/FrameBlock.java
@@ -756,8 +756,17 @@ public class FrameBlock implements Writable, CacheBlock, 
Externalizable
                //copy data to output and partial overwrite w/ rhs
                for( int j=0; j<getNumColumns(); j++ ) {
                        Array tmp = _coldata[j].clone();
-                       if( j>=cl && j<=cu )
-                               tmp.set(rl, ru, rhsFrame._coldata[j-cl]);
+                       if( j>=cl && j<=cu ) {
+                               //fast-path for homogeneous column schemas
+                               if( _schema[j]==rhsFrame._schema[j-cl] )
+                                       tmp.set(rl, ru, 
rhsFrame._coldata[j-cl]);
+                               //general-path for heterogeneous column schemas
+                               else {
+                                       for( int i=rl; i<=ru; i++ )
+                                               tmp.set(i, 
UtilFunctions.objectToObject(
+                                                       _schema[j], 
rhsFrame._coldata[j-cl].get(i-rl)));
+                               }
+                       }
                        ret._coldata[j] = tmp;
                }
                

Reply via email to