-1

I am migrating Greenplum to HiveSql but i could not able to find any such below kind of solution in google search. please help me.

DATE_PART('minute',ck_2::time - ck_1::time) gap_1_2

please help me , how do we convert above the statement to hivesql.

Developer KE
  • 71
  • 1
  • 2
  • 14

1 Answers1

0

If i am not wrong ask here is time difference in minute for hive,

it can be achieved using unix_timestamp it covert time in second and then devide it by 60 and get time difference in minute

ie -

 SELECT (( unix_timestamp(ck_2) - unix_timestamp(ck_1))/60 ) as gap_1_2
sandeep rawat
  • 4,797
  • 1
  • 18
  • 36
  • please help me one more conversion : replace(id_number,'','','''')::character varying(100) id_number – Developer KE Oct 19 '21 at 08:28
  • i tried select cast(replace('12345','','','''') as string) id_number but not working – Developer KE Oct 19 '21 at 08:29
  • It will be great if you read some basic hiveql . replace is not there is translate or regexp_replace https://dwgeek.com/apache-hive-replace-function-and-examples.html/ – sandeep rawat Oct 19 '21 at 11:01