Hi, I am trying to read a json into a dataframe and then to a dataset. I am facing the below issue. Could someone quickly help me.
There is a PrintDF dataframe was created successfully and below is the schema. scala> personDF.printSchema(); root |-- personDF: struct (nullable = true) | |-- city: string (nullable = true) | |-- line1: string (nullable = true) | |-- postalCode: string (nullable = true) | |-- state: string (nullable = true) | |-- type1: string (nullable = true) I created a case class to capture the above DF. scala> case class address1(city:String,line1:String,postalCode:String,state:String,type1:String) defined class address1 Below is the data that personDF has at the moment scala> personzDF.show() +--------------------+ | personDF| +--------------------+ |[CENTERPORT,5 PRO...| |[HUNTINGTON,94 JA...| |[RIVERHEAD,9 PATT...| |[NORTHPORT,50 LIS...| |[NORTHPORT,24 LAU...| |[NORTHPORT,340 SC...| |[GREENLAWN,166 BR...| |[MELVILLE,1 MERID...| +--------------------+ Finally while I am creating dataset, I am getting the below error. scala> val ds = personDF.as[address1] <console>:32: error: overloaded method value as with alternatives: (alias: Symbol)org.apache.spark.sql.DataFrame <and> (alias: String)org.apache.spark.sql.DataFrame does not take type parameters val ds = personDF.as[address1] I did google search and could not find the reason. Thanks, Sivaram ---------------------------------------------------------------------- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system.