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 AF67C200BCC for ; Tue, 15 Nov 2016 06:31:56 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id ADF91160B0D; Tue, 15 Nov 2016 05:31: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 AD13A160B06 for ; Tue, 15 Nov 2016 06:31:55 +0100 (CET) Received: (qmail 82646 invoked by uid 500); 15 Nov 2016 05:31:54 -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 82633 invoked by uid 99); 15 Nov 2016 05:31: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; Tue, 15 Nov 2016 05:31: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 E3FDE180149 for ; Tue, 15 Nov 2016 05:31:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.78 X-Spam-Level: * X-Spam-Status: No, score=1.78 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=cloudera-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id F5j7iTmnD1Ny for ; Tue, 15 Nov 2016 05:31:50 +0000 (UTC) Received: from mail-it0-f44.google.com (mail-it0-f44.google.com [209.85.214.44]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 040655FC5F for ; Tue, 15 Nov 2016 05:31:44 +0000 (UTC) Received: by mail-it0-f44.google.com with SMTP id b123so75631848itb.0 for ; Mon, 14 Nov 2016 21:31:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudera-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=dnyK6RhG4yNAT4itX45TO825sNSnOhF9fi9JeqQe+SY=; b=De0i0UbRV5gufmVEBiq6LLUoBhCOicA7E9eeICXWi7HbqZAgCZp018YXd9aNd6sIPW tamOd3c2IcYGUIn1lQV2rIlUU5JepvKsJHbz0Mr/gpNRtGDGkPb0mrFgcwFk0QxB+Mwt xa/fjFZ/ju4pAHC25HGXqL5eLsTMEPCYIO0o7o2Z5k4exP+pXWEdgfpCuxtlCMBafW8k VuF1PCHXnuz4kwWLcuYLiN2b9/PXp7xJPEKQ/l6D628eRg8I2LkKxNP2UvbJAEbs5Cdq xxZj5cu0I6ipNxcNnPZp5z93fqXdm3dyzi7yK0UBzXas9CKQCdLDnpG5a5JDLEDYG06j DB/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=dnyK6RhG4yNAT4itX45TO825sNSnOhF9fi9JeqQe+SY=; b=RkFmo1KmIIupwfzfcLHHwk0+8uOY+xDVgYKMmRii4675XMdegpEFeSNHD1MdnMWU0o YbYHJvucJTCx/tjTXZpWkgyVtCPpobfOcL2wWCtimj3kvTGuPYD4noE8QdPDbzdKO5AM EKWOwWUmsPi5tAeQCVdQhfsx58IQng/dYkTxUj9mLNaxT2FT8ZRk4/6veON79GlZZVjG +XQkEYsnfs6Z+B1ru9DZ21SSB4kRy5JieLFPdD9yx6ygrqTxUkpQc7QBy1kwIfw7XEFn dIWKqW6/aHs+sgUdAWpEC8t4r24WaMR6l8YDxclZHK8Iib7GQgfoNrrz0dZFEBNGPY3r w4Uw== X-Gm-Message-State: ABUngvdnbH7MGtUVAyPd12jaS78/gtx2U172ueK3fZSzDZRUYD1p20uPzA4+ky+om8LmegWBPh3ZF2TELk/CFFpU X-Received: by 10.202.198.23 with SMTP id w23mr10497169oif.187.1479187901091; Mon, 14 Nov 2016 21:31:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.214.20 with HTTP; Mon, 14 Nov 2016 21:31:39 -0800 (PST) In-Reply-To: <201611150327.uAF3Ra6b020798@ip-10-146-233-104.ec2.internal> References: <201611150327.uAF3Ra6b020798@ip-10-146-233-104.ec2.internal> From: Alex Behm Date: Mon, 14 Nov 2016 21:31:39 -0800 Message-ID: Subject: Re: [Impala-ASF-CR] IMPALA-1654: General partition exprs in DDL operations. To: Amos Bird , impala-cr , reviews@impala.incubator.apache.org Content-Type: multipart/alternative; boundary=001a1134e65866a8af054150451c archived-at: Tue, 15 Nov 2016 05:31:56 -0000 --001a1134e65866a8af054150451c Content-Type: text/plain; charset=UTF-8 Amos, thanks a lot for your patience and continued effort on this sizeable contribution! We're all looking forward to reviewing more of your patches :-) On Mon, Nov 14, 2016 at 7:27 PM, Internal Jenkins (Code Review) < gerrit@cloudera.org> wrote: > Internal Jenkins has submitted this change and it was merged. > > Change subject: IMPALA-1654: General partition exprs in DDL operations. > ...................................................................... > > > IMPALA-1654: General partition exprs in DDL operations. > > This commit handles partition related DDL in a more general way. We can > now use compound predicates to specify a list of partitions in > statements like ALTER TABLE DROP PARTITION and COMPUTE INCREMENTAL > STATS, etc. It will also make sure some statements only accept one > partition at a time, such as PARTITION SET LOCATION and LOAD DATA. ALTER > TABLE ADD PARTITION remains using the old PartitionKeyValue's logic. > > The changed partition related DDLs are as follows, > > Table: p (i int) partitioned by (j int, k string) > Partitions: > +-------+---+-------+--------+------+--------------+-------------------+ > | j | k | #Rows | #Files | Size | Bytes Cached | Cache Replication | > +-------+---+-------+--------+------+--------------+-------------------+ > | 1 | a | -1 | 0 | 0B | NOT CACHED | NOT CACHED | > | 1 | b | -1 | 0 | 0B | NOT CACHED | NOT CACHED | > | 1 | c | -1 | 0 | 0B | NOT CACHED | NOT CACHED | > | 2 | d | -1 | 0 | 0B | NOT CACHED | NOT CACHED | > | 2 | e | -1 | 0 | 0B | NOT CACHED | NOT CACHED | > | 2 | f | -1 | 0 | 0B | NOT CACHED | NOT CACHED | > | Total | | -1 | 0 | 0B | 0B | | > +-------+---+-------+--------+------+--------------+-------------------+ > > 1. show files in p partition (j<2, k='a'); > 2. alter table p partition (j<2, k in ("b","c") set cached in 'testPool'; > > // j can appear more than once, > 3.1. alter table p partition (j<2, j>0, k<>"d") set uncached; > // it is the same as > 3.2. alter table p partition (j<2 and j>0, not k="e") set uncached; > // we can also do 'or' > 3.3. alter table p partition (j<2 or j>0, k like "%") set uncached; > > // missing 'k' matches all values of k > 4. alter table p partition (j<2) set fileformat textfile; > 5. alter table p partition (k rlike ".*") set serdeproperties ("k"="v"); > 6. alter table p partition (j is not null) set tblproperties ("k"="v"); > 7. alter table p drop partition (j<2); > 8. compute incremental stats p partition(j<2); > > The remaining old partition related DDLs are as follows, > > 1. load data inpath '/path/from' into table p partition (j=2, k="d"); > 2. alter table p add partition (j=2, k="g"); > 3. alter table p partition (j=2, k="g") set location '/path/to'; > 4. insert into p partition (j=2, k="g") values (1), (2), (3); > > General partition expressions or partially specified partition specs > allows partition predicates to return empty partition set no matter > 'IF EXISTS' is specified. > > Examples: > > [localhost.localdomain:21000] > > alter table p drop partition (j=2, k="f"); > Query: alter table p drop partition (j=2, k="f") > +-------------------------+ > | summary | > +-------------------------+ > | Dropped 1 partition(s). | > +-------------------------+ > Fetched 1 row(s) in 0.78s > [localhost.localdomain:21000] > > alter table p drop partition (j=2, k<"f"); > Query: alter table p drop partition (j=2, k<"f") > +-------------------------+ > | summary | > +-------------------------+ > | Dropped 2 partition(s). | > +-------------------------+ > Fetched 1 row(s) in 0.41s > [localhost.localdomain:21000] > > alter table p drop partition (k="a"); > Query: alter table p drop partition (k="a") > +-------------------------+ > | summary | > +-------------------------+ > | Dropped 1 partition(s). | > +-------------------------+ > Fetched 1 row(s) in 0.25s > [localhost.localdomain:21000] > show partitions p; > Query: show partitions p > +-------+---+-------+--------+------+--------------+-------------------+ > | j | k | #Rows | #Files | Size | Bytes Cached | Cache Replication | > +-------+---+-------+--------+------+--------------+-------------------+ > | 1 | b | -1 | 0 | 0B | NOT CACHED | NOT CACHED | > | 1 | c | -1 | 0 | 0B | NOT CACHED | NOT CACHED | > | Total | | -1 | 0 | 0B | 0B | | > +-------+---+-------+--------+------+--------------+-------------------+ > Fetched 3 row(s) in 0.01s > > Change-Id: I2c9162fcf9d227b8daf4c2e761d57bab4e26408f > Reviewed-on: http://gerrit.cloudera.org:8080/3942 > Reviewed-by: Alex Behm > Tested-by: Internal Jenkins > --- > M be/src/service/query-exec-state.cc > M be/src/service/query-exec-state.h > M common/thrift/CatalogService.thrift > M common/thrift/Frontend.thrift > M common/thrift/JniCatalog.thrift > M fe/src/main/cup/sql-parser.cup > M fe/src/main/java/org/apache/impala/analysis/AlterTableDropPartitionStmt. > java > M fe/src/main/java/org/apache/impala/analysis/AlterTableSetCachedStmt.java > M fe/src/main/java/org/apache/impala/analysis/AlterTableSetFileFormatStmt. > java > M fe/src/main/java/org/apache/impala/analysis/ > AlterTableSetLocationStmt.java > M fe/src/main/java/org/apache/impala/analysis/AlterTableSetStmt.java > M fe/src/main/java/org/apache/impala/analysis/AlterTableSetTblProperties. > java > M fe/src/main/java/org/apache/impala/analysis/AlterTableStmt.java > M fe/src/main/java/org/apache/impala/analysis/Analyzer.java > M fe/src/main/java/org/apache/impala/analysis/BaseTableRef.java > M fe/src/main/java/org/apache/impala/analysis/CollectionTableRef.java > M fe/src/main/java/org/apache/impala/analysis/ComputeStatsStmt.java > M fe/src/main/java/org/apache/impala/analysis/DropStatsStmt.java > M fe/src/main/java/org/apache/impala/analysis/InlineViewRef.java > A fe/src/main/java/org/apache/impala/analysis/PartitionSet.java > M fe/src/main/java/org/apache/impala/analysis/PartitionSpec.java > A fe/src/main/java/org/apache/impala/analysis/PartitionSpecBase.java > M fe/src/main/java/org/apache/impala/analysis/ShowFilesStmt.java > M fe/src/main/java/org/apache/impala/analysis/TableRef.java > M fe/src/main/java/org/apache/impala/analysis/TupleDescriptor.java > M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java > M fe/src/main/java/org/apache/impala/catalog/HdfsTable.java > M fe/src/main/java/org/apache/impala/catalog/Table.java > M fe/src/main/java/org/apache/impala/planner/HdfsPartitionPruner.java > M fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java > M fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java > M fe/src/main/java/org/apache/impala/service/Frontend.java > M fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java > M fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java > M fe/src/test/java/org/apache/impala/analysis/ParserTest.java > M shell/impala_client.py > M testdata/workloads/functional-query/queries/QueryTest/alter-table.test > M testdata/workloads/functional-query/queries/QueryTest/compute-stats.test > M testdata/workloads/functional-query/queries/QueryTest/hdfs-caching.test > M testdata/workloads/functional-query/queries/QueryTest/kudu_alter.test > A testdata/workloads/functional-query/queries/QueryTest/ > partition-ddl-predicates.test > M tests/metadata/test_ddl.py > 42 files changed, 1,398 insertions(+), 596 deletions(-) > > Approvals: > Internal Jenkins: Verified > Alex Behm: Looks good to me, approved > > > > -- > To view, visit http://gerrit.cloudera.org:8080/3942 > To unsubscribe, visit http://gerrit.cloudera.org:8080/settings > > Gerrit-MessageType: merged > Gerrit-Change-Id: I2c9162fcf9d227b8daf4c2e761d57bab4e26408f > Gerrit-PatchSet: 22 > Gerrit-Project: Impala-ASF > Gerrit-Branch: master > Gerrit-Owner: Amos Bird > Gerrit-Reviewer: Alex Behm > Gerrit-Reviewer: Amos Bird > Gerrit-Reviewer: Bharath Vissapragada > Gerrit-Reviewer: Henry Robinson > Gerrit-Reviewer: Internal Jenkins > Gerrit-Reviewer: Jim Apple > Gerrit-Reviewer: Marcel Kornacker > > -- > You received this message because you are subscribed to the Google Groups > "impala-cr" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to impala-cr+unsubscribe@cloudera.com. > For more options, visit https://groups.google.com/a/cloudera.com/d/optout. > --001a1134e65866a8af054150451c--