I have a table which has employee details and another table project which has the project details and employee id assigned.
EmployeeName|Id|Address|Assigned
Joan|101|xxxx|y
ProjectCode|Number of days|Employee
XX1223|24|101
I have a csv file which will load the employee details in the employee table. While loading the employee details,
I have a dataframe for Employee as, var employeeDF = Employee_TABLE And, var employeeAssignedDF = Employee_Join_Project
At the moment, I insert to Employee first then do the join and then update Employee again. But I can do the employeeDF.except(employeeAssignedDF) which will have a minimum number of rows.
Thanks
You could try this, But not sure whether this could solve your problem or not -
val newDf = df.withColumn("Column", when(CONDITION, 'Y').otherwise('N'))
You could also use any method at the place of "when(CONDITION, 'Y')"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.