How to convert SQL Query to HiveSQL and get Min Date instead of using datepart as following:
%sql
-- To clear table if it already exists
DROP TABLE IF EXISTS bar;
-- Create temp table syntax
CREATE TEMP VIEW bar AS
--// Start date containing information about year and quarter
SELECT
min(cast (datepart(year, startdate)||datepart(quarter, startdate) as bigint)) as st_dte,
max(cast (datepart(year, enddate)||datepart (quarter, enddate) as bigint)) as end_dte, a_id, carr as bar_code,
case when wac < 100
then 'Dom Flg bar'
else 'Int Flg bar' end as bar_flag,
case when a_id in (343, 455, 123, 656, 645)
then 1
else 0
end as lcc_bar
from oair_cardecode
GROUP BY a_id, bar_code, bar_flag, lcc_bar;
--this code returns error in the databricks.