Repository: incubator-systemml Updated Branches: refs/heads/master 1d45690c7 -> a75ae23a3
[SYSTEMML-561] Fix missing frame-scalar/scalar-frame casting ops, tests Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/a75ae23a Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/a75ae23a Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/a75ae23a Branch: refs/heads/master Commit: a75ae23a3c744aa64563c75abd9182b34dbaeb61 Parents: 1d45690 Author: Matthias Boehm <[email protected]> Authored: Sat Jul 2 18:36:54 2016 -0700 Committer: Matthias Boehm <[email protected]> Committed: Sat Jul 2 18:36:54 2016 -0700 ---------------------------------------------------------------------- .../java/org/apache/sysml/hops/UnaryOp.java | 3 +- .../sysml/parser/BuiltinFunctionExpression.java | 19 ++- .../instructions/cp/ScalarObjectFactory.java | 41 ++++++ .../instructions/cp/VariableCPInstruction.java | 46 +++--- .../sysml/runtime/matrix/data/FrameBlock.java | 2 + .../sysml/runtime/util/MapReduceTool.java | 74 ++++------ .../functions/frame/FrameScalarCastingTest.java | 145 +++++++++++++++++++ .../functions/frame/Frame2ScalarCast.dml | 26 ++++ .../functions/frame/Scalar2FrameCast.dml | 26 ++++ .../functions/frame/ZPackageSuite.java | 1 + 10 files changed, 311 insertions(+), 72 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/main/java/org/apache/sysml/hops/UnaryOp.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/hops/UnaryOp.java b/src/main/java/org/apache/sysml/hops/UnaryOp.java index f0c8482..8825a67 100644 --- a/src/main/java/org/apache/sysml/hops/UnaryOp.java +++ b/src/main/java/org/apache/sysml/hops/UnaryOp.java @@ -122,7 +122,8 @@ public class UnaryOp extends Hop implements MultiThreadedHop Hop input = getInput().get(0); if( getDataType() == DataType.SCALAR //value type casts or matrix to scalar - || (_op == OpOp1.CAST_AS_MATRIX && getInput().get(0).getDataType()==DataType.SCALAR) ) + || (_op == OpOp1.CAST_AS_MATRIX && getInput().get(0).getDataType()==DataType.SCALAR) + || (_op == OpOp1.CAST_AS_FRAME && getInput().get(0).getDataType()==DataType.SCALAR)) { if (_op == Hop.OpOp1.IQM) //special handling IQM { http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java index 32e529d..b292db6 100644 --- a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java +++ b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java @@ -451,7 +451,7 @@ public class BuiltinFunctionExpression extends DataIdentifier case CAST_AS_SCALAR: checkNumParameters(1); - checkMatrixParam(getFirstExpr()); + checkMatrixFrameParam(getFirstExpr()); if (( getFirstExpr().getOutput().getDim1() != -1 && getFirstExpr().getOutput().getDim1() !=1) || ( getFirstExpr().getOutput().getDim2() != -1 && getFirstExpr().getOutput().getDim2() !=1)) { raiseValidateError("dimension mismatch while casting matrix to scalar: dim1: " + getFirstExpr().getOutput().getDim1() + " dim2 " + getFirstExpr().getOutput().getDim2(), conditional, LanguageErrorCodes.INVALID_PARAMETERS); @@ -473,7 +473,7 @@ public class BuiltinFunctionExpression extends DataIdentifier break; case CAST_AS_FRAME: checkNumParameters(1); - checkMatrixParam(getFirstExpr()); + checkMatrixScalarParam(getFirstExpr()); output.setDataType(DataType.FRAME); output.setDimensions(id.getDim1(), id.getDim2()); if( getFirstExpr().getOutput().getDataType()==DataType.SCALAR ) @@ -1331,7 +1331,20 @@ public class BuiltinFunctionExpression extends DataIdentifier throws LanguageException { if (e.getOutput().getDataType() != DataType.MATRIX && e.getOutput().getDataType() != DataType.FRAME) { - raiseValidateError("Expecting matrix or frame parameter for function "+ this.getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS); + raiseValidateError("Expecting matrix or frame parameter for function "+ getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS); + } + } + + /** + * + * @param e + * @throws LanguageException + */ + protected void checkMatrixScalarParam(Expression e) //always unconditional + throws LanguageException + { + if (e.getOutput().getDataType() != DataType.MATRIX && e.getOutput().getDataType() != DataType.SCALAR) { + raiseValidateError("Expecting matrix or scalar parameter for function "+ getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS); } } http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java new file mode 100644 index 0000000..53b46a2 --- /dev/null +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ScalarObjectFactory.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.sysml.runtime.instructions.cp; + +import org.apache.sysml.parser.Expression.ValueType; + +public abstract class ScalarObjectFactory +{ + /** + * + * @param vt + * @param obj + * @return + */ + public static ScalarObject createScalarObject(ValueType vt, Object obj) { + switch( vt ) { + case BOOLEAN: return new BooleanObject((Boolean)obj); + case INT: return new IntObject((Long)obj); + case DOUBLE: return new DoubleObject((Double)obj); + case STRING: return new StringObject((String)obj); + default: throw new RuntimeException("Unsupported scalar object type: "+vt.toString()); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java index 5d01c85..1fae8fc 100644 --- a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java +++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java @@ -528,12 +528,23 @@ public class VariableCPInstruction extends CPInstruction break; case CastAsScalarVariable: //castAsScalarVariable - MatrixBlock mBlock = ec.getMatrixInput(input1.getName()); - if( mBlock.getNumRows()!=1 || mBlock.getNumColumns()!=1 ) - throw new DMLRuntimeException("Dimension mismatch - unable to cast matrix '"+input1.getName()+"' of dimension ("+mBlock.getNumRows()+" x "+mBlock.getNumColumns()+") to scalar."); - double value = mBlock.getValue(0,0); - ec.releaseMatrixInput(input1.getName()); - ec.setScalarOutput(output.getName(), new DoubleObject(value)); + if( input1.getDataType()==DataType.FRAME ) { + FrameBlock fBlock = ec.getFrameInput(input1.getName()); + if( fBlock.getNumRows()!=1 || fBlock.getNumColumns()!=1 ) + throw new DMLRuntimeException("Dimension mismatch - unable to cast frame '"+input1.getName()+"' of dimension ("+fBlock.getNumRows()+" x "+fBlock.getNumColumns()+") to scalar."); + Object value = fBlock.get(0,0); + ec.releaseFrameInput(input1.getName()); + ec.setScalarOutput(output.getName(), + ScalarObjectFactory.createScalarObject(fBlock.getSchema().get(0), value)); + } + else { //assume DataType.MATRIX otherwise + MatrixBlock mBlock = ec.getMatrixInput(input1.getName()); + if( mBlock.getNumRows()!=1 || mBlock.getNumColumns()!=1 ) + throw new DMLRuntimeException("Dimension mismatch - unable to cast matrix '"+input1.getName()+"' of dimension ("+mBlock.getNumRows()+" x "+mBlock.getNumColumns()+") to scalar."); + double value = mBlock.getValue(0,0); + ec.releaseMatrixInput(input1.getName()); + ec.setScalarOutput(output.getName(), new DoubleObject(value)); + } break; case CastAsMatrixVariable:{ MatrixBlock out = null; @@ -555,6 +566,7 @@ public class VariableCPInstruction extends CPInstruction if( input1.getDataType()==DataType.SCALAR ) { ScalarObject scalarInput = ec.getScalarInput(input1.getName(), input1.getValueType(), input1.isLiteral()); out = new FrameBlock(1, input1.getValueType()); + out.ensureAllocatedColumns(1); out.set(0, 0, scalarInput.getStringValue()); } else { //DataType.FRAME @@ -851,26 +863,10 @@ public class VariableCPInstruction extends CPInstruction private void writeScalarToHDFS(ExecutionContext ec, String fname) throws DMLRuntimeException { - ScalarObject scalar = ec.getScalarInput(input1.getName(), input1.getValueType(), input1.isLiteral()); try { - switch ( input1.getValueType() ) { - case DOUBLE: - MapReduceTool.writeDoubleToHDFS(scalar.getDoubleValue(), fname); - break; - case INT: - MapReduceTool.writeIntToHDFS(scalar.getLongValue(), fname); - break; - case BOOLEAN: - MapReduceTool.writeBooleanToHDFS(scalar.getBooleanValue(), fname); - break; - case STRING: - MapReduceTool.writeStringToHDFS(scalar.getStringValue(), fname); - break; - default: - throw new DMLRuntimeException("Invalid value type (" + input1.getValueType() + ") in writeScalar instruction: " + instString); - } - // write out .mtd file - MapReduceTool.writeScalarMetaDataFile(fname +".mtd", input1.getValueType()); + ScalarObject scalar = ec.getScalarInput(input1.getName(), input1.getValueType(), input1.isLiteral()); + MapReduceTool.writeObjectToHDFS(scalar.getValue(), fname); + MapReduceTool.writeScalarMetaDataFile(fname +".mtd", input1.getValueType()); } catch ( IOException e ) { throw new DMLRuntimeException(e); } http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/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 e5c5fec..d9d4b3b 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 @@ -1262,6 +1262,8 @@ public class FrameBlock implements Writable, CacheBlock, Externalizable } } + //TODO generalize these methods and remove from frame block + @Override public ArrayList getPairList() { return new ArrayList<Pair<Long, FrameBlock>>(); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java b/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java index 77d5bd6..c99b79b 100644 --- a/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java +++ b/src/main/java/org/apache/sysml/runtime/util/MapReduceTool.java @@ -298,37 +298,16 @@ public class MapReduceTool return br; } - public static double readDoubleFromHDFSFile(String filename) - throws IOException - { - BufferedReader br = setupInputFile(filename); - String line = br.readLine(); - br.close(); - if( line == null ) - throw new IOException("Empty file on hdfs: "+filename); - return Double.parseDouble(line); + public static double readDoubleFromHDFSFile(String filename) throws IOException { + return (Double)readObjectFromHDFSFile(filename, ValueType.DOUBLE); } - public static long readIntegerFromHDFSFile(String filename) - throws IOException - { - BufferedReader br = setupInputFile(filename); - String line = br.readLine(); - br.close(); - if( line == null ) - throw new IOException("Empty file on hdfs: "+filename); - return Long.parseLong(line); + public static long readIntegerFromHDFSFile(String filename) throws IOException { + return (Long)readObjectFromHDFSFile(filename, ValueType.INT); } - public static boolean readBooleanFromHDFSFile(String filename) - throws IOException - { - BufferedReader br = setupInputFile(filename); - String line = br.readLine(); - br.close(); - if( line == null ) - throw new IOException("Empty file on hdfs: "+filename); - return Boolean.parseBoolean(line); + public static boolean readBooleanFromHDFSFile(String filename) throws IOException { + return (Boolean)readObjectFromHDFSFile(filename, ValueType.BOOLEAN); } public static String readStringFromHDFSFile(String filename) @@ -347,6 +326,21 @@ public class MapReduceTool //return string without last character return sb.substring(0, sb.length()-1); } + + public static Object readObjectFromHDFSFile(String filename, ValueType vt) throws IOException { + BufferedReader br = setupInputFile(filename); + String line = br.readLine(); + br.close(); + if( line == null ) + throw new IOException("Empty file on hdfs: "+filename); + + switch( vt ) { + case BOOLEAN: return Boolean.parseBoolean(line); + case DOUBLE: return Double.parseDouble(line); + case INT: return Long.parseLong(line); + default: return line; + } + } private static BufferedWriter setupOutputFile ( String filename ) throws IOException { Path pt=new Path(filename); @@ -356,31 +350,25 @@ public class MapReduceTool } public static void writeDoubleToHDFS ( double d, String filename ) throws IOException { - BufferedWriter br = setupOutputFile(filename); - String line = "" + d; - br.write(line); - br.close(); + writeObjectToHDFS(d, filename); } public static void writeIntToHDFS ( long i, String filename ) throws IOException { - BufferedWriter br = setupOutputFile(filename); - String line = "" + i; - br.write(line); - br.close(); + writeObjectToHDFS(i, filename); } public static void writeBooleanToHDFS ( boolean b, String filename ) throws IOException { - BufferedWriter br = setupOutputFile(filename); - String line = "" + b; - br.write(line); - br.close(); + writeObjectToHDFS(b, filename); } public static void writeStringToHDFS ( String s, String filename ) throws IOException { - BufferedWriter br = setupOutputFile(filename); - String line = "" + s; - br.write(line); - br.close(); + writeObjectToHDFS(s, filename); + } + + public static void writeObjectToHDFS ( Object obj, String filename ) throws IOException { + BufferedWriter br = setupOutputFile(filename); + br.write(obj.toString()); + br.close(); } public static void writeDimsFile ( String filename, byte[] unknownFlags, long[] maxRows, long[] maxCols) throws IOException { http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/test/java/org/apache/sysml/test/integration/functions/frame/FrameScalarCastingTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/sysml/test/integration/functions/frame/FrameScalarCastingTest.java b/src/test/java/org/apache/sysml/test/integration/functions/frame/FrameScalarCastingTest.java new file mode 100644 index 0000000..b179a42 --- /dev/null +++ b/src/test/java/org/apache/sysml/test/integration/functions/frame/FrameScalarCastingTest.java @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.sysml.test.integration.functions.frame; + + +import java.util.Arrays; + +import org.apache.sysml.parser.Expression.ValueType; +import org.apache.sysml.runtime.io.FrameReaderFactory; +import org.apache.sysml.runtime.io.FrameWriterFactory; +import org.apache.sysml.runtime.matrix.data.FrameBlock; +import org.apache.sysml.runtime.matrix.data.InputInfo; +import org.apache.sysml.runtime.matrix.data.OutputInfo; +import org.apache.sysml.runtime.util.MapReduceTool; +import org.apache.sysml.runtime.util.UtilFunctions; +import org.apache.sysml.test.integration.AutomatedTestBase; +import org.apache.sysml.test.integration.TestConfiguration; +import org.apache.sysml.test.utils.TestUtils; +import org.junit.Assert; +import org.junit.Test; + +/** + * + */ +public class FrameScalarCastingTest extends AutomatedTestBase +{ + private final static String TEST_DIR = "functions/frame/"; + private final static String TEST_NAME1 = "Frame2ScalarCast"; + private final static String TEST_NAME2 = "Scalar2FrameCast"; + private final static String TEST_CLASS_DIR = TEST_DIR + FrameScalarCastingTest.class.getSimpleName() + "/"; + + @Override + public void setUp() { + TestUtils.clearAssertionInformation(); + addTestConfiguration(TEST_NAME1, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] {"B"})); + addTestConfiguration(TEST_NAME2, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] {"B"})); + } + + @Test + public void testFrame2ScalarString() { + runFrameCastingTest(TEST_NAME1, ValueType.STRING); + } + + @Test + public void testFrame2ScalarDouble() { + runFrameCastingTest(TEST_NAME1, ValueType.DOUBLE); + } + + @Test + public void testFrame2ScalarBoolean() { + runFrameCastingTest(TEST_NAME1, ValueType.BOOLEAN); + } + + @Test + public void testFrame2ScalarInt() { + runFrameCastingTest(TEST_NAME1, ValueType.INT); + } + + @Test + public void testScalar2FrameString() { + runFrameCastingTest(TEST_NAME2, ValueType.STRING); + } + + @Test + public void testScalar2FrameDouble() { + runFrameCastingTest(TEST_NAME2, ValueType.DOUBLE); + } + + @Test + public void testScalar2FrameBoolean() { + runFrameCastingTest(TEST_NAME2, ValueType.BOOLEAN); + } + + @Test + public void testScalar2FrameInt() { + runFrameCastingTest(TEST_NAME2, ValueType.INT); + } + + /** + * + * @param testname + * @param schema + * @param wildcard + */ + private void runFrameCastingTest( String testname, ValueType vt) + { + try + { + TestConfiguration config = getTestConfiguration(testname); + loadTestConfiguration(config); + + String HOME = SCRIPT_DIR + TEST_DIR; + fullDMLScriptName = HOME + testname + ".dml"; + programArgs = new String[]{"-explain","-args", input("A"), vt.toString(), output("B") }; + + //input data and compare + FrameBlock fb = new FrameBlock(1, vt); + Object inval = UtilFunctions.objectToObject(vt, 7); + fb.ensureAllocatedColumns(1); + fb.set(0, 0, inval); + + //write inputs + if( testname.equals(TEST_NAME1) ) + FrameWriterFactory.createFrameWriter(OutputInfo.TextCellOutputInfo) + .writeFrameToHDFS(fb, input("A"), 1, 1); + else + MapReduceTool.writeObjectToHDFS(inval, input("A")); + + //run testcase + runTest(true, false, null, -1); + + //read and compare scalars + Object retval = null; + if( testname.equals(TEST_NAME1) ) { + retval = MapReduceTool.readObjectFromHDFSFile(output("B"), vt); + } + else { + retval = FrameReaderFactory.createFrameReader(InputInfo.TextCellInputInfo) + .readFrameFromHDFS(output("B"), Arrays.asList(vt), 1, 1) + .get(0, 0); + } + Assert.assertEquals("Wrong output: "+retval+" (expected: "+inval+")", inval, retval); + } + catch(Exception ex) { + throw new RuntimeException(ex); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/test/scripts/functions/frame/Frame2ScalarCast.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/frame/Frame2ScalarCast.dml b/src/test/scripts/functions/frame/Frame2ScalarCast.dml new file mode 100644 index 0000000..9323232 --- /dev/null +++ b/src/test/scripts/functions/frame/Frame2ScalarCast.dml @@ -0,0 +1,26 @@ +#------------------------------------------------------------- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +#------------------------------------------------------------- + +A = read($1, data_type="frame", schema=$2, rows=1, cols=1); + +B = as.scalar(A); + +write(B, $3); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/test/scripts/functions/frame/Scalar2FrameCast.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/frame/Scalar2FrameCast.dml b/src/test/scripts/functions/frame/Scalar2FrameCast.dml new file mode 100644 index 0000000..e14a222 --- /dev/null +++ b/src/test/scripts/functions/frame/Scalar2FrameCast.dml @@ -0,0 +1,26 @@ +#------------------------------------------------------------- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +#------------------------------------------------------------- + +A = read($1, data_type="scalar", value_type=$2); + +B = as.frame(A); + +write(B, $3); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/a75ae23a/src/test_suites/java/org/apache/sysml/test/integration/functions/frame/ZPackageSuite.java ---------------------------------------------------------------------- diff --git a/src/test_suites/java/org/apache/sysml/test/integration/functions/frame/ZPackageSuite.java b/src/test_suites/java/org/apache/sysml/test/integration/functions/frame/ZPackageSuite.java index 819225c..b376777 100644 --- a/src/test_suites/java/org/apache/sysml/test/integration/functions/frame/ZPackageSuite.java +++ b/src/test_suites/java/org/apache/sysml/test/integration/functions/frame/ZPackageSuite.java @@ -34,6 +34,7 @@ import org.junit.runners.Suite; FrameIndexingTest.class, FrameMatrixCastingTest.class, FrameReadWriteTest.class, + FrameScalarCastingTest.class, FrameSchemaReadTest.class, FrameSerializationTest.class, })
