Return-Path: X-Original-To: apmail-quickstep-commits-archive@minotaur.apache.org Delivered-To: apmail-quickstep-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 21967193DF for ; Tue, 19 Apr 2016 16:44:20 +0000 (UTC) Received: (qmail 2106 invoked by uid 500); 19 Apr 2016 16:44:20 -0000 Delivered-To: apmail-quickstep-commits-archive@quickstep.apache.org Received: (qmail 2066 invoked by uid 500); 19 Apr 2016 16:44:20 -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 2050 invoked by uid 99); 19 Apr 2016 16:44:20 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Apr 2016 16:44:20 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 5ECC7C0D0D for ; Tue, 19 Apr 2016 16:44:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 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=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id MdDrWr5YWOBe for ; Tue, 19 Apr 2016 16:44:16 +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 AF9395F486 for ; Tue, 19 Apr 2016 16:44:15 +0000 (UTC) Received: (qmail 1526 invoked by uid 99); 19 Apr 2016 16:44:14 -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; Tue, 19 Apr 2016 16:44:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AFCCDDFE04; Tue, 19 Apr 2016 16:44:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zuyuz@apache.org To: commits@quickstep.incubator.apache.org Date: Tue, 19 Apr 2016 16:44:14 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [01/24] incubator-quickstep git commit: Support, and tests for SMA index creation via parser. Repository: incubator-quickstep Updated Branches: refs/heads/master 390a267a8 -> 2577cf72b http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/57e12d53/parser/preprocessed/SqlParser_gen.hpp ---------------------------------------------------------------------- diff --git a/parser/preprocessed/SqlParser_gen.hpp b/parser/preprocessed/SqlParser_gen.hpp index 26adf87..9447a22 100644 --- a/parser/preprocessed/SqlParser_gen.hpp +++ b/parser/preprocessed/SqlParser_gen.hpp @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -138,33 +138,34 @@ extern int quickstep_yydebug; TOKEN_ROW_DELIMITER = 348, TOKEN_SELECT = 349, TOKEN_SET = 350, - TOKEN_SMALLINT = 351, - TOKEN_TABLE = 352, - TOKEN_THEN = 353, - TOKEN_TIME = 354, - TOKEN_TIMESTAMP = 355, - TOKEN_TRUE = 356, - TOKEN_TUPLESAMPLE = 357, - TOKEN_UNIQUE = 358, - TOKEN_UPDATE = 359, - TOKEN_USING = 360, - TOKEN_VALUES = 361, - TOKEN_VARCHAR = 362, - TOKEN_WHEN = 363, - TOKEN_WHERE = 364, - TOKEN_WITH = 365, - TOKEN_YEARMONTH = 366, - TOKEN_EOF = 367, - TOKEN_LEX_ERROR = 368 + TOKEN_SMA = 351, + TOKEN_SMALLINT = 352, + TOKEN_TABLE = 353, + TOKEN_THEN = 354, + TOKEN_TIME = 355, + TOKEN_TIMESTAMP = 356, + TOKEN_TRUE = 357, + TOKEN_TUPLESAMPLE = 358, + TOKEN_UNIQUE = 359, + TOKEN_UPDATE = 360, + TOKEN_USING = 361, + TOKEN_VALUES = 362, + TOKEN_VARCHAR = 363, + TOKEN_WHEN = 364, + TOKEN_WHERE = 365, + TOKEN_WITH = 366, + TOKEN_YEARMONTH = 367, + TOKEN_EOF = 368, + TOKEN_LEX_ERROR = 369 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - +typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 116 "../SqlParser.ypp" /* yacc.c:1915 */ +#line 116 "../SqlParser.ypp" /* yacc.c:1909 */ quickstep::ParseString *string_value_; @@ -254,10 +255,8 @@ union YYSTYPE quickstep::PtrVector *with_list_; quickstep::ParseSubqueryTableReference *with_list_element_; -#line 258 "SqlParser_gen.hpp" /* yacc.c:1915 */ +#line 259 "SqlParser_gen.hpp" /* yacc.c:1909 */ }; - -typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/57e12d53/parser/tests/Index.test ---------------------------------------------------------------------- diff --git a/parser/tests/Index.test b/parser/tests/Index.test index 09525f6..b5184bd 100644 --- a/parser/tests/Index.test +++ b/parser/tests/Index.test @@ -37,8 +37,8 @@ CREATE INDEX test ON test ^ == -# Currently supported indices (csbtree, bloomfilter) -# Unsupported indices should result in syntax error +# Currently supported indices are csbtree, bloomfilter, and sma. +# Unsupported indices should result in syntax error. CREATE INDEX test ON test USING arbitrary -- ERROR: syntax error (1 : 33) @@ -47,9 +47,7 @@ CREATE INDEX test ON test USING arbitrary == CREATE INDEX smaIndex ON test USING SMA -- -ERROR: syntax error (1 : 37) -CREATE INDEX smaIndex ON test USING SMA - ^ +CreateIndexStatement[index_name=smaIndex,relation_name=test,index_type=sma] == CREATE INDEX bloomIndex ON test USING BLOOMFILTER -- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/57e12d53/query_optimizer/tests/execution_generator/Index.test ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/execution_generator/Index.test b/query_optimizer/tests/execution_generator/Index.test index 2dd71f4..749afcb 100644 --- a/query_optimizer/tests/execution_generator/Index.test +++ b/query_optimizer/tests/execution_generator/Index.test @@ -53,9 +53,28 @@ SELECT * FROM foo3; +-----------+-----------+ +-----------+-----------+ == -# SMA Index creation is not supported using CREATE INDEX. -CREATE INDEX smaIndex ON test USING SMA +# Specifying no columns will index all the columns. +# Calling INSERT will force creation of the block. +CREATE TABLE smaTable1 (int_attr int, str_attr VARCHAR(20)); +CREATE INDEX smaIndex ON smaTable1 USING SMA; +INSERT INTO smaTable1 VALUES (1, 'val1'); +SELECT COUNT(*) FROM smaTable1; -- -ERROR: syntax error (1 : 37) -CREATE INDEX smaIndex ON test USING SMA - ^ ++--------------------+ +|COUNT(*) | ++--------------------+ +| 1| ++--------------------+ +== +# SMA can also specify an index on selected columns. +# Calling INSERT will force creation of the block. +CREATE TABLE smaTable2 (int_attr int, str_attr VARCHAR(20)); +CREATE INDEX smaIndex2 ON smaTable2(int_attr) USING SMA; +INSERT INTO smaTable2 VALUES (1, 'val1'); +SELECT COUNT(*) FROM smaTable2; +-- ++--------------------+ +|COUNT(*) | ++--------------------+ +| 1| ++--------------------+ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/57e12d53/query_optimizer/tests/logical_generator/Index.test ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/logical_generator/Index.test b/query_optimizer/tests/logical_generator/Index.test index 5a38567..bbab354 100644 --- a/query_optimizer/tests/logical_generator/Index.test +++ b/query_optimizer/tests/logical_generator/Index.test @@ -52,10 +52,30 @@ TopLevelPlan +-output_attributes= +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] == - -# SMA Index creation is not supported using CREATE INDEX CREATE INDEX smaIndex ON test USING SMA -- -ERROR: syntax error (1 : 37) -CREATE INDEX smaIndex ON test USING SMA - ^ +TopLevelPlan ++-plan=CreateIndex[index_name=smaIndex, +| serialized_index_description=sub_block_type: SMA +] +| +-relation=TableReference[relation_name=Test,relation_alias=test] +| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] +| | +-AttributeReference[id=1,name=long_col,relation=test,type=Long] +| | +-AttributeReference[id=2,name=float_col,relation=test,type=Float] +| | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] +| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] +| | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] +| +-index_attributes= +| +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] +| +-AttributeReference[id=1,name=long_col,relation=test,type=Long] +| +-AttributeReference[id=2,name=float_col,relation=test,type=Float] +| +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] +| +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] +| +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] ++-output_attributes= + +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] + +-AttributeReference[id=1,name=long_col,relation=test,type=Long] + +-AttributeReference[id=2,name=float_col,relation=test,type=Float] + +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] + +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] + +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/57e12d53/query_optimizer/tests/physical_generator/Index.test ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/physical_generator/Index.test b/query_optimizer/tests/physical_generator/Index.test index 59f514d..2ef989a 100644 --- a/query_optimizer/tests/physical_generator/Index.test +++ b/query_optimizer/tests/physical_generator/Index.test @@ -86,10 +86,57 @@ TopLevelPlan +-output_attributes= +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] == - -# SMA Index creation is not supported using CREATE INDEX CREATE INDEX smaIndex ON test USING SMA -- -ERROR: syntax error (1 : 37) -CREATE INDEX smaIndex ON test USING SMA - ^ +[Optimized Logical Plan] +TopLevelPlan ++-plan=CreateIndex[index_name=smaIndex, +| serialized_index_description=sub_block_type: SMA +] +| +-relation=TableReference[relation_name=Test,relation_alias=test] +| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] +| | +-AttributeReference[id=1,name=long_col,relation=test,type=Long] +| | +-AttributeReference[id=2,name=float_col,relation=test,type=Float] +| | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] +| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] +| | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] +| +-index_attributes= +| +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] +| +-AttributeReference[id=1,name=long_col,relation=test,type=Long] +| +-AttributeReference[id=2,name=float_col,relation=test,type=Float] +| +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] +| +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] +| +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] ++-output_attributes= + +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] + +-AttributeReference[id=1,name=long_col,relation=test,type=Long] + +-AttributeReference[id=2,name=float_col,relation=test,type=Float] + +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] + +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] + +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] +[Physical Plan] +TopLevelPlan ++-plan=CreateIndex[index_name=smaIndex, +| serialized_index_description=sub_block_type: SMA +] +| +-relation=TableReference[relation=Test,alias=test] +| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] +| | +-AttributeReference[id=1,name=long_col,relation=test,type=Long] +| | +-AttributeReference[id=2,name=float_col,relation=test,type=Float] +| | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] +| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] +| | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] +| +-index_attributes= +| +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] +| +-AttributeReference[id=1,name=long_col,relation=test,type=Long] +| +-AttributeReference[id=2,name=float_col,relation=test,type=Float] +| +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] +| +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] +| +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] ++-output_attributes= + +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] + +-AttributeReference[id=1,name=long_col,relation=test,type=Long] + +-AttributeReference[id=2,name=float_col,relation=test,type=Float] + +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] + +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] + +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/57e12d53/query_optimizer/tests/resolver/Index.test ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/resolver/Index.test b/query_optimizer/tests/resolver/Index.test index 869f1e3..1164172 100644 --- a/query_optimizer/tests/resolver/Index.test +++ b/query_optimizer/tests/resolver/Index.test @@ -99,10 +99,30 @@ ERROR: syntax error (1 : 40) CREATE INDEX randomIndex ON test USING RANDOM; ^ == - -# SMA Index creation is not supported using CREATE INDEX CREATE INDEX smaIndex ON test USING SMA -- -ERROR: syntax error (1 : 37) -CREATE INDEX smaIndex ON test USING SMA - ^ +TopLevelPlan ++-plan=CreateIndex[index_name=smaIndex, +| serialized_index_description=sub_block_type: SMA +] +| +-relation=TableReference[relation_name=Test,relation_alias=test] +| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] +| | +-AttributeReference[id=1,name=long_col,relation=test,type=Long] +| | +-AttributeReference[id=2,name=float_col,relation=test,type=Float] +| | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] +| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] +| | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] +| +-index_attributes= +| +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] +| +-AttributeReference[id=1,name=long_col,relation=test,type=Long] +| +-AttributeReference[id=2,name=float_col,relation=test,type=Float] +| +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] +| +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] +| +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] ++-output_attributes= + +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] + +-AttributeReference[id=1,name=long_col,relation=test,type=Long] + +-AttributeReference[id=2,name=float_col,relation=test,type=Float] + +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] + +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] + +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL]