Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D7D9E200C85 for ; Tue, 30 May 2017 19:55:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D6834160BDD; Tue, 30 May 2017 17:55:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0D0BF160BB1 for ; Tue, 30 May 2017 19:55:10 +0200 (CEST) Received: (qmail 6614 invoked by uid 500); 30 May 2017 17:55:09 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 6598 invoked by uid 99); 30 May 2017 17:55:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 May 2017 17:55:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 7AC9EC8770 for ; Tue, 30 May 2017 17:55:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id lCEHOueDs5G6 for ; Tue, 30 May 2017 17:55:08 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 392535F3BF for ; Tue, 30 May 2017 17:55:08 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 931FDE073A for ; Tue, 30 May 2017 17:55:07 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id CC46021B56 for ; Tue, 30 May 2017 17:55:06 +0000 (UTC) Date: Tue, 30 May 2017 17:55:06 +0000 (UTC) From: "Jesus Camacho Rodriguez (JIRA)" To: dev@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HIVE-16788) ODBC call SQLForeignKeys leads to NPE if you use PK arguments rather than FK arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 30 May 2017 17:55:12 -0000 Jesus Camacho Rodriguez created HIVE-16788: ---------------------------------------------- Summary: ODBC call SQLForeignKeys leads to NPE if you use PK arguments rather than FK arguments Key: HIVE-16788 URL: https://issues.apache.org/jira/browse/HIVE-16788 Project: Hive Issue Type: Bug Components: ODBC Reporter: Carter Shanklin Assignee: Jesus Camacho Rodriguez This ODBC call is meant to allow you to determine FK relationships either from the PK side or from the FK side. Hive only allows you to traverse from the FK side, trying it from the PK side leads to an NPE. Example using the table "customer" from TPC-H with FKs defined in Hive: {code} === Foreign Keys === Using table as foreign source (u'HIVE', u'tpch_bin_flat_orc_2', u'nation', u'n_nationkey', u'HIVE', u'tpch_bin_flat_orc_2', u'customer', u'c_nationkey', 1, 0, 0, u'custome r_c2', u'nation_c1', 0) Not using table as foreign source Got an error from the server for customer! {code} Compare: Postgres {code} === Foreign Keys === Using table as foreign source (u'vagrant', u'public', u'nation', u'n_nationkey', u'vagrant', u'public', u'customer', u'c_nationkey', 1, 3, 3, u'customer_c_nationkey_fkey', u'nation_pkey', 7) Not using table as foreign source (u'vagrant', u'public', u'customer', u'c_custkey', u'vagrant', u'public', u'orders', u'o_custkey', 1, 3, 3, u'orders_o_custkey_fkey', u'customer_pkey', 7) {code} Note that Postgres allows traversal from either way. The traceback you get in the HS2 logs is this: {code} 2016-12-04T21:08:55,398 ERROR [8998ca98-9940-49f8-8833-7c6ebd8c96a2 HiveServer2-Handler-Pool: Thread-53] metastore.RetryingHMSHandler: MetaEx ception(message:java.lang.NullPointerException) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newMetaException(HiveMetaStore.java:5785) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_foreign_keys(HiveMetaStore.java:6474) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:140) at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:99) at com.sun.proxy.$Proxy25.get_foreign_keys(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.getForeignKeys(HiveMetaStoreClient.java:1596) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:154) at com.sun.proxy.$Proxy26.getForeignKeys(Unknown Source) at org.apache.hive.service.cli.operation.GetCrossReferenceOperation.runInternal(GetCrossReferenceOperation.java:128) at org.apache.hive.service.cli.operation.Operation.run(Operation.java:324) at org.apache.hive.service.cli.session.HiveSessionImpl.getCrossReference(HiveSessionImpl.java:933) at org.apache.hive.service.cli.CLIService.getCrossReference(CLIService.java:411) at org.apache.hive.service.cli.thrift.ThriftCLIService.GetCrossReference(ThriftCLIService.java:738) at org.apache.hive.service.rpc.thrift.TCLIService$Processor$GetCrossReference.getResult(TCLIService.java:1617) at org.apache.hive.service.rpc.thrift.TCLIService$Processor$GetCrossReference.getResult(TCLIService.java:1602) at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56) at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at org.apache.hive.common.util.HiveStringUtils.normalizeIdentifier(HiveStringUtils.java:919) at org.apache.hadoop.hive.metastore.ObjectStore$GetHelper.(ObjectStore.java:2722) at org.apache.hadoop.hive.metastore.ObjectStore$GetListHelper.(ObjectStore.java:2863) at org.apache.hadoop.hive.metastore.ObjectStore$11.(ObjectStore.java:8455) at org.apache.hadoop.hive.metastore.ObjectStore.getForeignKeysInternal(ObjectStore.java:8455) at org.apache.hadoop.hive.metastore.ObjectStore.getForeignKeys(ObjectStore.java:8445) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:101) at com.sun.proxy.$Proxy24.getForeignKeys(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_foreign_keys(HiveMetaStore.java:6465) ... 28 more {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)