Hi , I am trying to convert sample of hive code into spark sql for better performance. below is part of Hive query that needs to be converted to Spark SQL.
All the data is grouped on particular column(id) and max value(value column) is taken for that particular grouped column(id) and pivoted out max(CASE WHEN ( trim(dt_map) = 'Geotab GPS kph' OR trim(dt_map) = 'Teletrac (FTP feed) GPS deg' ) THEN T.value ELSE null END) AS vehicle_speed_kph_1 I have gone through Window and pivot functions but looks like I will not be achieving above condition. Would be very helpful if someone can provide any suggestions *Note:* I don't want to create temporary table and use the same hive query again instead of using the functions. Thanks, Asmath