Package org.apache.sysds.api.mlcontext
Class Frame
java.lang.Object
org.apache.sysds.api.mlcontext.Frame
Frame encapsulates a SystemDS frame.
-
Constructor Summary
ConstructorsConstructorDescriptionFrame(org.apache.spark.api.java.JavaPairRDD<Long, FrameBlock> binaryBlocks, FrameMetadata frameMetadata) Create a Frame, specifying the SystemDS binary-block frame and its metadata.Frame(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame) Convert a Spark DataFrame to a SystemDS binary-block representation.Frame(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame, long numRows, long numCols) Convert a Spark DataFrame to a SystemDS binary-block representation, specifying the number of rows and columns.Frame(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame, FrameMetadata frameMetadata) Convert a Spark DataFrame to a SystemDS binary-block representation.Frame(FrameObject frameObject, SparkExecutionContext sparkExecutionContext) -
Method Summary
Modifier and TypeMethodDescriptionObtain the frame metadatabooleanWhether or not this frame contains data as binary blocksbooleanWhether or not this frame contains data as a FrameObjectString[][]Obtain the frame as a two-dimensional String arrayorg.apache.spark.api.java.JavaPairRDD<Long,FrameBlock> Obtain the frame as aJavaPairRDD<Long, FrameBlock>org.apache.spark.sql.Dataset<org.apache.spark.sql.Row>toDF()Obtain the frame as aDataFrameObtain the frame as a SystemDS FrameObject.org.apache.spark.api.java.JavaRDD<String>Obtain the frame as aJavaRDD<String>in CSV formatorg.apache.spark.api.java.JavaRDD<String>Obtain the frame as aJavaRDD<String>in IJV formatorg.apache.spark.rdd.RDD<String>Obtain the frame as aRDD<String>in CSV formatorg.apache.spark.rdd.RDD<String>Obtain the frame as aRDD<String>in IJV formattoString()
-
Constructor Details
-
Frame
-
Frame
public Frame(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame, FrameMetadata frameMetadata) Convert a Spark DataFrame to a SystemDS binary-block representation.- Parameters:
dataFrame- the Spark DataFrameframeMetadata- frame metadata, such as number of rows and columns
-
Frame
public Frame(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame, long numRows, long numCols) Convert a Spark DataFrame to a SystemDS binary-block representation, specifying the number of rows and columns.- Parameters:
dataFrame- the Spark DataFramenumRows- the number of rowsnumCols- the number of columns
-
Frame
public Frame(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame) Convert a Spark DataFrame to a SystemDS binary-block representation.- Parameters:
dataFrame- the Spark DataFrame
-
Frame
public Frame(org.apache.spark.api.java.JavaPairRDD<Long, FrameBlock> binaryBlocks, FrameMetadata frameMetadata) Create a Frame, specifying the SystemDS binary-block frame and its metadata.- Parameters:
binaryBlocks- theJavaPairRDD<Long, FrameBlock>frameframeMetadata- frame metadata, such as number of rows and columnss
-
-
Method Details
-
toFrameObject
Obtain the frame as a SystemDS FrameObject.- Returns:
- the frame as a SystemDS FrameObject
-
to2DStringArray
Obtain the frame as a two-dimensional String array- Returns:
- the frame as a two-dimensional String array
-
toJavaRDDStringIJV
Obtain the frame as aJavaRDD<String>in IJV format- Returns:
- the frame as a
JavaRDD<String>in IJV format
-
toJavaRDDStringCSV
Obtain the frame as aJavaRDD<String>in CSV format- Returns:
- the frame as a
JavaRDD<String>in CSV format
-
toRDDStringCSV
Obtain the frame as aRDD<String>in CSV format- Returns:
- the frame as a
RDD<String>in CSV format
-
toRDDStringIJV
Obtain the frame as aRDD<String>in IJV format- Returns:
- the frame as a
RDD<String>in IJV format
-
toDF
public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDF()Obtain the frame as aDataFrame- Returns:
- the frame as a
DataFrame
-
toBinaryBlocks
Obtain the frame as aJavaPairRDD<Long, FrameBlock>- Returns:
- the frame as a
JavaPairRDD<Long, FrameBlock>
-
getFrameMetadata
Obtain the frame metadata- Returns:
- the frame metadata
-
toString
-
hasBinaryBlocks
public boolean hasBinaryBlocks()Whether or not this frame contains data as binary blocks- Returns:
trueif data as binary blocks are present,falseotherwise.
-
hasFrameObject
public boolean hasFrameObject()Whether or not this frame contains data as a FrameObject- Returns:
trueif data as binary blocks are present,falseotherwise.
-