ประทับวันที่ & เวลาไฮฟ์จาก unix_timestamp()

ฉันต้องการแทรกสองคอลัมน์ด้วยวันที่ปัจจุบัน (sysdate) และการประทับเวลา ฉันได้สร้างตารางและแทรกข้อมูลโดยใช้ unix_timestamp ฉันไม่สามารถแปลงเป็นรูปแบบการประทับวันที่และเวลาของกลุ่มได้

############ Hive create table   #############
create table informatica_p2020.M23_MD_LOC_BKEY(
group_nm string,
loc string,
natural_key string,
loc_sk_id int,
**load_date date,
load_time timestamp)**
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
STORED AS TEXTFILE
LOCATION '/user/spanda20/informatica_p2020/infor_external/m23_md_loc/m23_md_loc_bkey/';

############### Insert into Table   ##########
insert overwrite table M23_MD_LOC_BKEY select 'M23' as group_nm,loc,concat('M23','|','LOC') as NATURAL_KEY,
ROW_NUMBER() OVER () as loc_sk_id,
from_unixtime(unix_timestamp(), 'YYYY-MM-DD'),
from_unixtime(unix_timestamp(), 'YYYY-MM-DD HH:MM:SS.SSS') from M23_MD_LOC LIMIT 2 ;

################output of the insert query ############
M23     SY_BP   M23|LOC 1       **2015-07-183**     2015-07-**183** 16:07:00.000
M23     SY_MX   M23|LOC 2       2015-07-183     2015-07-183 16:07:00.000

ขอแสดงความนับถือ Sanjeeb


person user3858193    schedule 02.07.2015    source แหล่งที่มา


คำตอบ (1)


แทนที่จะเป็น from_unixtime(unix_timestamp(), 'YYYY-MM-DD') ลอง - from_unixtime(unix_timestamp(), 'yyyy-MM-dd')

person BADRI N MOHANTY    schedule 02.07.2015