Re: Scala Spark SQL row object Ordinal Method Call Aliasing

2015-01-20 Thread Michael Armbrust
I use extractors: sql("SELECT name, age FROM people").map { Row(name: String, age: Int) => ... } On Tue, Jan 20, 2015 at 6:48 AM, Sunita Arvind wrote: > The below is not exactly a solution to your question but this is what we > are doing. For the first time we do end up doing row.getstrin

Re: Scala Spark SQL row object Ordinal Method Call Aliasing

2015-01-20 Thread Cheng Lian
I had once worked on a named row feature but haven’t got time to finish it. It looks like this: |sql("...").named.map { row:NamedRow => row[Int]('key) -> row[String]('value) } | Basically the |named| method generates a field name to ordinal map for each RDD partition. This map is then share

Re: Scala Spark SQL row object Ordinal Method Call Aliasing

2015-01-20 Thread Sunita Arvind
The below is not exactly a solution to your question but this is what we are doing. For the first time we do end up doing row.getstring() and we immediately parse it through a map function which aligns it to either a case class or a structType. Then we register it as a table and use just column nam