Date Functions in Spark SQL with Scala | Spark coding interview questions

preview_player
Показать описание
Hi Friends,
Today we will discuss about all the date functions available in Spark SQL with Scala sample code.
Sample Input file can be downloaded from the below link:

Please subscribe to my channel and provide your comments.
Рекомендации по теме
Комментарии
Автор

nice video.. could u please share how to read the same data with dateType

ramanareddy
Автор

how to assign date to the variable eg val a = 22-03-22

poonkodigopal
Автор

@Sravana lakshmi pisupati, thanks for great video.

this is one of the interview question(either python or scala)




I have csv file having below date columns and each column has different date format as below .



hiredate = dd-mmm-yyyy
report_date=dd/mm/yy
end_date = mmm/yyyy



input data



empid, ename, hiredate, report_date, end_date
1, sreenu, 17-oct-2020, 18/10/20, Jun-2021




if date is MMM-YYYY then display last day of the month else convert YYYY-MM-DD format.



output df

empid, ename, hiredate, report_date, end_date
1, sreenu, 2020-10-17, 2020-10-18, 2021-06-30
-


I want create a method/function to check date column date pattern and apply above logic to convert date as per logic.
in future if any new date column added with above format it should convert as per logic .


can you please help me on this. if possible create video on this.

kottakaburlu
Автор

Hii sravana need your help to get a column as age from the column existing as date of birth(dob)in spark sql

bhavanichilukamari
Автор

Hi, Can you please share the dataset for this example

nareshkumar