http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/preprocessed/SqlParser_gen.hpp ---------------------------------------------------------------------- diff --git a/parser/preprocessed/SqlParser_gen.hpp b/parser/preprocessed/SqlParser_gen.hpp deleted file mode 100644 index fe963be..0000000 --- a/parser/preprocessed/SqlParser_gen.hpp +++ /dev/null @@ -1,311 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison interface for Yacc-like parsers in C - - 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED -# define YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int quickstep_yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - TOKEN_COMMAND = 258, - TOKEN_NAME = 259, - TOKEN_STRING_SINGLE_QUOTED = 260, - TOKEN_STRING_DOUBLE_QUOTED = 261, - TOKEN_UNSIGNED_NUMVAL = 262, - TOKEN_OR = 263, - TOKEN_AND = 264, - TOKEN_NOT = 265, - TOKEN_EQ = 266, - TOKEN_LT = 267, - TOKEN_LEQ = 268, - TOKEN_GT = 269, - TOKEN_GEQ = 270, - TOKEN_NEQ = 271, - TOKEN_LIKE = 272, - TOKEN_REGEXP = 273, - TOKEN_BETWEEN = 274, - TOKEN_IS = 275, - UNARY_PLUS = 276, - UNARY_MINUS = 277, - TOKEN_ADD = 278, - TOKEN_ALL = 279, - TOKEN_ALTER = 280, - TOKEN_AS = 281, - TOKEN_ASC = 282, - TOKEN_BIGINT = 283, - TOKEN_BIT = 284, - TOKEN_BITWEAVING = 285, - TOKEN_BLOCKPROPERTIES = 286, - TOKEN_BLOCKSAMPLE = 287, - TOKEN_BLOOM_FILTER = 288, - TOKEN_CSB_TREE = 289, - TOKEN_BY = 290, - TOKEN_CASE = 291, - TOKEN_CHARACTER = 292, - TOKEN_CHECK = 293, - TOKEN_COLUMN = 294, - TOKEN_CONSTRAINT = 295, - TOKEN_COPY = 296, - TOKEN_CREATE = 297, - TOKEN_CURRENT = 298, - TOKEN_DATE = 299, - TOKEN_DATETIME = 300, - TOKEN_DAY = 301, - TOKEN_DECIMAL = 302, - TOKEN_DEFAULT = 303, - TOKEN_DELETE = 304, - TOKEN_DELIMITER = 305, - TOKEN_DESC = 306, - TOKEN_DISTINCT = 307, - TOKEN_DOUBLE = 308, - TOKEN_DROP = 309, - TOKEN_ELSE = 310, - TOKEN_END = 311, - TOKEN_ESCAPE_STRINGS = 312, - TOKEN_EXISTS = 313, - TOKEN_EXTRACT = 314, - TOKEN_FALSE = 315, - TOKEN_FIRST = 316, - TOKEN_FLOAT = 317, - TOKEN_FOLLOWING = 318, - TOKEN_FOR = 319, - TOKEN_FOREIGN = 320, - TOKEN_FROM = 321, - TOKEN_FULL = 322, - TOKEN_GROUP = 323, - TOKEN_HASH = 324, - TOKEN_HAVING = 325, - TOKEN_HOUR = 326, - TOKEN_IN = 327, - TOKEN_INDEX = 328, - TOKEN_INNER = 329, - TOKEN_INSERT = 330, - TOKEN_INTEGER = 331, - TOKEN_INTERVAL = 332, - TOKEN_INTO = 333, - TOKEN_JOIN = 334, - TOKEN_KEY = 335, - TOKEN_LAST = 336, - TOKEN_LEFT = 337, - TOKEN_LIMIT = 338, - TOKEN_LONG = 339, - TOKEN_MINUTE = 340, - TOKEN_MONTH = 341, - TOKEN_NULL = 342, - TOKEN_NULLS = 343, - TOKEN_OFF = 344, - TOKEN_ON = 345, - TOKEN_ORDER = 346, - TOKEN_OUTER = 347, - TOKEN_OVER = 348, - TOKEN_PARTITION = 349, - TOKEN_PARTITIONS = 350, - TOKEN_PERCENT = 351, - TOKEN_PRECEDING = 352, - TOKEN_PRIMARY = 353, - TOKEN_PRIORITY = 354, - TOKEN_QUIT = 355, - TOKEN_RANGE = 356, - TOKEN_REAL = 357, - TOKEN_REFERENCES = 358, - TOKEN_RIGHT = 359, - TOKEN_ROW = 360, - TOKEN_ROW_DELIMITER = 361, - TOKEN_ROWS = 362, - TOKEN_SECOND = 363, - TOKEN_SELECT = 364, - TOKEN_SET = 365, - TOKEN_SMA = 366, - TOKEN_SMALLINT = 367, - TOKEN_SUBSTRING = 368, - TOKEN_TABLE = 369, - TOKEN_THEN = 370, - TOKEN_TIME = 371, - TOKEN_TIMESTAMP = 372, - TOKEN_TRUE = 373, - TOKEN_TUPLESAMPLE = 374, - TOKEN_UNBOUNDED = 375, - TOKEN_UNIQUE = 376, - TOKEN_UPDATE = 377, - TOKEN_USING = 378, - TOKEN_VALUES = 379, - TOKEN_VARCHAR = 380, - TOKEN_WHEN = 381, - TOKEN_WHERE = 382, - TOKEN_WINDOW = 383, - TOKEN_WITH = 384, - TOKEN_YEAR = 385, - TOKEN_YEARMONTH = 386, - TOKEN_EOF = 387, - TOKEN_LEX_ERROR = 388 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 120 "../SqlParser.ypp" /* yacc.c:1909 */ - - quickstep::ParseString *string_value_; - - quickstep::PtrList<quickstep::ParseString> *string_list_; - - bool boolean_value_; - - quickstep::NumericParseLiteralValue *numeric_literal_value_; - quickstep::ParseLiteralValue *literal_value_; - quickstep::PtrList<quickstep::ParseScalarLiteral> *literal_value_list_; - - quickstep::ParseExpression *expression_; - - quickstep::ParseScalarLiteral *scalar_literal_; - quickstep::ParseAttribute *attribute_; - quickstep::PtrList<quickstep::ParseAttribute> *attribute_list_; - - quickstep::ParsePredicate *predicate_; - - quickstep::ParseSubqueryExpression *subquery_expression_; - - quickstep::PtrVector<quickstep::ParseSimpleWhenClause> *simple_when_clause_list_; - quickstep::ParseSimpleWhenClause *simple_when_clause_; - - quickstep::PtrVector<quickstep::ParseSearchedWhenClause> *searched_when_clause_list_; - quickstep::ParseSearchedWhenClause *searched_when_clause_; - - quickstep::ParseSelectionClause *selection_; - quickstep::ParseSelectionItem *selection_item_; - quickstep::ParseSelectionList *selection_list_; - - quickstep::ParseTableReference *table_reference_; - quickstep::PtrList<quickstep::ParseTableReference> *table_reference_list_; - quickstep::ParseTableReferenceSignature *table_reference_signature_; - - quickstep::ParseJoinedTableReference::JoinType join_type_; - - quickstep::ParseDataType *data_type_; - quickstep::ParseAttributeDefinition *attribute_definition_; - quickstep::ParseColumnConstraint *column_constraint_; - quickstep::PtrList<quickstep::ParseColumnConstraint> *column_constraint_list_; - quickstep::PtrList<quickstep::ParseAttributeDefinition> *attribute_definition_list_; - - quickstep::ParseKeyValue *key_value_; - quickstep::PtrList<quickstep::ParseKeyValue> *key_value_list_; - quickstep::ParseKeyStringValue *key_string_value_; - quickstep::ParseKeyStringList *key_string_list_; - quickstep::ParseKeyIntegerValue *key_integer_value_; - - quickstep::ParseCopyFromParams *copy_from_params_; - - quickstep::ParseAssignment *assignment_; - quickstep::PtrList<quickstep::ParseAssignment> *assignment_list_; - - quickstep::ParseCommand *command_; - quickstep::PtrVector<quickstep::ParseString> *command_argument_list_; - - quickstep::ParseStatement *statement_; - quickstep::ParseStatementSelect *select_statement_; - quickstep::ParseStatementUpdate *update_statement_; - quickstep::ParseStatementInsert *insert_statement_; - quickstep::ParseStatementDelete *delete_statement_; - quickstep::ParseStatementCopyFrom *copy_from_statement_; - quickstep::ParseStatementCreateTable *create_table_statement_; - quickstep::ParsePartitionClause *partition_clause_; - quickstep::ParseBlockProperties *block_properties_; - quickstep::ParseStatementDropTable *drop_table_statement_; - quickstep::ParseStatementQuit *quit_statement_; - - const quickstep::Comparison *comparison_; - const quickstep::UnaryOperation *unary_operation_; - const quickstep::BinaryOperation *binary_operation_; - - quickstep::ParseFunctionCall *function_call_; - quickstep::PtrList<quickstep::ParseExpression> *expression_list_; - - quickstep::ParseSelect *select_query_; - quickstep::ParseGroupBy *opt_group_by_clause_; - quickstep::ParseHaving *opt_having_clause_; - quickstep::ParseOrderBy *opt_order_by_clause_; - bool *order_direction_; - quickstep::ParseLimit *opt_limit_clause_; - - quickstep::ParseSample *opt_sample_clause_; - - quickstep::PtrList<quickstep::ParseWindow> *opt_window_clause_; - quickstep::ParseWindow *window_definition_; - quickstep::PtrList<quickstep::ParseExpression> *window_partition_by_list_; - quickstep::PtrList<quickstep::ParseOrderByItem> *window_order_by_list_; - quickstep::ParseFrameInfo *window_frame_info_; - - quickstep::PtrList<quickstep::ParseOrderByItem> *order_commalist_; - quickstep::ParseOrderByItem *order_item_; - - quickstep::PtrVector<quickstep::ParseSubqueryTableReference> *with_list_; - quickstep::ParseSubqueryTableReference *with_list_element_; - - quickstep::ParsePriority *opt_priority_clause_; - -#line 288 "SqlParser_gen.hpp" /* yacc.c:1909 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - -/* Location type. */ -#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE YYLTYPE; -struct YYLTYPE -{ - int first_line; - int first_column; - int last_line; - int last_column; -}; -# define YYLTYPE_IS_DECLARED 1 -# define YYLTYPE_IS_TRIVIAL 1 -#endif - - - -int quickstep_yyparse (yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement); - -#endif /* !YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/preprocessed/genfiles.sh ---------------------------------------------------------------------- diff --git a/parser/preprocessed/genfiles.sh b/parser/preprocessed/genfiles.sh deleted file mode 100755 index f497494..0000000 --- a/parser/preprocessed/genfiles.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -flex -i -I --header-file=SqlLexer_gen.hpp -oSqlLexer_gen.cpp ../SqlLexer.lpp -bison -d -o SqlParser_gen.cpp ../SqlParser.ypp http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Aggregate.test ---------------------------------------------------------------------- diff --git a/parser/tests/Aggregate.test b/parser/tests/Aggregate.test deleted file mode 100644 index e7b8945..0000000 --- a/parser/tests/Aggregate.test +++ /dev/null @@ -1,220 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -SELECT AGG(*), AGG(), AGG(a, b, c) FROM test --- -SelectStatement -+-select_query=Select - +-select_clause=SelectList - | +-SelectListItem - | | +-FunctionCall[name=AGG,is_star=true] - | +-SelectListItem - | | +-FunctionCall[name=AGG] - | +-SelectListItem - | +-FunctionCall[name=AGG] - | +-AttributeReference[attribute_name=a] - | +-AttributeReference[attribute_name=b] - | +-AttributeReference[attribute_name=c] - +-from_clause= - +-TableReference[table=test] -== - -SELECT AGG()+1, AGG()*2+1+AGG(a, b)/AGG(c, d) FROM test --- -SelectStatement -+-select_query=Select - +-select_clause=SelectList - | +-SelectListItem - | | +-Add - | | +-left_operand=FunctionCall[name=AGG] - | | +-right_operand=Literal - | | +-NumericLiteral[numeric_string=1,float_like=false] - | +-SelectListItem - | +-Add - | +-left_operand=Add - | | +-left_operand=Multiply - | | | +-left_operand=FunctionCall[name=AGG] - | | | +-right_operand=Literal - | | | +-NumericLiteral[numeric_string=2,float_like=false] - | | +-right_operand=Literal - | | +-NumericLiteral[numeric_string=1,float_like=false] - | +-right_operand=Divide - | +-left_operand=FunctionCall[name=AGG] - | | +-AttributeReference[attribute_name=a] - | | +-AttributeReference[attribute_name=b] - | +-right_operand=FunctionCall[name=AGG] - | +-AttributeReference[attribute_name=c] - | +-AttributeReference[attribute_name=d] - +-from_clause= - +-TableReference[table=test] -== - -# Function calls as arguments of another function calls. -# This is just for testing purpose. If agg is an aggregation, -# the query is not valid. The query resolver will capture the error. -SELECT AGG(AGG(AGG()+1)*2, AGG(*)/2.0) FROM test --- -SelectStatement -+-select_query=Select - +-select_clause=SelectList - | +-SelectListItem - | +-FunctionCall[name=AGG] - | +-Multiply - | | +-left_operand=FunctionCall[name=AGG] - | | | +-Add - | | | +-left_operand=FunctionCall[name=AGG] - | | | +-right_operand=Literal - | | | +-NumericLiteral[numeric_string=1,float_like=false] - | | +-right_operand=Literal - | | +-NumericLiteral[numeric_string=2,float_like=false] - | +-Divide - | +-left_operand=FunctionCall[name=AGG,is_star=true] - | +-right_operand=Literal - | +-NumericLiteral[numeric_string=2.0,float_like=true] - +-from_clause= - +-TableReference[table=test] -== - -SELECT AGG(*, a) FROM test --- -ERROR: syntax error (1 : 13) -SELECT AGG(*, a) FROM test - ^ -== - -SELECT AGG()+1 FROM test GROUP BY a+1, AGG()+1 HAVING AGG()*2>1 --- -SelectStatement -+-select_query=Select - +-select_clause=SelectList - | +-SelectListItem - | +-Add - | +-left_operand=FunctionCall[name=AGG] - | +-right_operand=Literal - | +-NumericLiteral[numeric_string=1,float_like=false] - +-group_by=GroupBy - | +-Add - | | +-left_operand=AttributeReference[attribute_name=a] - | | +-right_operand=Literal - | | +-NumericLiteral[numeric_string=1,float_like=false] - | +-Add - | +-left_operand=FunctionCall[name=AGG] - | +-right_operand=Literal - | +-NumericLiteral[numeric_string=1,float_like=false] - +-having=HAVING - | +-Greater - | +-left_operand=Multiply - | | +-left_operand=FunctionCall[name=AGG] - | | +-right_operand=Literal - | | +-NumericLiteral[numeric_string=2,float_like=false] - | +-right_operand=Literal - | +-NumericLiteral[numeric_string=1,float_like=false] - +-from_clause= - +-TableReference[table=test] -== - -SELECT 1 FROM test HAVING AGG() > 1 AND 1=1 --- -SelectStatement -+-select_query=Select - +-select_clause=SelectList - | +-SelectListItem - | +-Literal - | +-NumericLiteral[numeric_string=1,float_like=false] - +-having=HAVING - | +-And - | +-Greater - | | +-left_operand=FunctionCall[name=AGG] - | | +-right_operand=Literal - | | +-NumericLiteral[numeric_string=1,float_like=false] - | +-Equal - | +-left_operand=Literal - | | +-NumericLiteral[numeric_string=1,float_like=false] - | +-right_operand=Literal - | +-NumericLiteral[numeric_string=1,float_like=false] - +-from_clause= - +-TableReference[table=test] -== - -SELECT 1 FROM test GROUP BY AGG()+1, AGG()/AGG() --- -SelectStatement -+-select_query=Select - +-select_clause=SelectList - | +-SelectListItem - | +-Literal - | +-NumericLiteral[numeric_string=1,float_like=false] - +-group_by=GroupBy - | +-Add - | | +-left_operand=FunctionCall[name=AGG] - | | +-right_operand=Literal - | | +-NumericLiteral[numeric_string=1,float_like=false] - | +-Divide - | +-left_operand=FunctionCall[name=AGG] - | +-right_operand=FunctionCall[name=AGG] - +-from_clause= - +-TableReference[table=test] -== - -SELECT AGG(DISTINCT x), AGG(y) FROM test GROUP BY z --- -SelectStatement -+-select_query=Select - +-select_clause=SelectList - | +-SelectListItem - | | +-FunctionCall[name=AGG,is_distinct=true] - | | +-AttributeReference[attribute_name=x] - | +-SelectListItem - | +-FunctionCall[name=AGG] - | +-AttributeReference[attribute_name=y] - +-group_by=GroupBy - | +-AttributeReference[attribute_name=z] - +-from_clause= - +-TableReference[table=test] -== - -SELECT AGG(DISTINCT FUN(x) + y) * AGG(z) -FROM test -GROUP BY z -HAVING AGG(DISTINCT w) + AGG(s) > 1 --- -SelectStatement -+-select_query=Select - +-select_clause=SelectList - | +-SelectListItem - | +-Multiply - | +-left_operand=FunctionCall[name=AGG,is_distinct=true] - | | +-Add - | | +-left_operand=FunctionCall[name=FUN] - | | | +-AttributeReference[attribute_name=x] - | | +-right_operand=AttributeReference[attribute_name=y] - | +-right_operand=FunctionCall[name=AGG] - | +-AttributeReference[attribute_name=z] - +-group_by=GroupBy - | +-AttributeReference[attribute_name=z] - +-having=HAVING - | +-Greater - | +-left_operand=Add - | | +-left_operand=FunctionCall[name=AGG,is_distinct=true] - | | | +-AttributeReference[attribute_name=w] - | | +-right_operand=FunctionCall[name=AGG] - | | +-AttributeReference[attribute_name=s] - | +-right_operand=Literal - | +-NumericLiteral[numeric_string=1,float_like=false] - +-from_clause= - +-TableReference[table=test] -== http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Alter.test ---------------------------------------------------------------------- diff --git a/parser/tests/Alter.test b/parser/tests/Alter.test deleted file mode 100644 index f050284..0000000 --- a/parser/tests/Alter.test +++ /dev/null @@ -1,53 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -ALTER TABLE test -ADD attr INT --- -ERROR: syntax error (2 : 5) -ADD attr INT - ^ -== - -ALTER TABLE test -ADD COLUMN attr INT --- -ERROR: ALTER statements is not supported yet (1 : 1) -ALTER TABLE test -^ -== - -ALTER TABLE test -DROP COLUMN attr INT --- -[same as above] -== - -ALTER TABLE test -ADD CONSTRAINT UNIQUE(attr) --- -ERROR: Table Constraints (UNIQUE) is not supported yet (2 : 16) -ADD CONSTRAINT UNIQUE(attr) - ^ -== - -ALTER TABLE test -DROP CONSTRAINT constraint0 --- -ERROR: ALTER statements is not supported yet (1 : 1) -ALTER TABLE test -^ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/parser/tests/CMakeLists.txt b/parser/tests/CMakeLists.txt deleted file mode 100644 index 9b461ec..0000000 --- a/parser/tests/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -add_executable(quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/ParserTest.cpp" - "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.cpp" - "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp") - -target_link_libraries(quickstep_parser_tests_ParserTest - glog - gtest - gtest_main - quickstep_parser - quickstep_utility_Macros - quickstep_utility_TextBasedTestDriver) - -add_test(quickstep_parser_tests_ParserTest_aggregate - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Aggregate.test" - "${CMAKE_CURRENT_BINARY_DIR}/Aggregate.test") -add_test(quickstep_parser_tests_ParserTest_alter - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Alter.test" - "${CMAKE_CURRENT_BINARY_DIR}/Alter.test") -add_test(quickstep_parser_tests_ParserTest_copy - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Copy.test" - "${CMAKE_CURRENT_BINARY_DIR}/Copy.test") -add_test(quickstep_parser_tests_ParserTest_create - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Create.test" - "${CMAKE_CURRENT_BINARY_DIR}/Create.test") -add_test(quickstep_parser_tests_ParserTest_delete - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Delete.test" - "${CMAKE_CURRENT_BINARY_DIR}/Delete.test") -add_test(quickstep_parser_tests_ParserTest_drop - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Drop.test" - "${CMAKE_CURRENT_BINARY_DIR}/Drop.test") -add_test(quickstep_parser_tests_ParserTest_index - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Index.test" - "${CMAKE_CURRENT_BINARY_DIR}/Index.test") -add_test(quickstep_parser_tests_ParserTest_insert - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Insert.test" - "${CMAKE_CURRENT_BINARY_DIR}/Insert.test") -add_test(quickstep_parser_tests_ParserTest_join - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Join.test" - "${CMAKE_CURRENT_BINARY_DIR}/Join.test") -add_test(quickstep_parser_tests_ParserTest_select - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Select.test" - "${CMAKE_CURRENT_BINARY_DIR}/Select.test") -add_test(quickstep_parser_tests_ParserTest_tpch - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/TPCH.test" - "${CMAKE_CURRENT_BINARY_DIR}/TPCH.test") -add_test(quickstep_parser_tests_ParserTest_update - quickstep_parser_tests_ParserTest - "${CMAKE_CURRENT_SOURCE_DIR}/Update.test" - "${CMAKE_CURRENT_BINARY_DIR}/Update.test") http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Copy.test ---------------------------------------------------------------------- diff --git a/parser/tests/Copy.test b/parser/tests/Copy.test deleted file mode 100644 index dccaa82..0000000 --- a/parser/tests/Copy.test +++ /dev/null @@ -1,57 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -COPY test FROM 'test.txt' WITH () --- -ERROR: syntax error (1 : 33) -COPY test FROM 'test.txt' WITH () - ^ -== - -COPY test FROM 'test.txt' --- -CopyFromStatement[relation_name=test,source_file=test.txt] -== - -COPY test FROM 'test.txt' WITH (DELIMITER 'd', ESCAPE_STRINGS FALSE) --- -CopyFromStatement[relation_name=test,source_file=test.txt] -+-params=CopyFromParams[delimiter=d,escape_string=false] -== - -COPY test FROM 'test.txt' WITH (DELIMITER '123', ESCAPE_STRINGS FALSE) --- -CopyFromStatement[relation_name=test,source_file=test.txt] -+-params=CopyFromParams[delimiter=123,escape_string=false] -== - -COPY test FROM 'test.txt' WITH (DELIMITER e'\t') --- -CopyFromStatement[relation_name=test,source_file=test.txt] -+-params=CopyFromParams[delimiter= ,escape_string=true] -== - -COPY test FROM 'test.txt' WITH (ESCAPE_STRINGS FALSE, DELIMITER 'd') --- -CopyFromStatement[relation_name=test,source_file=test.txt] -+-params=CopyFromParams[delimiter=d,escape_string=false] -== - -COPY test FROM 'test.txt' WITH (DELIMITER '1', ESCAPE_STRINGS FALSE, DELIMITER '2', ESCAPE_STRINGS TRUE) --- -CopyFromStatement[relation_name=test,source_file=test.txt] -+-params=CopyFromParams[delimiter=2,escape_string=true] http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Create.test ---------------------------------------------------------------------- diff --git a/parser/tests/Create.test b/parser/tests/Create.test deleted file mode 100644 index 49e7ccd..0000000 --- a/parser/tests/Create.test +++ /dev/null @@ -1,270 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -CREATE TABLE TABLE (attr int) --- -ERROR: syntax error (1 : 14) -CREATE TABLE TABLE (attr int) - ^ -== - -# We do not allow an empty-column table. -CREATE TABLE test () --- -ERROR: syntax error (1 : 20) -CREATE TABLE test () - ^ -== - -CREATE TABLE test (attr1 INT, attr2 FLOAT, attr3 DOUBLE, attr4 CHAR(5), attr5 VARCHAR(4)) --- -CreateTableStatement[relation_name=test] -+-attribute_list= - +-AttributeDefinition[name=attr1,type=Int] - +-AttributeDefinition[name=attr2,type=Float] - +-AttributeDefinition[name=attr3,type=Double] - +-AttributeDefinition[name=attr4,type=Char(5)] - +-AttributeDefinition[name=attr5,type=VarChar(4)] -== - -CREATE TABLE test (attr CHAR(-1)) --- -ERROR: syntax error (1 : 30) -CREATE TABLE test (attr CHAR(-1)) - ^ -== - -# Zero-length char type is not allowed. -CREATE TABLE test (attr CHAR(0)) --- -ERROR: Length for CHAR type must be at least 1 (1 : 30) -CREATE TABLE test (attr CHAR(0)) - ^ -== - -CREATE TABLE test(attr CHAR(1+1)) --- -ERROR: syntax error (1 : 30) -CREATE TABLE test(attr CHAR(1+1)) - ^ -== - -CREATE TABLE test (attr UNKNOWN_TYPE) --- -ERROR: syntax error (1 : 25) -CREATE TABLE test (attr UNKNOWN_TYPE) - ^ -== - -CREATE TABLE test (attr INT NULL, attr FLOAT NOT NULL) --- -CreateTableStatement[relation_name=test] -+-attribute_list= - +-AttributeDefinition[name=attr,type=Int NULL] - +-AttributeDefinition[name=attr,type=Float] -== - -CREATE TABLE test (attr INT UNIQUE) --- -ERROR: Column Constraints (UNIQUE) is not supported yet (1 : 29) -CREATE TABLE test (attr INT UNIQUE) - ^ -== - -CREATE TABLE test (attr INT PRIMARY KEY) --- -ERROR: Column Constraints (PRIMARY KEY) is not supported yet (1 : 29) -CREATE TABLE test (attr INT PRIMARY KEY) - ^ -== - -CREATE TABLE test (attr INT DEFAULT 4) --- -ERROR: Column Constraints (DEFAULT) is not supported yet (1 : 29) -CREATE TABLE test (attr INT DEFAULT 4) - ^ -== - -CREATE TABLE test (attr INT CHECK(attr>5)) --- -ERROR: Column Constraints (CHECK) is not supported yet (1 : 29) -CREATE TABLE test (attr INT CHECK(attr>5)) - ^ -== - -CREATE TABLE test (attr INT REFERENCES test2(attr2)) --- -ERROR: Foreign Keys is not supported yet (1 : 29) -CREATE TABLE test (attr INT REFERENCES test2(attr2)) - ^ -== - -CREATE TABLE test (attr INT) UNIQUE(attr) --- -ERROR: Table Constraints (UNIQUE) is not supported yet (1 : 30) -CREATE TABLE test (attr INT) UNIQUE(attr) - ^ -== - -CREATE TABLE test (attr INT) PRIMARY KEY(attr) --- -ERROR: Table Constraints (PRIMARY KEY) is not supported yet (1 : 30) -CREATE TABLE test (attr INT) PRIMARY KEY(attr) - ^ -== - -CREATE TABLE test (attr INT) FOREIGN KEY(attr) --- -ERROR: syntax error (1 : 47) -... TABLE test (attr INT) FOREIGN KEY(attr) - ^ -== - -CREATE TABLE test (attr INT) CHECK(attr>0) --- -ERROR: Table Constraints (CHECK) is not supported yet (1 : 30) -CREATE TABLE test (attr INT) CHECK(attr>0) - ^ -== - -CREATE TABLE test (attr INT) PARTITION BY HASH(attr) PARTITIONS 4 --- -CreateTableStatement[relation_name=test] -+-attribute_list= -| +-AttributeDefinition[name=attr,type=Int] -+-partition_clause= - +-PartitionClause[partition_type=0] - +-Number of Partitions=NumericLiteral[numeric_string=4,float_like=false] - +-attribute_name_list= - +-String[value=attr] -== - -# Empty partitioning attribute is not allowed -CREATE TABLE test (attr INT) PARTITION BY HASH() PARTITIONS 4 --- -ERROR: syntax error (1 : 48) -...TABLE test (attr INT) PARTITION BY HASH() PARTITIONS 4 - ^ -== - -# Zero partitions not allowed -CREATE TABLE test (attr INT) PARTITION BY HASH(attr) PARTITIONS 0 --- -ERROR: NUMBER OF PARITIONS must be between 1 and 64 (1 : 65) -...INT) PARTITION BY HASH(attr) PARTITIONS 0 - ^ -== - -# Missing number of partitions not allowed -CREATE TABLE test (attr INT) PARTITION BY HASH(attr) PARTITIONS --- -ERROR: syntax error (1 : 64) -... INT) PARTITION BY HASH(attr) PARTITIONS - ^ -== - -# Missing PARTITIONS attribute not allowed -CREATE TABLE test (attr INT) PARTITION BY HASH(attr) --- -ERROR: syntax error (1 : 53) -... test (attr INT) PARTITION BY HASH(attr) - ^ -== - -# Missing partitioning type not allowed -CREATE TABLE test (attr INT) PARTITION BY (attr) PARTITIONS 4 --- -ERROR: syntax error (1 : 43) -CREATE TABLE test (attr INT) PARTITION BY (attr) PARTITIONS 4 - ^ -== - -# Number of partitions greater than 64 not allowed -CREATE TABLE test (attr INT) PARTITION BY HASH(attr) PARTITIONS 65 --- -ERROR: NUMBER OF PARITIONS must be between 1 and 64 (1 : 65) -...INT) PARTITION BY HASH(attr) PARTITIONS 65 - ^ -== - -# Missing PARTITION BY clause not allowed -CREATE TABLE test (attr INT) PARTITIONS 4 --- -ERROR: syntax error (1 : 30) -CREATE TABLE test (attr INT) PARTITIONS 4 - ^ -== - -CREATE TABLE test (attr INT) WITH BLOCKPROPERTIES -(TYPE rowstore) --- -CreateTableStatement[relation_name=test] -+-attribute_list= -| +-AttributeDefinition[name=attr,type=Int] -+-block_properties= - +-BlockProperties - +-block_property=KeyStringValue[key=TYPE] - +-value=String[value=rowstore] -== - -CREATE TABLE test (attr INT) WITH BLOCKPROPERTIES -(TYPE compressed_columnstore, SORT attr, COMPRESS ALL) --- -CreateTableStatement[relation_name=test] -+-attribute_list= -| +-AttributeDefinition[name=attr,type=Int] -+-block_properties= - +-BlockProperties - +-block_property=KeyStringValue[key=TYPE] - | +-value=String[value=compressed_columnstore] - +-block_property=KeyStringValue[key=SORT] - | +-value=String[value=attr] - +-block_property=KeyStringValue[key=COMPRESS] - +-value=String[value=ALL] -== - -CREATE TABLE test (attr1 INT, attr2 INT) WITH BLOCKPROPERTIES -(TYPE compressed_columnstore, SORT attr1, COMPRESS (attr1, attr2)) --- -CreateTableStatement[relation_name=test] -+-attribute_list= -| +-AttributeDefinition[name=attr1,type=Int] -| +-AttributeDefinition[name=attr2,type=Int] -+-block_properties= - +-BlockProperties - +-block_property=KeyStringValue[key=TYPE] - | +-value=String[value=compressed_columnstore] - +-block_property=KeyStringValue[key=SORT] - | +-value=String[value=attr1] - +-block_property=KeyStringList[key=COMPRESS] - +-value_list= - +-String[value=attr1] - +-String[value=attr2] -== - -CREATE TABLE test (attr INT) WITH BLOCKPROPERTIES -(TYPE rowstore, BLOCKSIZEMB 10); --- -CreateTableStatement[relation_name=test] -+-attribute_list= -| +-AttributeDefinition[name=attr,type=Int] -+-block_properties= - +-BlockProperties - +-block_property=KeyStringValue[key=TYPE] - | +-value=String[value=rowstore] - +-block_property=KeyIntegerValue[key=BLOCKSIZEMB] - +-value=NumericLiteral[numeric_string=10,float_like=false] http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Delete.test ---------------------------------------------------------------------- diff --git a/parser/tests/Delete.test b/parser/tests/Delete.test deleted file mode 100644 index da1c3f0..0000000 --- a/parser/tests/Delete.test +++ /dev/null @@ -1,50 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -DELETE FROM test WHERE tb1=1 --- -DeleteStatement[relation_name=test] -+-where_predicate=Equal - +-left_operand=AttributeReference[attribute_name=tb1] - +-right_operand=Literal - +-NumericLiteral[numeric_string=1,float_like=false] -== - -DELETE FROM test --- -DeleteStatement[relation_name=test] -== - -DELETE FROM TABLE --- -ERROR: syntax error (1 : 13) -DELETE FROM TABLE - ^ -== - -DELETE FROM TABLE test --- -ERROR: syntax error (1 : 13) -DELETE FROM TABLE test - ^ -== - -DELETE FROM test1, test2 --- -ERROR: syntax error (1 : 18) -DELETE FROM test1, test2 - ^ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Drop.test ---------------------------------------------------------------------- diff --git a/parser/tests/Drop.test b/parser/tests/Drop.test deleted file mode 100644 index 3735e5a..0000000 --- a/parser/tests/Drop.test +++ /dev/null @@ -1,27 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -DROP TABLE test --- -DropTableStatement[relation_name=test] -== - -DROP TABLE TABLE --- -ERROR: syntax error (1 : 12) -DROP TABLE TABLE - ^ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Index.test ---------------------------------------------------------------------- diff --git a/parser/tests/Index.test b/parser/tests/Index.test deleted file mode 100644 index d97701b..0000000 --- a/parser/tests/Index.test +++ /dev/null @@ -1,81 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Name of index is required -CREATE INDEX ON test --- -ERROR: syntax error (1 : 14) -CREATE INDEX ON test - ^ -== - -# Empty-column list is not allowed -CREATE INDEX test ON test () --- -ERROR: syntax error (1 : 28) -CREATE INDEX test ON test () - ^ -== - -# Type of index is required -CREATE INDEX test ON test --- -ERROR: syntax error (1 : 26) -CREATE INDEX test ON test - ^ -== - -# 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) -CREATE INDEX test ON test USING arbitrary - ^ -== -CREATE INDEX smaIndex ON test USING SMA --- -CreateIndexStatement[index_name=smaIndex,relation_name=test,index_type=sma] -== -CREATE INDEX bloomIndex ON test USING BLOOMFILTER --- -CreateIndexStatement[index_name=bloomIndex,relation_name=test, - index_type=bloom_filter] -== -CREATE INDEX csbIndex ON test USING CSBTREE --- -CreateIndexStatement[index_name=csbIndex,relation_name=test,index_type=cs_b_tree] -== -# Bitweaving is supported on builds where it was included as a submodule. The -# parser should create code to change the catalog, but on Block creation, no -# index will be created. -CREATE INDEX bwIndex ON test(int_col) USING bitweaving; --- -CreateIndexStatement[index_name=bwIndex,relation_name=test,index_type=bitweaving] -+-attribute_list= - +-AttributeReference[attribute_name=int_col] -== -CREATE INDEX bwhIndex ON test(int_col) USING bitweaving (TYPE H); --- -CreateIndexStatement[index_name=bwhIndex,relation_name=test, - index_type=bitweaving] -+-attribute_list= -| +-AttributeReference[attribute_name=int_col] -+-index_property_list= - +-IndexProperties - +-index_property=KeyStringValue[key=TYPE] - +-value=String[value=H] http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Insert.test ---------------------------------------------------------------------- diff --git a/parser/tests/Insert.test b/parser/tests/Insert.test deleted file mode 100644 index ef732b9..0000000 --- a/parser/tests/Insert.test +++ /dev/null @@ -1,71 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -INSERT INTO test (attr1, attr2) VALUES (1, 2) --- -ERROR: list of column names in INSERT statement is not supported yet (1 : 18) -INSERT INTO test (attr1, attr2) VALUES (1, 2) - ^ -== - -INSERT INTO test VALUES (1, -2, 3) --- -InsertStatement[relation_name=test] -+-tuple= - +-Literal - | +-NumericLiteral[numeric_string=1,float_like=false] - +-Literal - | +-NumericLiteral[numeric_string=-2,float_like=false] - +-Literal - +-NumericLiteral[numeric_string=3,float_like=false] -== - -INSERT INTO test VALUES (1+1, 2*2, 3+1) --- -ERROR: syntax error (1 : 27) -INSERT INTO test VALUES (1+1, 2*2, 3+1) - ^ -== - -INSERT INTO test VALUES (e'\'sdfs') --- -InsertStatement[relation_name=test] -+-tuple= - +-Literal - +-StringLiteral[value='sdfs] -== - -INSERT INTO test VALUES ('\'sdfs') --- -ERROR: syntax error (1 : 29) -INSERT INTO test VALUES ('\'sdfs') - ^ -== - -INSERT INTO test VALUES (e'\999'); --- -ERROR: bad numeric escape sequence (must be octal or hex) (1 : 32) -INSERT INTO test VALUES (e'\999'); - ^ -== - -INSERT INTO test VALUES ('some_string'); --- -InsertStatement[relation_name=test] -+-tuple= - +-Literal - +-StringLiteral[value=some_string] http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Join.test ---------------------------------------------------------------------- diff --git a/parser/tests/Join.test b/parser/tests/Join.test deleted file mode 100644 index 63edeb4..0000000 --- a/parser/tests/Join.test +++ /dev/null @@ -1,162 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -SELECT * -FROM a JOIN b ON a.w = b.w - JOIN c ON a.x = c.x - JOIN d ON a.y = d.y; --- -SelectStatement -+-select_query=Select - +-select_clause=SelectStar - +-from_clause= - +-JoinedTable[join_type=InnerJoin] - +-left_table=JoinedTable[join_type=InnerJoin] - | +-left_table=JoinedTable[join_type=InnerJoin] - | | +-left_table=TableReference[table=a] - | | +-right_table=TableReference[table=b] - | | +-join_predicate=Equal - | | +-left_operand=AttributeReference[attribute_name=w,relation_name=a] - | | +-right_operand=AttributeReference[attribute_name=w,relation_name=b] - | +-right_table=TableReference[table=c] - | +-join_predicate=Equal - | +-left_operand=AttributeReference[attribute_name=x,relation_name=a] - | +-right_operand=AttributeReference[attribute_name=x,relation_name=c] - +-right_table=TableReference[table=d] - +-join_predicate=Equal - +-left_operand=AttributeReference[attribute_name=y,relation_name=a] - +-right_operand=AttributeReference[attribute_name=y,relation_name=d] -== - -SELECT * -FROM a AS a1 JOIN b AS b1 ON a1.w = b1.w - JOIN c AS c1 ON a1.x = c1.x - JOIN d AS d1 ON a1.y = d1.y; -WHERE a1.x > b1.x - AND a1.y > c1.y - AND a1.z > d1.z; --- -SelectStatement -+-select_query=Select - +-select_clause=SelectStar - +-from_clause= - +-JoinedTable[join_type=InnerJoin] - +-left_table=JoinedTable[join_type=InnerJoin] - | +-left_table=JoinedTable[join_type=InnerJoin] - | | +-left_table=TableReference[table=a] - | | | +-table_signature=TableSignature[table_alias=a1] - | | +-right_table=TableReference[table=b] - | | | +-table_signature=TableSignature[table_alias=b1] - | | +-join_predicate=Equal - | | +-left_operand=AttributeReference[attribute_name=w,relation_name=a1] - | | +-right_operand=AttributeReference[attribute_name=w,relation_name=b1] - | +-right_table=TableReference[table=c] - | | +-table_signature=TableSignature[table_alias=c1] - | +-join_predicate=Equal - | +-left_operand=AttributeReference[attribute_name=x,relation_name=a1] - | +-right_operand=AttributeReference[attribute_name=x,relation_name=c1] - +-right_table=TableReference[table=d] - | +-table_signature=TableSignature[table_alias=d1] - +-join_predicate=Equal - +-left_operand=AttributeReference[attribute_name=y,relation_name=a1] - +-right_operand=AttributeReference[attribute_name=y,relation_name=d1] -== - -SELECT * -FROM a LEFT OUTER JOIN b ON a.w = b.w - RIGHT OUTER JOIN c ON a.x = c.x - FULL OUTER JOIN d ON a.y = d.y; --- -SelectStatement -+-select_query=Select - +-select_clause=SelectStar - +-from_clause= - +-JoinedTable[join_type=FullOuterJoin] - +-left_table=JoinedTable[join_type=RightOuterJoin] - | +-left_table=JoinedTable[join_type=LeftOuterJoin] - | | +-left_table=TableReference[table=a] - | | +-right_table=TableReference[table=b] - | | +-join_predicate=Equal - | | +-left_operand=AttributeReference[attribute_name=w,relation_name=a] - | | +-right_operand=AttributeReference[attribute_name=w,relation_name=b] - | +-right_table=TableReference[table=c] - | +-join_predicate=Equal - | +-left_operand=AttributeReference[attribute_name=x,relation_name=a] - | +-right_operand=AttributeReference[attribute_name=x,relation_name=c] - +-right_table=TableReference[table=d] - +-join_predicate=Equal - +-left_operand=AttributeReference[attribute_name=y,relation_name=a] - +-right_operand=AttributeReference[attribute_name=y,relation_name=d] -== - -SELECT * -FROM a INNER JOIN b ON (a.w = b.w OR a.x > b.y); --- -SelectStatement -+-select_query=Select - +-select_clause=SelectStar - +-from_clause= - +-JoinedTable[join_type=InnerJoin] - +-left_table=TableReference[table=a] - +-right_table=TableReference[table=b] - +-join_predicate=Or - +-Equal - | +-left_operand=AttributeReference[attribute_name=w,relation_name=a] - | +-right_operand=AttributeReference[attribute_name=w,relation_name=b] - +-Greater - +-left_operand=AttributeReference[attribute_name=x,relation_name=a] - +-right_operand=AttributeReference[attribute_name=y,relation_name=b] -== - -SELECT * -FROM b LEFT JOIN c ON b.x = c.x JOIN d ON c.y = d.y; --- -SelectStatement -+-select_query=Select - +-select_clause=SelectStar - +-from_clause= - +-JoinedTable[join_type=InnerJoin] - +-left_table=JoinedTable[join_type=LeftOuterJoin] - | +-left_table=TableReference[table=b] - | +-right_table=TableReference[table=c] - | +-join_predicate=Equal - | +-left_operand=AttributeReference[attribute_name=x,relation_name=b] - | +-right_operand=AttributeReference[attribute_name=x,relation_name=c] - +-right_table=TableReference[table=d] - +-join_predicate=Equal - +-left_operand=AttributeReference[attribute_name=y,relation_name=c] - +-right_operand=AttributeReference[attribute_name=y,relation_name=d] -== - -SELECT * -FROM b LEFT JOIN (c JOIN d ON c.y = d.y) ON b.x = c.x; --- -SelectStatement -+-select_query=Select - +-select_clause=SelectStar - +-from_clause= - +-JoinedTable[join_type=LeftOuterJoin] - +-left_table=TableReference[table=b] - +-right_table=JoinedTable[join_type=InnerJoin] - | +-left_table=TableReference[table=c] - | +-right_table=TableReference[table=d] - | +-join_predicate=Equal - | +-left_operand=AttributeReference[attribute_name=y,relation_name=c] - | +-right_operand=AttributeReference[attribute_name=y,relation_name=d] - +-join_predicate=Equal - +-left_operand=AttributeReference[attribute_name=x,relation_name=b] - +-right_operand=AttributeReference[attribute_name=x,relation_name=c] http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/ParserTest.cpp ---------------------------------------------------------------------- diff --git a/parser/tests/ParserTest.cpp b/parser/tests/ParserTest.cpp deleted file mode 100644 index cd2eaf4..0000000 --- a/parser/tests/ParserTest.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - **/ - -#include <fstream> -#include <memory> -#include <set> -#include <string> - -#include "parser/ParseStatement.hpp" -#include "parser/SqlParserWrapper.hpp" -#include "utility/Macros.hpp" -#include "utility/textbased_test/TextBasedTest.hpp" -#include "utility/textbased_test/TextBasedTestDriver.hpp" -#include "utility/textbased_test/TextBasedTestRunner.hpp" - -#include "glog/logging.h" - -#include "gtest/gtest.h" - -namespace quickstep { - -class SqlParserTestRunner : public TextBasedTestRunner { - public: - SqlParserTestRunner() {} - - void runTestCase(const std::string& input, const std::set<std::string> &options, std::string *output) override { - CHECK(options.empty()) << "ParserTestRunner does not accept any options"; - - VLOG(4) << "Parse SQL: " << input; - - sql_parser_.feedNextBuffer(new std::string(input)); - ParseResult result = sql_parser_.getNextStatement(); - - if (result.condition != ParseResult::kSuccess) { - *output = result.error_message; - } else { - *output = result.parsed_statement->toString(); - } - } - - private: - SqlParserWrapper sql_parser_; - - DISALLOW_COPY_AND_ASSIGN(SqlParserTestRunner); -}; - -QUICKSTEP_GENERATE_TEXT_TEST(PARSE_SQL_TEST); - -} // namespace quickstep - -int main(int argc, char** argv) { - google::InitGoogleLogging(argv[0]); - - if (argc < 3) { - LOG(ERROR) << "Must have at least 2 arguments, but " << argc-1 << " are provided"; - } - - std::ifstream input_file(argv[1]); - CHECK(input_file.is_open()) << argv[1]; - std::unique_ptr<quickstep::TextBasedTestRunner> test_runner(new quickstep::SqlParserTestRunner); - quickstep::test_driver.reset(new quickstep::TextBasedTestDriver(&input_file, test_runner.get())); - - ::testing::InitGoogleTest(&argc, argv); - const int success = RUN_ALL_TESTS(); - if (success != 0) { - quickstep::test_driver->writeActualOutputToFile(argv[2]); - } - - return success; -}