tobiasrieger commented on a change in pull request #1075:
URL: https://github.com/apache/systemds/pull/1075#discussion_r499148208



##########
File path: 
src/main/java/org/apache/sysds/runtime/instructions/cp/ListObject.java
##########
@@ -280,4 +301,124 @@ public String toString() {
                sb.append(")");
                return sb.toString();
        }
+
+       /**
+        * Redirects the default java serialization via externalizable to our 
default
+        * hadoop writable serialization for efficient broadcast/rdd 
serialization.
+        *
+        * @param out object output
+        * @throws IOException if IOException occurs
+        */
+       @Override
+       public void writeExternal(ObjectOutput out) throws IOException {
+               // write out length
+               out.writeInt(getLength());
+               // write out num cacheable
+               out.writeInt(_nCacheable);
+
+               // write out names for named list
+               out.writeBoolean(getNames() != null);
+               if(getNames() != null) {
+                       for (int i = 0; i < getLength(); i++) {
+                               out.writeObject(_names.get(i));
+                       }
+               }
+
+               // write out data
+               for(int i = 0; i < getLength(); i++) {
+                       Data d = getData(i);
+                       out.writeObject(d.getDataType());
+                       out.writeObject(d.getValueType());
+                       switch(d.getDataType()) {
+                               case LIST:
+                                       ListObject lo = (ListObject) d;
+                                       out.writeObject(lo);
+                                       break;
+                               case MATRIX:
+                                       MatrixObject mo = (MatrixObject) d;
+                                       MetaDataFormat md = (MetaDataFormat) 
mo.getMetaData();
+                                       DataCharacteristics dc = 
md.getDataCharacteristics();
+
+                                       out.writeObject(dc.getRows());
+                                       out.writeObject(dc.getCols());
+                                       out.writeObject(dc.getBlocksize());
+                                       out.writeObject(dc.getNonZeros());
+                                       out.writeObject(md.getFileFormat());
+                                       
out.writeObject(mo.acquireReadAndRelease());
+                                       break;
+                               case SCALAR:
+                                       ScalarObject so = (ScalarObject) d;
+                                       out.writeObject(so.getStringValue());

Review comment:
       Thanks for the input! Added 👍🏻




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to