I used SJS for my project and would like to know how NamedDataFrame from SJS works. My first program does this
val schemaString = "parm1:int,parm2:string,parm3:string,parm4:string,parm5:int,parm6:string,parm7:int,parm8:int"
val schema = StructType(schemaString.split(",").map(fieldName => StructField(fieldName.split(":")(0), getFieldTypeInSchema(fieldName.split(":")(1)),true)))
val eDF1 = hive.applySchema(rowRDD1, schema)
this.namedObjects.getOrElseCreate("edf1", new NamedDataFrame(eDF1, true, StorageLevel.MEMORY_ONLY))
My second program does this to retrieve the DataFrame.
val eDF1: Option[NamedDataFrame] = this.namedObjects.get("eDF1")
Here I only able to use Option. How must I cast NamedDataFrame to a Spark DataFrame?
Is something of this equivalent available?
this.namedObjects.get[(Int,String,String,String,Int,String,Int,Int)]("eDF1")
Thanks!!
Edit1: To be precise, without SJS persistence, this could be done on the df
eDF1.filter(eDF1.col("parm1")%2!==0)
How can I perform the same operation from a saved namedObject?