Return-Path: X-Original-To: apmail-phoenix-dev-archive@minotaur.apache.org Delivered-To: apmail-phoenix-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C5C8419DE8 for ; Wed, 27 Apr 2016 20:57:16 +0000 (UTC) Received: (qmail 7919 invoked by uid 500); 27 Apr 2016 20:57:16 -0000 Delivered-To: apmail-phoenix-dev-archive@phoenix.apache.org Received: (qmail 7861 invoked by uid 500); 27 Apr 2016 20:57:16 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 7850 invoked by uid 99); 27 Apr 2016 20:57:16 -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, 27 Apr 2016 20:57:16 +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 27021180225 for ; Wed, 27 Apr 2016 20:57:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.021 X-Spam-Level: X-Spam-Status: No, score=-4.021 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-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 Wlym5qPf2mCq for ; Wed, 27 Apr 2016 20:57:15 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with SMTP id 49E6D5F2C5 for ; Wed, 27 Apr 2016 20:57:14 +0000 (UTC) Received: (qmail 7191 invoked by uid 99); 27 Apr 2016 20:57:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2016 20:57:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 204FF2C1F54 for ; Wed, 27 Apr 2016 20:57:13 +0000 (UTC) Date: Wed, 27 Apr 2016 20:57:13 +0000 (UTC) From: "Thomas D'Silva (JIRA)" To: dev@phoenix.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (PHOENIX-2795) Support auto partition for views MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PHOENIX-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas D'Silva updated PHOENIX-2795: ------------------------------------ Attachment: PHOENIX-2795-v2.patch [~jamestaylor] Thanks for the feedback. When there is no where clause there will be no VIEW_STATEMENT and I was not handling this correctly. I fixed this by always setting the view where if the auto partition attribute is true so we always generate a Put and never a Delete if the view where is null. On the server side the view statement cell gets set correctly. I also added a test for this. I don't need to remove existing VIEW_STATEMENT and VIEW_CONSTANT cells if I add the updated cells to the end of the list. I modified the code to use MetaDataUtil.getMutationValue() to look up the cell for VIEW_STATEMENT. The tableHeaderRow put is always the first put in the tableMetaData list (even of the table is multi-tenant). The autoPartitionColumn put is the 2nd or 3rd put (depending on if the table has a tenantId column or not). > Support auto partition for views > -------------------------------- > > Key: PHOENIX-2795 > URL: https://issues.apache.org/jira/browse/PHOENIX-2795 > Project: Phoenix > Issue Type: Sub-task > Reporter: James Taylor > Assignee: Thomas D'Silva > Labels: argus > Fix For: 4.8.0 > > Attachments: PHOENIX-2795-v2.patch, PHOENIX-2795.patch > > > When a view or base table is created, we should have an string AUTO_PARTITION_SEQ parameter on CREATE TABLE which uses a sequence based on the argument on the server side to generate a WHERE clause with the first PK column and the unique identifier from the sequence. > For example: > {code} > CREATE SEQUENCE metric_id_seq; > CREATE TABLE metric_table (metric_id INTEGER, val DOUBLE) AUTO_PARTITION_SEQ=metric_id_seq; > CREATE VIEW my_view1 AS SELECT * FROM base_table; > {code} > would tack on a WHERE clause base on the next value in a sequence, logically like this: > {code} > WHERE partition_id = NEXT VALUE FROM metric_id_seq > {code} > It's important that the sequence be generated *after* the check for the existence of the view so that we don't burn sequence values needlessly if the view already exists. -- This message was sent by Atlassian JIRA (v6.3.4#6332)