Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 10-17-2017 12:25 PM
Hello,
I try to ingest data in hive with nifi
(from json data =>convert jsontosql => puthiveql)
and I got this error message from the puthiveql processor:
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.parse.ParseException:line 1:221 cannot recognize input near '?' ',' '?' in value row constructor
if I look at the input flowfile of the puthiveql it has the correct insert query
INSERT INTO nifilog (objectid, platform, bulletinid, bulletincategory, bulletingroupid, bulletinlevel, bulletinmessage, bulletinnodeid, bulletinsourceid, bulletinsourcename, bulletinsourcetype, bulletintimestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
each flowfile has all the needed attribute:
sql.args.N.type & . sql.args.N.value
Any idea how to debug/solve this?
Created 10-17-2017 02:15 PM
Hi @msumbul,
The ConvertJsonToSQL processor has been developed to work with the SQL processors. The Hive processor is expecting a different naming convention on the attributes, instead of:
sql.args.N.type/value
it is expecting:
hiveql.args.N.type/value
The syntax between SQL and HQL are close enough and the generated query is also valid for Hive but the attributes need to be renamed. What you can do is to use an UpdateAttribute processor to have the expected attributes before using the PutHiveQL processor.
Hope this helps.
Created 10-17-2017 02:15 PM
Hi @msumbul,
The ConvertJsonToSQL processor has been developed to work with the SQL processors. The Hive processor is expecting a different naming convention on the attributes, instead of:
sql.args.N.type/value
it is expecting:
hiveql.args.N.type/value
The syntax between SQL and HQL are close enough and the generated query is also valid for Hive but the attributes need to be renamed. What you can do is to use an UpdateAttribute processor to have the expected attributes before using the PutHiveQL processor.
Hope this helps.
Created 04-12-2018 01:35 PM
As of NiFi 1.5.0 (via NIFI-4684), you can now specify the prefix in ConvertJSONToSQL. The property defaults to "sql" to maintain existing behavior, but can be changed to "hiveql" for use with PutHiveQL.