Inserting values into a hive table issue - hive

I am attempting to insert values into a specific column in a hive table. The following query does not seem to work:
INSERT INTO table DQ_Rules_Status_Table_PROFILER (Load_TimeStamp) VALUES (2020-01-24) where Load_Ts rlike('Jan 24');
The error message received is as follows:
Error: Error while compiling statement: FAILED: ParseException line 1:86 missing EOF at 'where' near ')' (state=42000,code=40000)

UPDATE DQ_Rules_Status_Table_PROFILER SET Load_TimeStamp = '2020-01-24' WHERE Load_Ts rlike('Jan 24');

Related

Modify / Change command not working in HIVE for converting String type data to TIMESTAMP

I want to change datatype from String to TimeStamp in hive but below queries aren't helping.
ALTER TABLE so_wireless_cpu_utilization MODIFY start_time start_time TIMESTAMP;
It throws below error:
Getting log thread is interrupted, since query is done!
Error: Error while compiling statement: FAILED: ParseException line 1:40 cannot recognize input near 'MODIFY' 'start_time' 'start_time' in alter table statement (state=42000,code=40000)
org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 1:40 cannot recognize input near 'MODIFY' 'start_time' 'start_time' in alter table statement
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:279)
Also, I tried below query but it doesn't work either:
alter table so_wireless_ap_channels CHANGE load_date load_date String;
So what is the best way of converting the string format to timestamp in hive.

How to add avro.schema.url to hive partition storage information?

I am trying command
ALTER TABLE mytable PARTITION(date='2010-02-22') SET 'avro.schema.url'
'hdfs://xxx.com:9000/location/to/my/schema/_schema.avsc';
But it is returning parsing Error :
FAILED: ParseException line 1:49 cannot recognize input near 'SET'
''avro.schema.url'' ''hdfs://xxx.com:9000/location/to/my/schema/_schema.avsc'' in alter
table partition statement suffix
This is right syntax:
ALTER TABLE mytable PARTITION(date='2010-02-22') SET TBLPROPERTIES(
'avro.schema.url'
'hdfs://xxx.com:9000/location/to/my/schema/_schema.avsc');

Error while compiling statement: FAILED: ParseException line 1:49 cannot recognize input near '(' 'stock_status_id' ',' in statement

Hive version : Hive 1.1.0-cdh5.7.1
While executing the insert into statement, I am getting the below error
Error while compiling statement: FAILED: ParseException line 1:49
cannot recognize input near '(' 'stock_status_id' ',' in statement
INSERT INTO table tgt_ebr_stores_physical_counts (stock_status_id,stk_no,description,avg_unit_cost,phy_cnt_date,issue_date,rcpt_date,adj_date,review_date,on_reqst_only_flag,row_bin,primary_flag,new_qty,cap_qty,user_code,description_1) SELECT EIM_STOCK.STOCK_STATUS_ID,EIM_STOCK.STK_NO,EIM_STOCK.DESCRIPTION,EIM_STOCK_COSTS.AVG_UNIT_COST,EIM_STOCK_HISTORY.PHY_CNT_DATE,EIM_STOCK_HISTORY.ISSUE_DATE,EIM_STOCK_HISTORY.RCPT_DATE,EIM_STOCK_HISTORY.ADJ_DATE,EIM_STOCK_HISTORY.REVIEW_DATE,EIM_STOCK_LOCATION.ON_REQST_ONLY_FLAG,EIM_STOCK_LOCATION_QUANTITIES.ROW_BIN,EIM_STOCK_LOCATION_QUANTITIES.PRIMARY_FLAG,EIM_STOCK_LOCATION_QUANTITIES.NEW_QTY,EIM_STOCK_LOCATION_QUANTITIES.CAP_QTY,TSW_CODES.USER_CODE,TSW_CODES.DESCRIPTION FROM AAA_ORCL_SLK_M003P.EIM_STOCK EIM_STOCK JOIN AAA_ORCL_SLK_M003P.EIM_STOCK_LOCATION EIM_STOCK_LOCATION ON EIM_STOCK.STK_NO=EIM_STOCK_LOCATION.STK_NO JOIN AAA_ORCL_SLK_M003P.TSW_CODES TSW_CODES ON EIM_STOCK.ISSUE_UOM_ID=TSW_CODES.CODE_ID JOIN AAA_ORCL_SLK_M003P.EIM_STOCK_LOCATION_QUANTITIES EIM_STOCK_LOCATION_QUANTITIES ON EIM_STOCK_LOCATION.STK_NO=EIM_STOCK_LOCATION_QUANTITIES.STK_NO AND EIM_STOCK_LOCATION.LOC_CODE=EIM_STOCK_LOCATION_QUANTITIES.LOC_CODE JOIN AAA_ORCL_SLK_M003P.EIM_STOCK_HISTORY EIM_STOCK_HISTORY ON EIM_STOCK_LOCATION_QUANTITIES.STK_NO=EIM_STOCK_HISTORY.STK_NO AND EIM_STOCK_LOCATION_QUANTITIES.LOC_CODE = EIM_STOCK_HISTORY.LOC_CODE JOIN AAA_ORCL_SLK_M003P.EIM_STOCK_COSTS EIM_STOCK_COSTS ON EIM_STOCK_HISTORY.LOC_CODE=EIM_STOCK_COSTS.LOC_CODE AND EIM_STOCK_HISTORY.STK_NO=EIM_STOCK_COSTS.STK_NO;
Can someone please help?
"As of Hive 1.2.0 each INSERT INTO T can take a column list like INSERT
INTO T (z, x, c1)."
LanguageManualDML-Synopsis.1
Hive 1.1 does not support column list.
You should insert all columns by their order in the destination table.
INSERT INTO table tgt_ebr_stores_physical_counts SELECT ...

sql Error in derby - ERROR 42X01: Syntax error: Encountered "KEY"

following query gives error like ERROR 42X01: Syntax error: Encountered "KEY" at line 1, column 48.
I am not able to understand what is the exact issue. column KEY is exist and datatype is integer.
Insert into UOM_TYPE
(UNITS_OF_MEASURE_NO,TYPE,KEY,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,VERSION)
values
(79,'Clinical Property',32,'JRL',DATE('2007-05-04'),'JRL',DATE('2007-05-04'),2);
Please help me to resolve the issue
KEY is a Keyword in derby db. you have to escape it :
Insert into UOM_TYPE
(UNITS_OF_MEASURE_NO,TYPE,"KEY",CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,VERSION)
values
(79,'Clinical Property',32,'JRL',DATE('2007-05-04'),'JRL',DATE('2007-05-04'),2);

Inserting with empty values in PostgreSQL causes error

My table has three columns, but I'm only using one for most rows.
I'm trying to do a basic insert in PSQL, like so:
grouper=> INSERT INTO master_list VALUES ('Ebay',,);
But I'm getting a syntax error:
ERROR: syntax error at or near ","
LINE 1: INSERT INTO master_list VALUES ('Ebay',,);
^
Any advice or suggestions welcome!
Try
INSERT INTO master_list VALUES ('Ebay',null,null);
or
INSERT INTO master_list (fieldname) VALUES ('Ebay');