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 B5C6F200B92 for ; Wed, 28 Sep 2016 18:21:56 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B4500160AD3; Wed, 28 Sep 2016 16:21:56 +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 00A96160AB8 for ; Wed, 28 Sep 2016 18:21:55 +0200 (CEST) Received: (qmail 3385 invoked by uid 500); 28 Sep 2016 16:21:55 -0000 Mailing-List: contact reviews-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@impala.incubator.apache.org Received: (qmail 3370 invoked by uid 99); 28 Sep 2016 16:21:54 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2016 16:21:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 6DF0E180B95 for ; Wed, 28 Sep 2016 16:21:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.362 X-Spam-Level: X-Spam-Status: No, score=0.362 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id FuxxkpE0x_jz for ; Wed, 28 Sep 2016 16:21:52 +0000 (UTC) Received: from ip-10-146-233-104.ec2.internal (ec2-75-101-130-251.compute-1.amazonaws.com [75.101.130.251]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 6F00D5FB7F for ; Wed, 28 Sep 2016 16:21:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ip-10-146-233-104.ec2.internal (8.14.4/8.14.4) with ESMTP id u8SGLhaO005231; Wed, 28 Sep 2016 16:21:43 GMT Message-Id: <201609281621.u8SGLhaO005231@ip-10-146-233-104.ec2.internal> Date: Wed, 28 Sep 2016 16:21:43 +0000 From: "Alex Behm (Code Review)" To: Zoltan Ivanfi , impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Tim Armstrong Reply-To: alex.behm@cloudera.com X-Gerrit-MessageType: comment Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-784=3A_Use_=60-s_in_SHOW_CREATE_TABLE_output=0A?= X-Gerrit-Change-Id: I8e66439daa35d2e3725e7277c16f3cc5fdb6f128 X-Gerrit-ChangeURL: X-Gerrit-Commit: 7ed9fe4f777aa5572bcdd8c66dcebfef7e521168 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.12.2 archived-at: Wed, 28 Sep 2016 16:21:56 -0000 Alex Behm has posted comments on this change. Change subject: IMPALA-784: Use `-s in SHOW CREATE TABLE output ...................................................................... Patch Set 2: (5 comments) http://gerrit.cloudera.org:8080/#/c/4527/2/fe/src/main/java/com/cloudera/impala/analysis/ColumnDef.java File fe/src/main/java/com/cloudera/impala/analysis/ColumnDef.java: Line 112: sb.append(" " + type_.toString()); toSql() Line 114: sb.append(" " + typeDef_.toString()); toSql() http://gerrit.cloudera.org:8080/#/c/4527/2/fe/src/main/java/com/cloudera/impala/analysis/ToSqlUtils.java File fe/src/main/java/com/cloudera/impala/analysis/ToSqlUtils.java: Line 69: public static String getIdentSql(String ident) { The main issue with this approach is that all invocations of toSql() will not have quoted identifiers. Unfortunately, we also use toSql() for error reporting. For example, take a look at AnalyticExpr.java or any other Expr. If analyze() fails we typically we print the offending expr with toSql(). Error messages will now become unnecessarily weird. I think the callers need to decide the quoting policy. We should have two versions of toSql(): 1. Only adds quotes if necessary for Impala (no need to consider Hive as before) 2. Always quote identifiers Imo, the default toSql() should have the first behavior, and we may add another version that always quotes identifiers. For example, we could have a setup like this: private String toSql(boolean quoteAllIdents); private String toSql() { return toSql(false); } You can imagine other variants. Happy to discuss. Line 76: return Joiner.on(".").join(getStandaloneIdentSqlList((Splitter.on('.').split(ident)))); I don't think splitting here is the right fix. An identifier itself could contain a dot, even if unlikely. Also, qualified table or column references consist of multiple identifiers and not a single identifier, so the premise of this fix is kind of wrong (based on your comment). Line 88: if (ident.equals("*")) { This doesn't seem right or necessary. First, "*" is not an identifier (it is a terminal), and second those clauses that could contain "*" should handle it specially in toSql(). For my understanding, what use case is this change addressing? -- To view, visit http://gerrit.cloudera.org:8080/4527 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8e66439daa35d2e3725e7277c16f3cc5fdb6f128 Gerrit-PatchSet: 2 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Zoltan Ivanfi Gerrit-Reviewer: Alex Behm Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Ivanfi Gerrit-HasComments: Yes