RE: DataFrame select non-existing column

2016-11-20 Thread Mendelson, Assaf
Mendelson, Assaf Cc: user Subject: Re: DataFrame select non-existing column The problem is that I do not know which data frames has the pass.mobile column. I just list a HDFS directory which contain the parquet files and some files has the column and some don't. I really don't want

Re: DataFrame select non-existing column

2016-11-20 Thread Kristoffer Sjögren
structure and work on that (then you can do withColumn("mobile",...) > instead of "pass.mobile") but this would change the schema. > > > -Original Message- > From: Kristoffer Sjögren [mailto:sto...@gmail.com] > Sent: Saturday, November 19, 2016 4:57 PM > To: Mendel

RE: DataFrame select non-existing column

2016-11-20 Thread Mendelson, Assaf
om] Sent: Saturday, November 19, 2016 4:57 PM To: Mendelson, Assaf Cc: user Subject: Re: DataFrame select non-existing column Thanks. Here's my code example [1] and the printSchema() output [2]. This code still fails with the following message: "No such struct field mobile in auction,

Re: DataFrame select non-existing column

2016-11-19 Thread Kristoffer Sjögren
ng like: > > df.withColumn("newColName",pyspark.sql.functions.lit(None)) > > Assaf. > -Original Message- > From: Kristoffer Sjögren [mailto:sto...@gmail.com] > Sent: Friday, November 18, 2016 9:19 PM > To: Mendelson, Assaf > Cc: user > Subject: Re

RE: DataFrame select non-existing column

2016-11-18 Thread Mendelson, Assaf
DataFrame select non-existing column Thanks for your answer. I have been searching the API for doing that but I could not find how to do it? Could you give me a code snippet? On Fri, Nov 18, 2016 at 8:03 PM, Mendelson, Assaf wrote: > You can always add the columns to old dataframes giving them

Re: DataFrame select non-existing column

2016-11-18 Thread Muthu Jayakumar
Depending on your use case, 'df.withColumn("my_existing_or_new_col", lit(0l))' could work? On Fri, Nov 18, 2016 at 11:18 AM, Kristoffer Sjögren wrote: > Thanks for your answer. I have been searching the API for doing that > but I could not find how to do it? > > Could you give me a code snippet?

Re: DataFrame select non-existing column

2016-11-18 Thread Kristoffer Sjögren
Thanks for your answer. I have been searching the API for doing that but I could not find how to do it? Could you give me a code snippet? On Fri, Nov 18, 2016 at 8:03 PM, Mendelson, Assaf wrote: > You can always add the columns to old dataframes giving them null (or some > literal) as a preproc

RE: DataFrame select non-existing column

2016-11-18 Thread Mendelson, Assaf
You can always add the columns to old dataframes giving them null (or some literal) as a preprocessing. -Original Message- From: Kristoffer Sjögren [mailto:sto...@gmail.com] Sent: Friday, November 18, 2016 4:32 PM To: user Subject: DataFrame select non-existing column Hi We have evolve