quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zu...@apache.org
Subject [01/24] incubator-quickstep git commit: Support, and tests for SMA index creation via parser.
Date Tue, 19 Apr 2016 16:44:14 GMT
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<quickstep::ParseSubqueryTableReference> *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]


Mime
View raw message