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 57363200C5B for ; Wed, 5 Apr 2017 07:13:53 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5595F160BA1; Wed, 5 Apr 2017 05:13:53 +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 773D2160B90 for ; Wed, 5 Apr 2017 07:13:52 +0200 (CEST) Received: (qmail 6229 invoked by uid 500); 5 Apr 2017 05:13:51 -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 6217 invoked by uid 99); 5 Apr 2017 05:13:51 -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; Wed, 05 Apr 2017 05:13:51 +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 0CA441A022D for ; Wed, 5 Apr 2017 05:13:51 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.363 X-Spam-Level: X-Spam-Status: No, score=0.363 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id AYuVyVSKPy93 for ; Wed, 5 Apr 2017 05:13:49 +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 mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 8B9B45FBA1 for ; Wed, 5 Apr 2017 05:13:49 +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 v355Dhp9001027; Wed, 5 Apr 2017 05:13:43 GMT Message-Id: <201704050513.v355Dhp9001027@ip-10-146-233-104.ec2.internal> Date: Wed, 5 Apr 2017 05:13:43 +0000 From: "Dimitris Tsirogiannis (Code Review)" To: Lars Volker , impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Marcel Kornacker , Thomas Tauber-Marshall Reply-To: dtsirogiannis@cloudera.com X-Gerrit-MessageType: comment Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-4166=3A_Add_SORT_BY_sql_clause=0A?= X-Gerrit-Change-Id: I08834f38a941786ab45a4381c2732d929a934f75 X-Gerrit-ChangeURL: X-Gerrit-Commit: 57fc59632041726e74b87cc0459f253950f5d741 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.7 archived-at: Wed, 05 Apr 2017 05:13:53 -0000 Dimitris Tsirogiannis has posted comments on this change. Change subject: IMPALA-4166: Add SORT BY sql clause ...................................................................... Patch Set 7: (18 comments) http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/main/cup/sql-parser.cup File fe/src/main/cup/sql-parser.cup: PS7, Line 984: Set There is no KW_SET, right? Update the name? http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/main/java/org/apache/impala/analysis/AlterTableSetSortByColumnsStmt.java File fe/src/main/java/org/apache/impala/analysis/AlterTableSetSortByColumnsStmt.java: PS7, Line 73: getTargetTable() t? http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/main/java/org/apache/impala/analysis/Analyzer.java File fe/src/main/java/org/apache/impala/analysis/Analyzer.java: Line 2484: * Add a warning that will be displayed to the user. Ignores null messages. Comment that no warning can be issued if warnings have been retrieved? http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/main/java/org/apache/impala/analysis/CreateTableLikeStmt.java File fe/src/main/java/org/apache/impala/analysis/CreateTableLikeStmt.java: PS7, Line 119: sortByColumns_. I think this can throw a NPE. Looking at the parser I see that CreateTableListStmt can pass null for sortByColumns_ and couldn't find where this changes. http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/main/java/org/apache/impala/analysis/TableDef.java File fe/src/main/java/org/apache/impala/analysis/TableDef.java: PS7, Line 296: propertyString inline http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/main/java/org/apache/impala/analysis/TablePropertyAnalyzer.java File fe/src/main/java/org/apache/impala/analysis/TablePropertyAnalyzer.java: PS7, Line 41: /** : * Analyzes the 'sort.by.columns' property of 'table'. : */ : public static List analyzeSortByColumns(Table table) throws AnalysisException { : return TablePropertyAnalyzer.analyzeSortByColumns( : table.getMetaStoreTable().getParameters(), table); : } : : /** : * Analyzes the 'sort.by.columns' property in 'tblProperties' against the columns of : * 'table'. : */ : public static List analyzeSortByColumns(Map tblProperties, : Table table) throws AnalysisException { : return TablePropertyAnalyzer.analyzeSortByColumns( : getSortByColumnsFromProperties(tblProperties), table); : } These are used in only one place, right? Maybe inline there? Line 76: } Precondition check for HBase? PS7, Line 127: private static List getSortByColumnsFromProperties( : Map tblProperties) { You may want to consider if it's better to have a getSortByColumn(Table table) function instead of this one. Just a though... http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/main/java/org/apache/impala/planner/Planner.java File fe/src/main/java/org/apache/impala/planner/Planner.java: PS7, Line 539: // If the table has a 'sort.by.columns' property and the query has a 'noclustered' : // hint, we issue a warning during analysis and ignore the 'noclustered' hint. That comment doesn't seem relevant here. Remove? PS7, Line 541: !insertStmt.hasNoClusteredHint() If insertStmt.hasClusteredHint() is true doesn't that imply that hasNoClusteredHint() is false? I thought they are mutually exclusive. http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java File fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java: PS7, Line 1793: params.sort_by_columns.size() > 0 use isEmpty() http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java File fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java: Line 526: Test for HBase and Kudu? Line 1054: } Same here (HBase + Kudu). You need to put all Kudu tests in a function and check for supported. PS7, Line 1904: most "must" typo PS7, Line 1920: // Kudu table tests are in TestCreateManagedKuduTable(). No need for that comment :) http://gerrit.cloudera.org:8080/#/c/6495/7/fe/src/test/java/org/apache/impala/analysis/ParserTest.java File fe/src/test/java/org/apache/impala/analysis/ParserTest.java: PS7, Line 2347: // Sort by clause How about some tests with additional table options? Try changing the order in which the table options are specified, e.g. location bla sort by () http://gerrit.cloudera.org:8080/#/c/6495/7/testdata/workloads/functional-planner/queries/PlannerTest/ddl.test File testdata/workloads/functional-planner/queries/PlannerTest/ddl.test: PS7, Line 207: table select query http://gerrit.cloudera.org:8080/#/c/6495/7/testdata/workloads/functional-planner/queries/PlannerTest/insert-sort-by.test File testdata/workloads/functional-planner/queries/PlannerTest/insert-sort-by.test: PS7, Line 194: sort by columns with a join can you also add an order by clause? -- To view, visit http://gerrit.cloudera.org:8080/6495 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I08834f38a941786ab45a4381c2732d929a934f75 Gerrit-PatchSet: 7 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Lars Volker Gerrit-Reviewer: Dimitris Tsirogiannis Gerrit-Reviewer: Lars Volker Gerrit-Reviewer: Marcel Kornacker Gerrit-Reviewer: Thomas Tauber-Marshall Gerrit-HasComments: Yes