蜂巢jdbc为什么更改输入查询?

时间:2018-08-18 09:40:51

标签: jdbc hive

以下查询可在

中完美运行
select dt.year_quarter,
    p.brand,
    sum(sales_cost)
from sales_fact fct
inner join date_dim dt
  on dt.date_sk = fct.date_sk
inner join products_dim p
  on p.product_sk = fct.product_sk
group by dt.year_quarter, p.brand;

但是当我在sql workbench中运行它时,出现此错误。

[Simba][HiveJDBCDriver](500051) ERROR processing query/statement. Error Code: 40000, SQL state: TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Error while compiling statement: FAILED: ParseException line 1:140 extraneous input '_SYNTHJOIN_d175d37e___fctsales_cost_' expecting ) near '<EOF>':28:27, org.apache.hive.service.cli.operation.Operation:toSQLException:Operation.java:324, org.apache.hive.service.cli.operation.SQLOperation:prepare:SQLOperation.java:148, org.apache.hive.service.cli.operation.SQLOperation:runInternal:SQLOperation.java:228, org.apache.hive.service.cli.operation.Operation:run:Operation.java:264, org.apache.hive.service.cli.session.HiveSessionImpl:executeStatementInternal:HiveSessionImpl.java:479, org.apache.hive.service.cli.session.HiveSessionImpl:executeStatementAsync:HiveSessionImpl.java:466, sun.reflect.GeneratedMethodAccessor40:invoke::-1, sun.reflect.DelegatingMethodAccessorImpl:invoke:DelegatingMethodAccessorImpl.java:43, java.lang.reflect.Method:invoke:Method.java:498, org.apache.hive.service.cli.session.HiveSessionProxy:invoke:HiveSessionProxy.java:78, org.apache.hive.service.cli.session.HiveSessionProxy:access$000:HiveSessionProxy.java:36, org.apache.hive.service.cli.session.HiveSessionProxy$1:run:HiveSessionProxy.java:63, java.security.AccessController:doPrivileged:AccessController.java:-2, javax.security.auth.Subject:doAs:Subject.java:422, org.apache.hadoop.security.UserGroupInformation:doAs:UserGroupInformation.java:1866, org.apache.hive.service.cli.session.HiveSessionProxy:invoke:HiveSessionProxy.java:59, com.sun.proxy.$Proxy26:executeStatementAsync::-1, org.apache.hive.service.cli.CLIService:executeStatementAsync:CLIService.java:315, org.apache.hive.service.cli.thrift.ThriftCLIService:ExecuteStatement:ThriftCLIService.java:509, org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement:getResult:TCLIService.java:1377, org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement:getResult:TCLIService.java:1362, org.apache.thrift.ProcessFunction:process:ProcessFunction.java:39, org.apache.thrift.TBaseProcessor:process:TBaseProcessor.java:39, org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge$Server$TUGIAssumingProcessor:process:HadoopThriftAuthBridge.java:562, org.apache.thrift.server.TThreadPoolServer$WorkerProcess:run:TThreadPoolServer.java:286, java.util.concurrent.ThreadPoolExecutor:runWorker:ThreadPoolExecutor.java:1149, java.util.concurrent.ThreadPoolExecutor$Worker:run:ThreadPoolExecutor.java:624, java.lang.Thread:run:Thread.java:748, *org.apache.hadoop.hive.ql.parse.ParseException:line 1:140 extraneous input '_SYNTHJOIN_d175d37e___fctsales_cost_' expecting ) near '<EOF>':33:6, org.apache.hadoop.hive.ql.parse.ParseDriver:parse:ParseDriver.java:222, org.apache.hadoop.hive.ql.parse.ParseDriver:parse:ParseDriver.java:171, org.apache.hadoop.hive.ql.Driver:compile:Driver.java:438, org.apache.hadoop.hive.ql.Driver:compile:Driver.java:321, org.apache.hadoop.hive.ql.Driver:compileInternal:Driver.java:1224, org.apache.hadoop.hive.ql.Driver:compileAndRespond:Driver.java:1218, org.apache.hive.service.cli.operation.SQLOperation:prepare:SQLOperation.java:146], sqlState:42000, errorCode:40000, errorMessage:Error while compiling statement: FAILED: ParseException line 1:140 extraneous input '_SYNTHJOIN_d175d37e___fctsales_cost_' expecting ) near '<EOF>'), Query: SELECT `SYNTHJOIN_d175d37e`.`dtyear_quarter` `_SYNTHJOIN_d175d37e___dtyear_quarter_`, `p`.`brand`, SUM(`SYNTHJOIN_d175d37e`.`fctsales_cost` `_SYNTHJOIN_d175d37e___fctsales_cost_`) FROM  ( SELECT `dt`.`date_sk` AS `dtdate_sk` , `dt`.`dt` AS `dtdt` , `dt`.`quarter` AS `dtquarter` , `dt`.`year_quarter` AS `dtyear_quarter` , `fct`.`trans_id` AS `fcttrans_id` , `fct`.`product_sk` AS `fctproduct_sk` , `fct`.`date_sk` AS `fctdate_sk` , `fct`.`unit_price` AS `fctunit_price` , `fct`.`units_sold` AS `fctunits_sold` , `fct`.`sales_cost` AS `fctsales_cost` , `fct`.`trans_ts` AS `fcttrans_ts` , `fct`.`load_dt` AS `fctload_dt`  FROM `rramad231`.`sales_fact` `fct` JOIN `rramad231`.`date_dim` `dt` ON ( `dt`.`date_sk`=`fct`.`date_sk` )) `SYNTHJOIN_d175d37e`  JOIN `rramad231`.`products_dim` `p` ON ( `p`.`product_sk`=`SYNTHJOIN_d175d37e`.`fctproduct_sk` ) GROUP BY `dt`.`year_quarter`, `p`.`brand`. [SQL State=HY000, DB Errorcode=500051]
1 statement failed.

好像查询在到达蜂巢之前就已更改。我该如何预防。

  • hive 1.2驱动程序
  • com.cloudera.hive.jdbc41.HS2Driver
  • 工具sqlworkbench。

0 个答案:

没有答案