DataGrip连接Hive执行DDL操作报错:「FAILED: ParseException line 1:5 cannot recognize input near 'show' 'indexes' 'on' in ddl statement」
写在前面
搭建离线数仓项目中用DataGrip连接Hive,建立ODS业务表在hiveservice2客户端控制台报错
- 报错信息:
FAILED: ParseExceptionline1:5cannotrecognizeinputnear'show''indexes''on'inddlstatementNoViableAltException(153 [917:1: ddlStatement : ( createDatabaseStatement|switchDatabaseStatement|dropDatabaseStatement|createTableStatement|dropTableStatement|truncateTableStatement|alterStatement|descStatement|showStatement|metastoreCheck|createViewStatement|createMaterializedViewStatement|dropViewStatement|dropMaterializedViewStatement|createFunctionStatement|createMacroStatement|dropFunctionStatement|reloadFunctionStatement|dropMacroStatement|analyzeStatement|lockStatement|unlockStatement|lockDatabase|unlockDatabase|createRoleStatement|dropRoleStatement| ( grantPrivileges )=>grantPrivileges| ( revokePrivileges )=>revokePrivileges|showGrants|showRoleGrants|showRolePrincipals|showRoles|grantRole|revokeRole|setRole|showCurrentRole|abortTransactionStatement|killQueryStatement|resourcePlanDdlStatements );]) atorg.antlr.runtime.DFA.noViableAlt(DFA.java:158) atorg.antlr.runtime.DFA.predict(DFA.java:116) atorg.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:4244) atorg.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:2494) atorg.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1420) atorg.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:220) atorg.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:74) atorg.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:67) atorg.apache.hadoop.hive.ql.Driver.compile(Driver.java:616) atorg.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1826) atorg.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1773) atorg.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1768) atorg.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:126) atorg.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:197) atorg.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:260) atorg.apache.hive.service.cli.operation.Operation.run(Operation.java:247) atorg.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:541) atorg.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:527) atsun.reflect.GeneratedMethodAccessor37.invoke(UnknownSource) atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) atjava.lang.reflect.Method.invoke(Method.java:498) atorg.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78) atorg.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36) atorg.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:63) atjava.security.AccessController.doPrivileged(NativeMethod) atjavax.security.auth.Subject.doAs(Subject.java:422) atorg.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729) atorg.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:59) atcom.sun.proxy.$Proxy44.executeStatementAsync(UnknownSource) atorg.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:312) atorg.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:562) atorg.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1557) atorg.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1542) atorg.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) atorg.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) atorg.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56) atorg.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286) atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) atjava.lang.Thread.run(Thread.java:748) FAILED: ParseExceptionline1:5cannotrecognizeinputnear'show''indexes''on'inddlstatement
解决方案
这个错误并不是DDL语句的错误导致的,而是DataGrip自身的原因。
参考
https://blog.csdn.net/weixin_57077623/article/details/118609219