shell脚本里面用hive -e" xxxxxx " 来运行sql。 xxxxx是sql内容。
shell脚本是在windows环境下用idea编写的。
把sql内容单独放在hue上运行成功,但是用azkaban运行报错。
查找报错原因又说是用了hive关键词,发现user是关键词。把user改为users.另外子查询也用了别名但是仍然报错。
报错如下所示:
05-01-2022 18:34:25 CST rny_loan_officer_city INFO - Logging initialized using configuration in jar:file:/application/cloudera/parcels/CDH-5.16.2-1.cdh5.16.2.p0.8/jars/hive-common-1.1.0-cdh5.16.2.jar!/hive-log4j.properties
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - MismatchedTokenException(293!=301)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecognizer.java:617)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.partitionSpec(HiveParser_IdentifiersParser.java:10354)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.tableOrPartition(HiveParser_IdentifiersParser.java:10189)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser.tableOrPartition(HiveParser.java:45220)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser.destination(HiveParser.java:44525)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser.insertClause(HiveParser.java:43832)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:41722)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:40970)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:40846)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1531)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1067)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:205)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:170)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:524)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1358)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1475)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1287)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1277)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:226)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:175)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:389)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:324)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:726)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:699)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:634)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at java.lang.reflect.Method.invoke(Method.java:498)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.util.RunJar.run(RunJar.java:226)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - at org.apache.hadoop.util.RunJar.main(RunJar.java:141)
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - FAILED: ParseException line 2:73 mismatched input '-' expecting ) near '2022' in destination specification
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
05-01-2022 18:34:26 CST rny_loan_officer_city INFO - WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.
运维说是格式问题
-
脚本中文字符的原因 你的脚本里换行符是回车键 正常是$结尾
后来把 中文注释单独作为一行,不要放在语句后边。发现可以运行成功了。