在Hive中,可以使用内置的函数from_unixtime和unix_timestamp将timestamp类型和date类型进行转换
SELECT from_unixtime(unix_timestamp(your_timestamp_column), 'yyyy-MM-dd') as your_date_column
FROM your_table;
这里,your_timestamp_column是你要转换的timestamp类型的列名,your_table是表名。from_unixtime函数将unix时间戳转换为指定格式的字符串,'yyyy-MM-dd'表示日期格式为年-月-日。
SELECT unix_timestamp(your_date_column, 'yyyy-MM-dd') as your_timestamp_column
FROM your_table;
这里,your_date_column是你要转换的date类型的列名。unix_timestamp函数将指定格式的字符串转换为unix时间戳,'yyyy-MM-dd'表示日期格式为年-月-日。
注意:在使用这些函数时,请确保你的日期格式与from_unixtime和unix_timestamp函数中的格式匹配,否则可能会导致错误的结果。