Re: Max of multiple columns of a row in spark

2021-06-06 Thread kushagra deep
I think we can do it using greatest function .
Closing this ticket !


On Mon, Jun 7, 2021 at 2:43 AM kushagra deep 
wrote:

> Hi Guys,
>
> I have a problem where I have a df as below:
>
> ===+
> Marks1 | Marks2| Marks3 |
>   10. 30.  40. |
>
> I want to add a new column in the df with name Max with the max of the
> values of the three columns.
>
> The resultant df should be :
>
> ===+
> Marks1| Marks2| Marks3 | Max |
>  10. 30. 40.   40
>
> Thanks In Advance
>
> Reg,
> Kushagra Deep
>


Max of multiple columns of a row in spark

2021-06-06 Thread kushagra deep
Hi Guys,

I have a problem where I have a df as below:

===+
Marks1 | Marks2| Marks3 |
  10. 30.  40. |

I want to add a new column in the df with name Max with the max of the
values of the three columns.

The resultant df should be :

===+
Marks1| Marks2| Marks3 | Max |
 10. 30. 40.   40

Thanks In Advance

Reg,
Kushagra Deep