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 74204200B25 for ; Wed, 8 Jun 2016 15:21:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 72C33160A2E; Wed, 8 Jun 2016 13:21:07 +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 95BCB160A15 for ; Wed, 8 Jun 2016 15:21:06 +0200 (CEST) Received: (qmail 43444 invoked by uid 500); 8 Jun 2016 13:21:05 -0000 Mailing-List: contact commits-help@quickstep.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@quickstep.incubator.apache.org Delivered-To: mailing list commits@quickstep.incubator.apache.org Received: (qmail 43435 invoked by uid 99); 8 Jun 2016 13:21:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2016 13:21:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 67AF5C0340 for ; Wed, 8 Jun 2016 13:21:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, 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=-1.426] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id lWHciC5o8MO5 for ; Wed, 8 Jun 2016 13:21:04 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 4AB3E5FCF3 for ; Wed, 8 Jun 2016 13:21:02 +0000 (UTC) Received: (qmail 43227 invoked by uid 99); 8 Jun 2016 13:21:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2016 13:21:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1D3CEE38A4; Wed, 8 Jun 2016 13:21:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hbdeshmukh@apache.org To: commits@quickstep.incubator.apache.org Date: Wed, 08 Jun 2016 13:21:07 -0000 Message-Id: <286c0790766342b48d8a1780599fb949@git.apache.org> In-Reply-To: <5b3d64e7b97d480ebbff65f401847667@git.apache.org> References: <5b3d64e7b97d480ebbff65f401847667@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [07/50] [abbrv] incubator-quickstep git commit: Set block slots correctly. (#202) archived-at: Wed, 08 Jun 2016 13:21:07 -0000 Set block slots correctly. (#202) Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/abfc5f27 Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/abfc5f27 Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/abfc5f27 Branch: refs/heads/query-manager-used-in-foreman Commit: abfc5f275c500d40962dac70a60a4cd5881b77bc Parents: 5b75e8e Author: Zuyu ZHANG Authored: Fri Apr 29 12:01:19 2016 -0700 Committer: Jignesh Patel Committed: Fri Apr 29 12:01:19 2016 -0700 ---------------------------------------------------------------------- query_optimizer/resolver/Resolver.cpp | 13 +++++++++---- query_optimizer/tests/physical_generator/Create.test | 6 +++--- query_optimizer/tests/resolver/Create.test | 15 ++++++++++++--- storage/StorageConstants.hpp | 3 +-- 4 files changed, 25 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/abfc5f27/query_optimizer/resolver/Resolver.cpp ---------------------------------------------------------------------- diff --git a/query_optimizer/resolver/Resolver.cpp b/query_optimizer/resolver/Resolver.cpp index 45ecf33..2667ee9 100644 --- a/query_optimizer/resolver/Resolver.cpp +++ b/query_optimizer/resolver/Resolver.cpp @@ -602,16 +602,21 @@ StorageBlockLayoutDescription* Resolver::resolveBlockProperties( // Resolve the Block size (size -> # of slots). std::int64_t slots = kDefaultBlockSizeInSlots; if (block_properties->hasBlockSizeMb()) { - std::int64_t blocksizemb = block_properties->getBlockSizeMbValue(); - if (blocksizemb == -1) { + const std::int64_t block_size_in_mega_bytes = block_properties->getBlockSizeMbValue(); + if (block_size_in_mega_bytes == -1) { // Indicates an error condition if the property is present but getter returns -1. THROW_SQL_ERROR_AT(block_properties->getBlockSizeMb()) << "The BLOCKSIZEMB property must be an integer."; + } else if ((block_size_in_mega_bytes * kAMegaByte) % kSlotSizeBytes != 0) { + THROW_SQL_ERROR_AT(block_properties->getBlockSizeMb()) + << "The BLOCKSIZEMB property must be multiple times of " + << std::to_string(kSlotSizeBytes / kAMegaByte) << "MB."; } - slots = (blocksizemb * kAMegaByte) / kSlotSizeBytes; + + slots = (block_size_in_mega_bytes * kAMegaByte) / kSlotSizeBytes; DLOG(INFO) << "Resolver using BLOCKSIZEMB of " << slots << " slots" << " which is " << (slots * kSlotSizeBytes) << " bytes versus" - << " user requested " << (blocksizemb * kAMegaByte) << " bytes."; + << " user requested " << (block_size_in_mega_bytes * kAMegaByte) << " bytes."; const std::uint64_t max_size_slots = kBlockSizeUpperBoundBytes / kSlotSizeBytes; const std::uint64_t min_size_slots = kBlockSizeLowerBoundBytes / kSlotSizeBytes; if (static_cast(slots) < min_size_slots || http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/abfc5f27/query_optimizer/tests/physical_generator/Create.test ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/physical_generator/Create.test b/query_optimizer/tests/physical_generator/Create.test index 58e15fa..8e6c64b 100644 --- a/query_optimizer/tests/physical_generator/Create.test +++ b/query_optimizer/tests/physical_generator/Create.test @@ -1,5 +1,5 @@ # Copyright 2011-2015 Quickstep Technologies LLC. -# Copyright 2015 Pivotal Software, Inc. +# Copyright 2015-2016 Pivotal Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,8 +86,8 @@ TopLevelPlan +-AttributeReference[id=10,name=col11,relation=foo,type=Char(5) NULL] +-AttributeReference[id=11,name=col12,relation=foo,type=VarChar(5) NULL] == -CREATE TABLE foo (col1 INT) WITH BLOCKPROPERTIES - (TYPE compressed_columnstore, SORT col1, COMPRESS ALL, BLOCKSIZEMB 5); +CREATE TABLE foo (col1 INT) WITH BLOCKPROPERTIES + (TYPE compressed_columnstore, SORT col1, COMPRESS ALL, BLOCKSIZEMB 4); -- [Optimized Logical Plan] TopLevelPlan http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/abfc5f27/query_optimizer/tests/resolver/Create.test ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/resolver/Create.test b/query_optimizer/tests/resolver/Create.test index 18beacd..63f7ac9 100644 --- a/query_optimizer/tests/resolver/Create.test +++ b/query_optimizer/tests/resolver/Create.test @@ -1,5 +1,5 @@ # Copyright 2011-2015 Quickstep Technologies LLC. -# Copyright 2015 Pivotal Software, Inc. +# Copyright 2015-2016 Pivotal Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -123,7 +123,7 @@ BLOCKPROPERTIES (BLOCKSIZEMB 1... == # Rowstores cannot have a sorted attribute. -CREATE TABLE foo (attr INT) WITH BLOCKPROPERTIES +CREATE TABLE foo (attr INT) WITH BLOCKPROPERTIES (TYPE rowstore, SORT attr); -- ERROR: The SORT property does not apply to this block type. (2 : 22) @@ -167,7 +167,7 @@ ERROR: The COMPRESS property does not apply to this block type. (2 : 7) == # Compress property is required for compressed blocks. -CREATE TABLE foo (attr INT) WITH +CREATE TABLE foo (attr INT) WITH BLOCKPROPERTIES (TYPE compressed_rowstore); -- ERROR: The COMPRESS property must be specified as ALL or a list of attributes. (2 : 1) @@ -202,6 +202,15 @@ ERROR: The BLOCKSIZEMB property must be an integer. (2 : 17) ^ == +# BLOCKSIZEMB property must be multiple times of the slot size. +CREATE TABLE foo (attr INT) WITH BLOCKPROPERTIES +(TYPE rowstore, BLOCKSIZEMB 25); +-- +ERROR: The BLOCKSIZEMB property must be multiple times of 2MB. (2 : 17) +(TYPE rowstore, BLOCKSIZEMB 25); + ^ +== + # BLOCKSIZEMB must be greater than the minimum (defined in StorageConstants.hpp). CREATE TABLE foo (attr INT) WITH BLOCKPROPERTIES (TYPE rowstore, BLOCKSIZEMB 0); http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/abfc5f27/storage/StorageConstants.hpp ---------------------------------------------------------------------- diff --git a/storage/StorageConstants.hpp b/storage/StorageConstants.hpp index de54345..154d2f7 100644 --- a/storage/StorageConstants.hpp +++ b/storage/StorageConstants.hpp @@ -44,8 +44,7 @@ const std::uint64_t kAMegaByte = (1 << 20); // the SQL clause BLOCKPROPERTIES. const std::uint64_t kBlockSizeUpperBoundBytes = kAGigaByte; -// 2 Megabytes. -const std::uint64_t kBlockSizeLowerBoundBytes = kAMegaByte << 1; +const std::uint64_t kBlockSizeLowerBoundBytes = kSlotSizeBytes; // The default size of a new relation in terms of the number of slots. const std::uint64_t kDefaultBlockSizeInSlots = 1;