From issues-return-20614-archive-asf-public=cust-asf.ponee.io@kylin.apache.org Mon Oct 8 03:27:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4814D18064E for ; Mon, 8 Oct 2018 03:27:04 +0200 (CEST) Received: (qmail 21240 invoked by uid 500); 8 Oct 2018 01:27:03 -0000 Mailing-List: contact issues-help@kylin.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kylin.apache.org Delivered-To: mailing list issues@kylin.apache.org Received: (qmail 21231 invoked by uid 99); 8 Oct 2018 01:27:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Oct 2018 01:27:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id B85441A1267 for ; Mon, 8 Oct 2018 01:27:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id tRUqFnHigFO9 for ; Mon, 8 Oct 2018 01:27:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 252525F4A9 for ; Mon, 8 Oct 2018 01:27:01 +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 5E73AE0177 for ; Mon, 8 Oct 2018 01:27:00 +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 1DC9624793 for ; Mon, 8 Oct 2018 01:27:00 +0000 (UTC) Date: Mon, 8 Oct 2018 01:27:00 +0000 (UTC) From: "XiaoXiang Yu (JIRA)" To: issues@kylin.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (KYLIN-3594) Select with Catalog fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/KYLIN-3594?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] XiaoXiang Yu resolved KYLIN-3594. --------------------------------- Resolution: Fixed > Select with Catalog fails > ------------------------- > > Key: KYLIN-3594 > URL: https://issues.apache.org/jira/browse/KYLIN-3594 > Project: Kylin > Issue Type: Bug > Reporter: Hosur Narahari > Assignee: XiaoXiang Yu > Priority: Major > Fix For: v2.6.0 > > > By using DatabaseMetaData if we get catalog using getCatalogs() method, i= t return value "defaultCatalog". It returns actual hive schema when we exec= ute getSchemas(). > According to JDBC contract, catalog.schema.table should be valid from cla= use and many query layers use that. But kylin fails when we execute that qu= ery. > I've tried to write sample code piece for that below. > =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _DatabaseMetaData db =3D conn.getMetaData();_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _ResultSet catalogSet =3D db.getCatalogs();_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _String catalog =3D "";_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _if(catalogSet.next()) {_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _catalog =3D catalogSet.getStri= ng("TABLE_CAT");_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _}_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _ResultSet schemaSet =3D db.getSchemas();_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _String schema =3D "";_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _if(schemaSet.next()) {_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _schema =3D schemaSet.getString= ("TABLE_SCHEM");_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _}_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _StringBuilder sb =3D new StringBuilder("SELE= CT * FROM ");_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _if(!catalog.isEmpty()) {_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _sb.append(catalog + ".");_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _}_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _if(!schema.isEmpty()) {_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _sb.append(schema + ".");_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _}_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _sb.append("kylin_sales limit 10");_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _String query =3D sb.toString();_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _Statement stat =3D conn.createStatement();_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _ResultSet rs =3D stat.executeQuery(query);_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _while(rs.next()) {_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _System.out.println(rs.getObjec= t("trans_id"));_ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 _}_ > In short, the above snippet is executing the query, > _select * from defaultCatalog.DEFAULT.kylin_sales._ > =C2=A0 > Same thing happens even with different schemas if we have like, > _select * from defaultCatalog.test.kylin_sales_=C2=A0also fails. -- This message was sent by Atlassian JIRA (v7.6.3#76005)