http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/parser/StmtDDLonHiveObjects.h ---------------------------------------------------------------------- diff --git a/core/sql/parser/StmtDDLonHiveObjects.h b/core/sql/parser/StmtDDLonHiveObjects.h new file mode 100644 index 0000000..cd36f50 --- /dev/null +++ b/core/sql/parser/StmtDDLonHiveObjects.h @@ -0,0 +1,191 @@ +/********************************************************************** +// @@@ START COPYRIGHT @@@ +// +// 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. +// +// @@@ END COPYRIGHT @@@ +**********************************************************************/ +#ifndef STMTDDLHIVEOBJECTS_H +#define STMTDDLHIVEOBJECTS_H +/* -*-C++-*- + ***************************************************************************** + * + * File: StmtDDLonHiveObjects.h + * Description: + * + * + * Created: + * Language: C++ + * + * + ***************************************************************************** + */ + + +#include "ElemDDLNode.h" +#include "NAString.h" +#include "StmtDDLNode.h" +#include "ComSmallDefs.h" + +// ----------------------------------------------------------------------- +// contents of this file +// ----------------------------------------------------------------------- +class StmtDDLonHiveObjects; + +// ----------------------------------------------------------------------- +// forward references +// ----------------------------------------------------------------------- +// None + +// ----------------------------------------------------------------------- +// DDL on Hive Objects from Traf interface +// ----------------------------------------------------------------------- +class StmtDDLonHiveObjects : public StmtDDLNode +{ + +public: + enum Operation + { + CREATE_, + DROP_, + ALTER_, + TRUNCATE_, + PASSTHRU_DDL_, + CREATE_LIKE_TRAF_, + UNKNOWN_OPER_ + }; + + enum ObjectType + { + TABLE_, + SCHEMA_, + VIEW_, + UNKNOWN_TYPE_ + }; + + // initialize constructor + StmtDDLonHiveObjects(Operation oper, + ObjectType type, + NABoolean ifExistsOrNotExists, + const NAString &name, + NAString &hiveDDL, + CollHeap * heap) + : StmtDDLNode(DDL_ON_HIVE_OBJECTS), + oper_(oper), + type_(type), + ifExistsOrNotExists_(ifExistsOrNotExists), + name_(name), + hiveDDL_(hiveDDL), + childNode_(NULL) + {} + + // virtual destructor + virtual ~StmtDDLonHiveObjects() + {} + + // cast + virtual StmtDDLonHiveObjects * castToStmtDDLonHiveObjects() + {return this;} + + // + // accessors + // + + // methods relating to parse tree + virtual Int32 getArity() const {return 1;} + virtual ExprNode * getChild(Lng32 index) {return childNode_;} + virtual void setChild(Lng32 index, ExprNode * pChildNode) + { + ComASSERT(index >= 0 AND index < getArity()); + childNode_ = pChildNode->castToElemDDLNode(); + } + + const Operation getOper() const {return oper_;} + const char* getOperStr() const + { + switch (oper_) + { + case CREATE_ : return "create"; + case DROP_ : return "drop"; + case ALTER_ : return "alter"; + case TRUNCATE_ : return "truncate"; + case PASSTHRU_DDL_ : return "passthru"; + case CREATE_LIKE_TRAF_: return "create_like_traf"; + case UNKNOWN_OPER_ : return "unknown"; + default : return "unknown"; + } // switch + } + + const ObjectType getType() const {return type_;} + const char* getTypeStr() const + { + switch (type_) + { + case TABLE_ : return "table"; + case SCHEMA_ : return "schema"; + case VIEW_ : return "view"; + case UNKNOWN_TYPE_ : return "unknown"; + default : return "unknown"; + } // switch + } + + const NABoolean getIfExistsOrNotExists() const { return ifExistsOrNotExists_; } + const NAString &getName() const { return name_; } + + const NAString &getHiveDDL() const {return hiveDDL_;} + NAString &getHiveDDL() {return hiveDDL_;} + void setHiveDDL(NAString &hiveDDL) {hiveDDL_ = hiveDDL;} + + // ExprNode * bindNode(BindWA * pBindWA); + + // + // methods for tracing + // + + // virtual const NAString displayLabel1() const; + // virtual const NAString displayLabel2() const; + // virtual const NAString getText() const; + +private: + + Operation oper_; + ObjectType type_; + + // TRUE: if 'if exists' is specified for drop or truncate, + // or if 'if not exists' is specified for create. + // FALSE: otherwise + NABoolean ifExistsOrNotExists_; + + NAString name_; + NAString hiveDDL_; + + // + // please do not use the following methods + // + + StmtDDLonHiveObjects(); // DO NOT USE + StmtDDLonHiveObjects(const StmtDDLonHiveObjects &); // DO NOT USE + StmtDDLonHiveObjects & operator=(const StmtDDLonHiveObjects &); // DO NOT USE + + // --------------------------------------------------------------------- + // private data members + // --------------------------------------------------------------------- + ElemDDLNode *childNode_; +}; // class StmtDDLonHiveObjects + +#endif // STMTDDLHIVEOBJECTS_H
http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/parser/sqlparser.y ---------------------------------------------------------------------- diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y index e3f534f..fb680f2 100755 --- a/core/sql/parser/sqlparser.y +++ b/core/sql/parser/sqlparser.y @@ -154,6 +154,9 @@ using namespace std; #include "SqlParserAux.h" #include "StmtCompilationMode.h" #include "StmtDMLSetTransaction.h" + +#include "StmtDDLonHiveObjects.h" + // -- triggers #include "Triggers.h" #include "ItemNAType.h" @@ -174,7 +177,6 @@ using namespace std; #include "exp_datetime.h" #include "Analyzer.h" - #include "OptimizerSimulator.h" #include "ItemFuncUDF.h" @@ -340,6 +342,7 @@ static void enableMakeQuotedStringISO88591Mechanism() %token <item> ARITH_PLACEHOLDER %token <item> BOOL_PLACEHOLDER %token <stringval> DELIMITED_IDENTIFIER +%token <stringval> BACKQUOTED_IDENTIFIER %token <stringval> CALL_CASED_IDENTIFIER %token <stringval> GOTO_CASED_IDENTIFIER %token <stringval> PERFORM_CASED_IDENTIFIER @@ -1913,6 +1916,7 @@ static void enableMakeQuotedStringISO88591Mechanism() %type <stringval> identifier_with_hat %type <stringval> identifier_with_dollar %type <strSeq> qualified_name +%type <strSeq> schema_name_ss %type <strSeq> module_name %type <strSeq> routine_action_name %type <stringval> correlation_name @@ -2266,6 +2270,7 @@ static void enableMakeQuotedStringISO88591Mechanism() %type <pStmtDDL> sql_schema_manipulation_statement %type <pStmtDDL> sql_schema_statement_prologue %type <pStmtDDL> schema_definition +%type <uint> schema_or_database %type <pStmtDDL> routine_definition %type <pStmtDDL> alter_function_statement %type <pElemDDL> routine_params_list @@ -2508,8 +2513,10 @@ static void enableMakeQuotedStringISO88591Mechanism() %type <pStmtDDL> alter_table_disable_constraint_clause %type <pStmtDDL> alter_table_enable_constraint_clause %type <pStmtDDL> alter_table_action +%type <uint> alter_table_start_tokens +%type <uint> alter_view_start_tokens +%type <uint> alter_schema_start_tokens %type <pStmtDDL> alter_table_statement -%type <pStmtDDL> alter_database_statement %type <boolean> optional_ghost %type <pStmtDDL> revoke_schema_statement %type <pStmtDDL> revoke_component_privilege_stmt @@ -2785,7 +2792,7 @@ static void enableMakeQuotedStringISO88591Mechanism() %type <item> balance_when_then %type <item> balance_else %type <item> balance_expr -%type <longint> options +%type <longint> showplan_options %type <relx> routine_invocation %type <relx> standalone_call_statement @@ -2850,9 +2857,9 @@ static void enableMakeQuotedStringISO88591Mechanism() %type <pSchemaName> optional_from_schema %type <stringval> get_statistics_optional_options +%type <corrName> truncate_table_name %type <relx> exe_util_fast_delete %type <longint> purgedata_options -%type <relx> exe_util_hive_truncate %type <relx> exe_util_get_metadata_info %type <relx> exe_util_get_version_info @@ -2872,6 +2879,7 @@ static void enableMakeQuotedStringISO88591Mechanism() %type <stringval> explain_starting_tokens %type <stringval> explain_identifier %type <stmt_ptr> explain_stmt_finalized +%type <uint> showplan_starting_tokens %type <strSeq> routine_name %type <item> routine_arg_list %type <corrName> actual_routine_name @@ -2926,6 +2934,8 @@ static void enableMakeQuotedStringISO88591Mechanism() %type <extractType> extract_type %type <boolean> optional_if_not_exists_clause %type <boolean> optional_if_exists_clause +%type <boolean> optional_if_not_registered_clause +%type <boolean> optional_if_registered_clause %type <uint> merge_stmt_start_tokens %type <relx> merge_stmt_using_clause @@ -5600,8 +5610,22 @@ identifier : regular_identifier } | DELIMITED_IDENTIFIER { - $$=$1; - if ( ($$==NULL) || transformIdentifier(*$$)) YYERROR; + $$=$1; + if ( ($$==NULL) || transformIdentifier(*$$)) YYERROR; + } + | BACKQUOTED_IDENTIFIER + { + if (NOT SqlParser_CurrentParser->hiveDDLInfo_->checkForDDL_) + { + yyerror(""); + YYERROR; + } + + $$=$1; + if ( ($$==NULL) || transformIdentifier(*$$)) YYERROR; + + SqlParser_CurrentParser->hiveDDLInfo_->backquotedDelimFound_ = TRUE; + } /* type stringval */ @@ -5761,7 +5785,7 @@ qualified_name : identifier if (! $1->isValid()) YYABORT; - $$ = $1; + $$ = $1; } /* type strSeq */ @@ -14124,10 +14148,14 @@ sql_statement : interactive_query_expression { $$ = new (PARSERHEAP()) StmtQuery($1); } - | TOK_DISPLAY interactive_query_expression + | TOK_DISPLAY + { + SqlParser_CurrentParser->hiveDDLInfo_->essd_ = Parser::HiveDDLInfo::DISPLAY_; + } + interactive_query_expression { - ((RelRoot *)$2)->setDisplayTree(TRUE); - $$ = new (PARSERHEAP()) StmtQuery($2); + ((RelRoot *)$3)->setDisplayTree(TRUE); + $$ = new (PARSERHEAP()) StmtQuery($3); } | TOK_BEGIN TOK_DECLARE TOK_SECTION { @@ -14406,7 +14434,7 @@ sql_schema_definition_statement : | comment_on_statement { } - + /* type pStmtDDL */ sql_schema_manipulation_statement : @@ -14463,9 +14491,7 @@ sql_schema_manipulation_statement : | alter_view_statement { } - | alter_database_statement - { - } + | drop_synonym_stmt { } @@ -14813,10 +14839,6 @@ interactive_query_expression: { $$ = finalize($1); } - | exe_util_hive_truncate - { - $$ = finalize($1); - } | exe_util_get_uid { $$ = finalize($1); @@ -14845,11 +14867,10 @@ interactive_query_expression: { $$ = finalize($1); } - | exe_util_hive_query { - $$ = finalize($1); - } + $$ = finalize($1); + } dml_query : query_expression order_by_clause access_type optional_lock_mode for_update_spec optional_limit_spec @@ -15161,6 +15182,15 @@ explain_starting_tokens : TOK_EXPLAIN optional_options ParSetTextStartPosForDisplayExplain( ParNameLocListPtr); $$ = $2; + + SqlParser_CurrentParser->hiveDDLInfo_->essd_ = Parser::HiveDDLInfo::EXPLAIN_; + if ($2) + SqlParser_CurrentParser->hiveDDLInfo_->essdOptions_ = *$2; + StringPos start; + StringPos end; + ParGetTextStartEndPosForDisplayExplain( + ParNameLocListPtr, start, end); + SqlParser_CurrentParser->hiveDDLInfo_->essdQueryStartPos_ = start; } /* type relx */ @@ -16773,18 +16803,22 @@ exe_util_hive_query : TOK_PROCESS TOK_HIVE TOK_STATEMENT QUOTED_STRING } | TOK_PROCESS TOK_HIVE TOK_DDL QUOTED_STRING { - $$ = new (PARSERHEAP()) - ExeUtilHiveQuery(*$4, ExeUtilHiveQuery::FROM_STRING, - PARSERHEAP()); - } + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::PASSTHRU_DDL_, StmtDDLonHiveObjects::UNKNOWN_TYPE_); + + SqlParser_CurrentParser->hiveDDLInfo_->userSpecifiedStmt_ = *$4; + SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_ = TRUE; + + // error out. Caller will handle this stmt. + YYERROR; + $$ = NULL; + } | TOK_PROCESS TOK_HIVE TOK_STATEMENT TOK_FROM TOK_FILE QUOTED_STRING { $$ = new (PARSERHEAP()) ExeUtilHiveQuery(*$6, ExeUtilHiveQuery::FROM_FILE, PARSERHEAP()); } - - /* * The purpose of dummy_token_lookahead is to force the lexer to look * one token ahead. This may be necessary in cases where the parser @@ -17036,7 +17070,7 @@ exe_util_display_explain: explain_starting_tokens interactive_query_expression d // xn will be started, if needed, when the exeutilstmt stmt // is processed. eue->xnNeeded() = FALSE; - + $$ = eue; delete stmt; @@ -17815,23 +17849,41 @@ optional_mt_options : QUOTED_STRING $$ = NULL; } -exe_util_fast_delete: TOK_PURGEDATA table_name purgedata_options +/* type corrName */ +truncate_table_name : TOK_PURGEDATA table_name + { + $$ = $2; + } + | TOK_TRUNCATE table_name + { + $$ = $2; + } + | TOK_TRUNCATE TOK_TABLE optional_if_exists_clause + { + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::TRUNCATE_, StmtDDLonHiveObjects::TABLE_, $3); + } + ddl_qualified_name + { + $$ = new (PARSERHEAP()) CorrName(*$5, PARSERHEAP()); + } + +exe_util_fast_delete : truncate_table_name purgedata_options { - short noLog = ($3 & 0x1) != 0; - short ignoreTrigger = ($3 & 0x2) != 0; + short noLog = ($2 & 0x1) != 0; + short ignoreTrigger = ($2 & 0x2) != 0; CharInfo::CharSet stmtCharSet = CharInfo::UnknownCharSet; - NAString * stmt = getSqlStmtStr ( stmtCharSet // out - CharInfo::CharSet & - , PARSERHEAP() // in - NAMemory * heapUsedForOutputBuffers + NAString * stmt = getSqlStmtStr ( stmtCharSet + , PARSERHEAP() ); - // If we can not get a variable-width multi-byte or single-byte string here, report error if ( stmt == NULL ) { *SqlParser_Diags << DgSqlCode(-3406); YYERROR; } $$ = new (PARSERHEAP()) - ExeUtilFastDelete(CorrName(*$2, PARSERHEAP()), + ExeUtilFastDelete(CorrName(*$1, PARSERHEAP()), NULL, (char*)stmt->data(), stmtCharSet, @@ -17841,9 +17893,8 @@ exe_util_fast_delete: TOK_PURGEDATA table_name purgedata_options TRUE, PARSERHEAP()); - delete $2; + delete $1; } - purgedata_options : /*empty*/ { $$ = 0; } | TOK_NOLOG { $$ = 1; } | TOK_IGNORE_TRIGGER { $$ = 2; } @@ -17857,25 +17908,6 @@ purgedata_options : /*empty*/ { $$ = 0; } | TOK_NOLOG TOK_WAITEDIO TOK_IGNORE_TRIGGER { $$ = 7; } | TOK_IGNORE_TRIGGER TOK_WAITEDIO TOK_NOLOG { $$ = 7; } -exe_util_hive_truncate: TOK_TRUNCATE table_name - { - $$ = new (PARSERHEAP()) - ExeUtilHiveTruncate(CorrName(*$2, PARSERHEAP()), - NULL, - PARSERHEAP()); - - delete $2; - } - | TOK_TRUNCATE table_name TOK_PARTITION '(' quoted_string_list ')' - { - $$ = new (PARSERHEAP()) - ExeUtilHiveTruncate(CorrName(*$2, PARSERHEAP()), - $5, - PARSERHEAP()); - - delete $2; - } - exe_util_aqr: TOK_GET TOK_ALL TOK_AQR TOK_ENTRIES { ExeUtilAQR * eua = @@ -22540,6 +22572,24 @@ showcontrol_type: | TOK_TABLE { $$ = Describe::CONTROL_TABLE_; } | TOK_SESSION { $$ = Describe::CONTROL_SESSION_; } +showplan_starting_tokens : TOK_SHOWPLAN showplan_options + { + SqlParser_CurrentParser->hiveDDLInfo_->essd_ = Parser::HiveDDLInfo::SHOWPLAN_; + + char buf[40]; + SqlParser_CurrentParser->hiveDDLInfo_->essdQueryStartPos_ = 9; + + if ($2 != 0) + { + SqlParser_CurrentParser->hiveDDLInfo_->essdOptions_ = + str_itoa($2, buf); + + SqlParser_CurrentParser->hiveDDLInfo_->essdQueryStartPos_ += strlen("option ") + strlen("'t'"); + } + + $$ = $2; + } + /* type relx */ show_statement: TOK_SHOWCONTROL showcontrol_type @@ -22852,7 +22902,7 @@ show_statement: YYERROR; } } - | TOK_SHOWPLAN options interactive_query_expression + | showplan_starting_tokens interactive_query_expression { // create a dummy name so as to satisfy the constructor of // Describe. The tablename param is not used for SHOWPLAN qry. @@ -22860,13 +22910,14 @@ show_statement: $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), c, Describe::PLAN_,COM_TABLE_NAME,$2), + Describe(SQLTEXT(), c, Describe::PLAN_,COM_TABLE_NAME,$1), REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); + } - | TOK_SHOWPLAN options TOK_EXPLAIN optional_options interactive_query_expression + | showplan_starting_tokens TOK_EXPLAIN optional_options interactive_query_expression { // create a dummy name so as to satisfy the constructor of // Describe. The tablename param is not used for SHOWPLAN qry. @@ -22874,13 +22925,15 @@ show_statement: $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), c, Describe::PLAN_,COM_TABLE_NAME,$2), + Describe(SQLTEXT(), c, Describe::PLAN_,COM_TABLE_NAME,$1), REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); + + SqlParser_CurrentParser->hiveDDLInfo_->essd_ = Parser::HiveDDLInfo::SHOWPLAN_; } - | TOK_SHOWPLAN options TOK_PROCEDURE '(' character_string_literal ',' character_string_literal ')' + | showplan_starting_tokens TOK_PROCEDURE '(' character_string_literal ',' character_string_literal ')' { // DEFAULT_CHARSET has no effect on character_string_literal in this context // @@ -22892,16 +22945,20 @@ show_statement: //temp.append('.'); //temp.append(*$6); - CorrName c (*$7, NULL, *$5); + CorrName c (*$6, NULL, *$4); $$ = new (PARSERHEAP()) RelRoot(new (PARSERHEAP()) - Describe(SQLTEXT(), c, Describe::STATIC_PLAN_,COM_TABLE_NAME,$2), + Describe(SQLTEXT(), c, Describe::STATIC_PLAN_,COM_TABLE_NAME,$1), REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); } - | TOK_SHOWSHAPE interactive_query_expression + | TOK_SHOWSHAPE + { + SqlParser_CurrentParser->hiveDDLInfo_->essd_ = Parser::HiveDDLInfo::SHOWSHAPE_; + } + interactive_query_expression { // create a dummy name so as to satisfy the constructor of // Describe. The tablename param is not used for SHOWPLAN qry. @@ -22913,6 +22970,7 @@ show_statement: REL_ROOT, new (PARSERHEAP()) ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP()))); + } | TOK_SHOWSTATS TOK_FOR TOK_QUERY query_expression { @@ -23725,7 +23783,6 @@ optional_showddl_object_options_list : empty // include EXTERNAL(32)/INTERNAL(64), unsupported options // include BRIEF(8)/DETAIL(4). if ( (($2 & 32) && ($2 & 64)) || - ($2 & 4) || ($2 & 8) ) { yyerror(""); // emits syntax error 15001 @@ -23747,10 +23804,26 @@ optional_showddl_role_option : empty $$ = 16; } -/* type pStmtDDL */ +/* type uint */ +schema_or_database : TOK_SCHEMA + { + $$ = 1; + } + | TOK_DATABASE + { + $$ = 2; + } -schema_definition : TOK_CREATE schema_class TOK_SCHEMA schema_name_clause char_set collation_option +/* type pStmtDDL */ +schema_definition : TOK_CREATE schema_class schema_or_database schema_name_clause char_set collation_option { + // cannot use keyword DATABASE if not hive ddl. + if (($3 == 2) && + (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)) + { + YYERROR; + } + NAString extSchName($4->getSchemaName().getSchemaNameAsAnsiString()); if (! validateVolatileSchemaName(extSchName)) { @@ -23772,9 +23845,16 @@ schema_definition : TOK_CREATE schema_class TOK_SCHEMA schema_name_clause char_s delete $4 /*schema_name_clause*/; } -schema_definition : TOK_CREATE schema_class TOK_SCHEMA TOK_IF TOK_NOT TOK_EXISTS +schema_definition : TOK_CREATE schema_class schema_or_database TOK_IF TOK_NOT TOK_EXISTS schema_name_clause char_set collation_option { + // cannot use keyword DATABASE if not hive ddl. + if (($3 == 2) && + (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)) + { + YYERROR; + } + NAString extSchName($7->getSchemaName().getSchemaNameAsAnsiString()); if (! validateVolatileSchemaName(extSchName)) { @@ -23794,6 +23874,9 @@ schema_definition : TOK_CREATE schema_class TOK_SCHEMA TOK_IF TOK_NOT TOK_EXISTS pNode->setCreateIfNotExists(TRUE); pNode->synthesize(); delete $7 /*schema_name_clause*/; + + SqlParser_CurrentParser->hiveDDLInfo_->ifExistsOrNotExists_ = TRUE; + $$ = pNode; } @@ -23822,6 +23905,9 @@ schema_definition : TOK_CREATE TOK_VOLATILE TOK_SCHEMA schema_class : empty { $$ = COM_SCHEMA_CLASS_DEFAULT; + + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::CREATE_, StmtDDLonHiveObjects::SCHEMA_); } | TOK_PRIVATE { @@ -23833,10 +23919,11 @@ schema_class : empty } /* type pElemDDLSchemaName */ -schema_name_clause: schema_name +schema_name_clause : schema_name { $$ = new (PARSERHEAP()) ElemDDLSchemaName(*$1, "", PARSERHEAP()); + delete $1; } @@ -23856,18 +23943,39 @@ schema_name_clause: schema_name } /* type pSchemaName */ -schema_name : identifier '.' identifier - { - $$ = new (PARSERHEAP()) SchemaName(*$3,*$1, PARSERHEAP()); - delete $3; - delete $1; - } +schema_name : schema_name_ss + { + StringPos namePos = $1->getPosition(); + size_t nameLen = $1->getNameLength(); + $$ = schemaNameFromStrings($1); + if ($$ == NULL) + YYABORT; - | identifier - { - $$ = new (PARSERHEAP()) SchemaName(*$1,"",PARSERHEAP()); - delete $1; - } + SqlParser_CurrentParser->hiveDDLInfo_->ddlNamePos_ = namePos; + SqlParser_CurrentParser->hiveDDLInfo_->ddlNameLen_ = nameLen; + + preprocessHiveDDL( + $$->getCatalogName(), + SqlParser_CurrentParser->hiveDDLInfo_); + } + +/* type strSeq */ +schema_name_ss : identifier + { + ShortStringSequence *strseq = + new (PARSERHEAP()) ShortStringSequence($1); + if (! strseq->isValid()) + YYABORT; + $$ = strseq; + } + | schema_name_ss '.' identifier + { + $1->append($3); + if (! $1->isValid()) + YYABORT; + + $$ = $1; + } /* type stringval */ schema_authorization_identifier : authorization_identifier @@ -24884,13 +24992,22 @@ udf_version_tag_clause : TOK_VERSION TOK_TAG std_char_string_literal } /* type pStmtDDL */ -table_definition : create_table_start_tokens ddl_qualified_name +table_definition : create_table_start_tokens + ddl_qualified_name table_definition_body optional_create_table_attribute_list optional_in_memory_clause optional_map_to_hbase_clause optional_hbase_data_format { + if (($1->getType() == TableTokens::TYPE_EXTERNAL_HIVE_TABLE) || + ($1->getType() == TableTokens::TYPE_MANAGED_HIVE_TABLE)) + { + *SqlParser_Diags << DgSqlCode(-3242) + << DgString0("LIKE clause must be specified to create this Hive table."); + YYERROR; + } + $1->setOptions(TableTokens::OPT_NONE); QualifiedName * qn; if ($1->isVolatile()) @@ -24970,6 +25087,7 @@ table_definition : create_table_start_tokens ddl_qualified_name if (! qn) YYABORT; + StmtDDLNode *rNode = NULL; StmtDDLCreateTable *pNode = new (PARSERHEAP()) StmtDDLCreateTable( @@ -24989,7 +25107,32 @@ table_definition : create_table_start_tokens ddl_qualified_name ParNameCTLocListPtr = NULL; } - $$ = pNode; + rNode = pNode; + if (($1->getType() == TableTokens::TYPE_EXTERNAL_HIVE_TABLE) || + ($1->getType() == TableTokens::TYPE_MANAGED_HIVE_TABLE)) + { + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::CREATE_LIKE_TRAF_, + StmtDDLonHiveObjects::TABLE_, $1->ifNotExistsSet()); + + SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_ = TRUE; + + NAString hiveDDL; + StmtDDLonHiveObjects *hNode = + new (PARSERHEAP()) + StmtDDLonHiveObjects( + StmtDDLonHiveObjects::CREATE_LIKE_TRAF_, + StmtDDLonHiveObjects::TABLE_, + $1->ifNotExistsSet(), + qn->getQualifiedNameAsAnsiString(), + hiveDDL, + PARSERHEAP()); + + hNode->setChild(0, pNode); + rNode = hNode; + } + + $$ = rNode; delete $1; /*TableTokens*/ delete $2 /*ddl_qualified_name*/; } @@ -25041,6 +25184,16 @@ table_definition : create_table_start_tokens ddl_qualified_name yyerror(""); YYERROR; } + + if (($1->getType() == TableTokens::TYPE_EXTERNAL_HIVE_TABLE) || + ($1->getType() == TableTokens::TYPE_MANAGED_HIVE_TABLE)) + { + // create hive table .. as.. not supported. + *SqlParser_Diags << DgSqlCode(-3242) + << DgString0("'create hive table ... as ...' construct is not allowed."); + YYERROR; + } + $1->setOptions($6); if ($1->isVolatile()) qn = processVolatileDDLName($2, FALSE, FALSE); @@ -25125,6 +25278,16 @@ table_definition : create_table_start_tokens ddl_qualified_name yyerror(""); YYERROR; } + + if (($1->getType() == TableTokens::TYPE_EXTERNAL_HIVE_TABLE) || + ($1->getType() == TableTokens::TYPE_MANAGED_HIVE_TABLE)) + { + // create hive table .. as.. not supported. + *SqlParser_Diags << DgSqlCode(-3242) + << DgString0("'create hive table ... as ...' construct is not allowed."); + YYERROR; + } + $1->setOptions($5); if ($1->isVolatile()) qn = processVolatileDDLName($2, FALSE, FALSE); @@ -25219,6 +25382,7 @@ table_definition : create_table_start_tokens ddl_qualified_name $$ = pNode; } +/* tableTokens */ create_table_start_tokens : TOK_CREATE TOK_TABLE optional_if_not_exists_clause { @@ -25226,6 +25390,9 @@ create_table_start_tokens : ParNameLocList(SQLTEXT(), (CharInfo::CharSet)SQLTEXTCHARSET(), SQLTEXTW(), PARSERHEAP()); TableTokens *tableTokens = new TableTokens(TableTokens::TYPE_REGULAR_TABLE, $3); $$ = tableTokens; + + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::CREATE_, StmtDDLonHiveObjects::TABLE_, $3); } | TOK_CREATE TOK_EXTERNAL TOK_TABLE optional_if_not_exists_clause @@ -25234,6 +25401,9 @@ create_table_start_tokens : ParNameLocList(SQLTEXT(), (CharInfo::CharSet)SQLTEXTCHARSET(), SQLTEXTW(), PARSERHEAP()); TableTokens *tableTokens = new TableTokens(TableTokens::TYPE_EXTERNAL_TABLE, $4); $$ = tableTokens; + + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::CREATE_, StmtDDLonHiveObjects::TABLE_, $3); } | TOK_CREATE TOK_IMPLICIT TOK_EXTERNAL TOK_TABLE optional_if_not_exists_clause @@ -25330,6 +25500,20 @@ create_table_start_tokens : $$ = tableTokens; } + | TOK_CREATE TOK_HIVE TOK_TABLE optional_if_not_exists_clause + { + ParNameCTLocListPtr = new (PARSERHEAP()) + ParNameLocList(SQLTEXT(), (CharInfo::CharSet)SQLTEXTCHARSET(), SQLTEXTW(), PARSERHEAP()); + TableTokens *tableTokens = new TableTokens(TableTokens::TYPE_MANAGED_HIVE_TABLE, $4); + $$ = tableTokens; + } + | TOK_CREATE TOK_EXTERNAL TOK_HIVE TOK_TABLE optional_if_not_exists_clause + { + ParNameCTLocListPtr = new (PARSERHEAP()) + ParNameLocList(SQLTEXT(), (CharInfo::CharSet)SQLTEXTCHARSET(), SQLTEXTW(), PARSERHEAP()); + TableTokens *tableTokens = new TableTokens(TableTokens::TYPE_EXTERNAL_HIVE_TABLE, $5); + $$ = tableTokens; + } /* type boolean */ optional_if_not_exists_clause : empty @@ -25352,6 +25536,36 @@ optional_if_exists_clause : $$ = TRUE; } +/* type boolean */ +optional_if_not_registered_clause : + empty + { + $$ = FALSE; + } + | TOK_IF TOK_NOT TOK_REGISTERED + { + $$ = TRUE; + } + | TOK_IF TOK_NOT TOK_EXISTS + { + $$ = TRUE; + } + +/* type boolean */ +optional_if_registered_clause : + empty + { + $$ = FALSE; + } + | TOK_IF TOK_REGISTERED + { + $$ = TRUE; + } + | TOK_IF TOK_EXISTS + { + $$ = TRUE; + } + create_table_as_attr_list_start: empty { @@ -26277,6 +26491,15 @@ like_definition : TOK_LIKE source_table optional_like_option_list /* type pElemDDL */ external_table_definition : TOK_FOR source_table { + if (SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_) + SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_ = FALSE; + + if (SqlParser_CurrentParser->hiveDDLInfo_->backquotedDelimFound_) + { + yyerror(""); + YYERROR; + } + $$ = new (PARSERHEAP()) ElemDDLLikeCreateTable( *$2 /*source_table*/, @@ -26429,6 +26652,11 @@ like_option : TOK_WITHOUT TOK_CONSTRAINTS $$ = new (PARSERHEAP()) ElemDDLLikeOptWithoutLobColumns(); } + | TOK_WITH TOK_HIVE TOK_OPTIONS QUOTED_STRING + { + $$ = new (PARSERHEAP()) + ElemDDLLikeOptWithHiveOptions(*$4); + } /* type pElemDDL */ optional_create_table_attribute_list : create_table_as_attr_list_start @@ -27597,7 +27825,9 @@ store_option : TOK_PRIMARY TOK_KEY } /* type pStmtDDL */ -view_definition : create_view_keywords ddl_qualified_name +view_definition : create_view_keywords + optional_if_not_exists_clause + ddl_qualified_name optional_view_column_list optional_location_clause optional_by_auth_identifier @@ -27606,14 +27836,14 @@ view_definition : create_view_keywords ddl_qualified_name order_by_clause optional_with_check_option { - RelRoot *top = finalize($8); - if (($9) && + RelRoot *top = finalize($9); + if (($10) && (CmpCommon::getDefault(ALLOW_ORDER_BY_IN_CREATE_VIEW) == DF_OFF)) { YYERROR; } - top->addOrderByTree($9); + top->addOrderByTree($10); if ((top->accessOptions().userSpecified()) && (CmpCommon::getDefault(ALLOW_ISOLATION_LEVEL_IN_CREATE_VIEW) == DF_OFF)) { @@ -27635,7 +27865,7 @@ view_definition : create_view_keywords ddl_qualified_name //But if internal CQD is set, it is allowed. if(CmpCommon::getDefault(ALLOW_FIRSTN_IN_SUBQUERIES) != DF_ON) { - if ($8->getFirstNRows() != -1) + if ($9->getFirstNRows() != -1) { *SqlParser_Diags << DgSqlCode(-4103); YYERROR; @@ -27646,25 +27876,24 @@ view_definition : create_view_keywords ddl_qualified_name StmtDDLCreateView *pCreateViewParseNode = new (PARSERHEAP()) StmtDDLCreateView( - *$2 /*ddl_qualified_name*/, + *$3 /*ddl_qualified_name*/, *ParNameLocListPtr, - $3 /*optional_view_column_list*/, - $4 /*optional_location_clause*/, + $4 /*optional_view_column_list*/, + $5 /*optional_location_clause*/, top, - $10 /*optional_with_check_option*/, + $11 /*optional_with_check_option*/, $1 /*optional_create_view_behavior_enum*/, - $5 /*optional_by_auth_identifier*/); - delete $2 /*ddl_qualified_name*/; + $6 /*optional_by_auth_identifier*/); + + if ($2) + pCreateViewParseNode->setCreateIfNotExists(TRUE); + + delete $3 /*ddl_qualified_name*/; pCreateViewParseNode->synthesize(); if (ParSetTextEndPos(pCreateViewParseNode)) { yyerror(""); YYERROR; } $$ = pCreateViewParseNode; - // - // ParNameLocListPtr is no longer needed. - // - delete ParNameLocListPtr; - ParNameLocListPtr = NULL; } /* type tokval */ @@ -27694,8 +27923,9 @@ create_view_keywords : TOK_CREATE TOK_VIEW ParNameLocListPtr); $$ = COM_CREATE_VIEW_BEHAVIOR; + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::CREATE_, StmtDDLonHiveObjects::VIEW_); } - | TOK_CREATE TOK_SYSTEM TOK_VIEW { // see comment above @@ -27758,24 +27988,33 @@ routine_action_qualified_name : routine_action_name /* type pQualName */ ddl_qualified_name : qualified_name - { - // ddl_qualified_name : - // helps with computing view text - // - ParInsertNameLoc($1->getPosition(), - $1->getNameLength()); - // - // note that qualifiedNameFromStrings() - // contains code that deletes $1 - // - $$ = qualifiedNameFromStrings($1); - if ($$ == NULL) - YYABORT; - - $$ = processVolatileDDLName($$, FALSE, FALSE); - if ($$ == NULL) - YYABORT; - } + { + // ddl_qualified_name : + // helps with computing view text + // + StringPos namePos = $1->getPosition(); + size_t nameLen = $1->getNameLength(); + ParInsertNameLoc(namePos, nameLen); + + // + // note that qualifiedNameFromStrings() + // contains code that deletes $1 + // + $$ = qualifiedNameFromStrings($1); + if ($$ == NULL) + YYABORT; + + $$ = processVolatileDDLName($$, FALSE, FALSE); + if ($$ == NULL) + YYABORT; + + SqlParser_CurrentParser->hiveDDLInfo_->ddlNamePos_ = namePos; + SqlParser_CurrentParser->hiveDDLInfo_->ddlNameLen_ = nameLen; + + preprocessHiveDDL( + $$->getCatalogName(), + SqlParser_CurrentParser->hiveDDLInfo_); + } /* type pQualName */ volatile_ddl_qualified_name : qualified_name @@ -30146,10 +30385,6 @@ cleanup_objects_statement : TOK_CLEANUP cleanup_object_identifier ddl_qualified_ ot = StmtDDLCleanupObjects::SCHEMA_PRIVATE_; else if (*$2 == "SCHEMA_S") ot = StmtDDLCleanupObjects::SCHEMA_SHARED_; - else if (*$2 == "HIVE_TABLE") - ot = StmtDDLCleanupObjects::HIVE_TABLE_; - else if (*$2 == "HIVE_VIEW") - ot = StmtDDLCleanupObjects::HIVE_VIEW_; else if (*$2 == "HBASE_TABLE") ot = StmtDDLCleanupObjects::HBASE_TABLE_; else if (*$2 == "OBJECT") @@ -30294,10 +30529,23 @@ drop_sequence_statement : TOK_DROP TOK_SEQUENCE ddl_qualified_name } /* type pStmtDDL */ -drop_schema_statement : TOK_DROP TOK_SCHEMA schema_name_clause optional_cleanup +drop_schema_statement : TOK_DROP schema_or_database + { + + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::DROP_, StmtDDLonHiveObjects::SCHEMA_); + } + schema_name_clause optional_cleanup optional_drop_behavior { - NAString extSchName($3->getSchemaName().getSchemaNameAsAnsiString()); + // cannot use keyword DATABASE if not hive ddl. + if (($2 == 2) && + (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)) + { + YYERROR; + } + + NAString extSchName($4->getSchemaName().getSchemaNameAsAnsiString()); if (! validateVolatileSchemaName(extSchName)) { YYERROR; @@ -30305,17 +30553,29 @@ drop_schema_statement : TOK_DROP TOK_SCHEMA schema_name_clause optional_cleanup $$ = new (PARSERHEAP()) StmtDDLDropSchema( - *$3 /*schema_name_clause*/, - $5 /*optional_drop_behavior*/, - $4 /*optional_cleanup*/, + *$4 /*schema_name_clause*/, + $6 /*optional_drop_behavior*/, + $5 /*optional_cleanup*/, FALSE); - delete $3 /*schema_name*/; + delete $4 /*schema_name*/; } -drop_schema_statement : TOK_DROP TOK_SCHEMA TOK_IF TOK_EXISTS schema_name_clause optional_cleanup +drop_schema_statement : TOK_DROP schema_or_database TOK_IF TOK_EXISTS + { + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::DROP_, StmtDDLonHiveObjects::SCHEMA_, TRUE); + } + schema_name_clause optional_cleanup optional_drop_behavior { - NAString extSchName($5->getSchemaName().getSchemaNameAsAnsiString()); + // cannot use keyword DATABASE if not hive ddl. + if (($2 == 2) && + (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)) + { + YYERROR; + } + + NAString extSchName($6->getSchemaName().getSchemaNameAsAnsiString()); if (! validateVolatileSchemaName(extSchName)) { YYERROR; @@ -30324,12 +30584,12 @@ drop_schema_statement : TOK_DROP TOK_SCHEMA TOK_IF TOK_EXISTS schema_name_clause StmtDDLDropSchema *pNode = new (PARSERHEAP()) StmtDDLDropSchema( - *$5 /*schema_name_clause*/, - $7 /*optional_drop_behavior*/, - $6 /*optional_cleanup*/, + *$6 /*schema_name_clause*/, + $8 /*optional_drop_behavior*/, + $7 /*optional_cleanup*/, FALSE); pNode->setDropIfExists(TRUE); - delete $5 /*schema_name*/; + delete $6 /*schema_name*/; $$ = pNode; } @@ -31047,29 +31307,38 @@ alter_trigger_statement : TOK_ALTER TOK_TRIGGER enable_status delete $5; } +/* type uint */ +alter_view_start_tokens : TOK_ALTER TOK_VIEW + { + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::ALTER_, StmtDDLonHiveObjects::VIEW_); + + $$ = 0; + } /* type pStmtDDL */ -alter_view_statement : TOK_ALTER TOK_VIEW ddl_qualified_name - TOK_RENAME TOK_TO identifier +alter_view_statement : alter_view_start_tokens + ddl_qualified_name + TOK_RENAME TOK_TO identifier { $$ = new (PARSERHEAP())StmtDDLAlterView - ( *$3 // ddl_qualified_name (old name) - , *$6 // identifier (new name) + ( *$2 // ddl_qualified_name (old name) + , *$5 // identifier (new name) ); - delete $3; // ddl_qualified_name - delete $6; // identifier + delete $2; // ddl_qualified_name + delete $5; // identifier } - | TOK_ALTER TOK_VIEW ddl_qualified_name - TOK_COMPILE optional_cascade + | alter_view_start_tokens + ddl_qualified_name + TOK_COMPILE optional_cascade { $$ = new (PARSERHEAP())StmtDDLAlterView - ( *$3 // ddl_qualified_name (view name to validate) - , $5 // cascade TRUE or FALSE + ( *$2 // ddl_qualified_name (view name to validate) + , $4 // cascade TRUE or FALSE ); - delete $3; // ddl_qualified_name + delete $2; // ddl_qualified_name } - //---------------------------------------------------------------------------- //++ MV @@ -31283,18 +31552,42 @@ alter_catalog_statement: TOK_ALTER TOK_CATALOG sql_mx_catalog_name enable_status *$8); } +alter_schema_start_tokens : TOK_ALTER schema_or_database + { + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::ALTER_, StmtDDLonHiveObjects::SCHEMA_); + + $$ = $2; + } + /* type pStmtDDL */ -alter_schema_statement: TOK_ALTER TOK_SCHEMA schema_name_clause alter_stored_descriptor_option +alter_schema_statement: alter_schema_start_tokens + schema_name_clause alter_stored_descriptor_option { + // cannot use keyword DATABASE if not hive ddl. + if (($1 == 2) && + (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)) + { + YYERROR; + } + $$ = new (PARSERHEAP()) StmtDDLAlterSchema - (*$3, - (StmtDDLAlterTableStoredDesc::AlterStoredDescType)$4); + (*$2, + (StmtDDLAlterTableStoredDesc::AlterStoredDescType)$3); } - | TOK_ALTER TOK_SCHEMA schema_name_clause TOK_DROP TOK_ALL TOK_TABLES + | alter_schema_start_tokens + schema_name_clause TOK_DROP TOK_ALL TOK_TABLES { - NAString extSchName($3->getSchemaName().getSchemaNameAsAnsiString()); + // cannot use keyword DATABASE if not hive ddl. + if (($1 == 2) && + (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)) + { + YYERROR; + } + + NAString extSchName($2->getSchemaName().getSchemaNameAsAnsiString()); if (! validateVolatileSchemaName(extSchName)) { YYERROR; @@ -31302,15 +31595,23 @@ alter_schema_statement: TOK_ALTER TOK_SCHEMA schema_name_clause alter_stored_des $$ = new (PARSERHEAP()) StmtDDLDropSchema( - *$3 /*schema_name_clause*/, + *$2 /*schema_name_clause*/, COM_CASCADE_DROP_BEHAVIOR, FALSE /*optional_cleanup*/, TRUE); - delete $3 /*schema_name*/; + delete $2 /*schema_name*/; } - | TOK_ALTER TOK_SCHEMA schema_name_clause TOK_RENAME TOK_TO identifier + | alter_schema_start_tokens + schema_name_clause TOK_RENAME TOK_TO identifier { - NAString extSchName($3->getSchemaName().getSchemaNameAsAnsiString()); + // cannot use keyword DATABASE if not hive ddl. + if (($1 == 2) && + (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)) + { + YYERROR; + } + + NAString extSchName($2->getSchemaName().getSchemaNameAsAnsiString()); if (! validateVolatileSchemaName(extSchName)) { YYERROR; @@ -31318,12 +31619,12 @@ alter_schema_statement: TOK_ALTER TOK_SCHEMA schema_name_clause alter_stored_des $$ = new (PARSERHEAP()) StmtDDLAlterSchema( - *$3 /*schema_name_clause*/, - *$6); - delete $3 /*schema_name*/; - delete $6; // renamed schema + *$2 , //schema_name_clause + *$5); + delete $2; // schema_name + delete $5; // renamed schema } - + /* type pStmtDDL */ alter_library_statement : TOK_ALTER TOK_LIBRARY ddl_qualified_name TOK_FILE std_char_string_literal @@ -31429,40 +31730,53 @@ drop_library_statement : TOK_DROP TOK_LIBRARY ddl_qualified_name optional_drop_b delete $3 /*ddl_qualified_name*/; } +/* type uint */ +alter_table_start_tokens : TOK_ALTER optional_ghost TOK_TABLE + { + if ($2) + $$ = 1; + else + $$ = 0; + + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::ALTER_, StmtDDLonHiveObjects::TABLE_); + } + /* type pStmtDDL */ -alter_table_statement : TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name +alter_table_statement : alter_table_start_tokens + ddl_qualified_name alter_table_action { - $$ = $5 /*alter_table_action*/; - if ($2) /*optional_ghost*/ + $$ = $3 /*alter_table_action*/; + if ($1) /*optional_ghost*/ $$->setIsGhostObject(TRUE); $$->castToStmtDDLAlterTable()-> - setTableName(QualifiedName (*$4 /*ddl_qualified_name*/, + setTableName(QualifiedName (*$2 /*ddl_qualified_name*/, PARSERHEAP())); if($$->castToStmtDDLAlterTableAddColumn()) { $$->castToStmtDDLAlterTableAddColumn()-> synthesize(); } - delete $4 /*ddl_qualified_name*/; + delete $2 /*ddl_qualified_name*/; } - | TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name + | alter_table_start_tokens ddl_qualified_name is_not_droppable { StmtDDLAlterTable *pNode = new (PARSERHEAP()) StmtDDLAlterTable(DDL_ALTER_TABLE_DROPPABLE); pNode->setTableName(QualifiedName - (*$4 /*ddl_qualified_name*/, + (*$2 /*ddl_qualified_name*/, PARSERHEAP())); - pNode->setIsDroppable(!$5); + pNode->setIsDroppable(!$3); $$ = pNode; - delete $4 /*ddl_qualified_name*/; - if ($2) /*optional_ghost*/ + delete $2 /*ddl_qualified_name*/; + if ($1) /*optional_ghost*/ $$->setIsGhostObject(TRUE); } - | TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name + | alter_table_start_tokens ddl_qualified_name TOK_INSERT_ONLY { if (CmpCommon::getDefault(CAT_ALLOW_NEW_FEATUREX) == DF_OFF) @@ -31475,16 +31789,16 @@ alter_table_statement : TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name StmtDDLAlterTable *pNode = new (PARSERHEAP()) StmtDDLAlterTable(DDL_ALTER_TABLE_INSERT_ONLY); pNode->setTableName(QualifiedName - (*$4 /*ddl_qualified_name*/, + (*$2 /*ddl_qualified_name*/, PARSERHEAP())); pNode->setInsertOnly(TRUE); $$ = pNode; - delete $4 /*ddl_qualified_name*/; - if ($2) /*optional_ghost*/ + delete $2 /*ddl_qualified_name*/; + if ($1) /*optional_ghost*/ $$->setIsGhostObject(TRUE); } - | TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name TOK_NAMESPACE + | alter_table_start_tokens ddl_qualified_name TOK_NAMESPACE { if ( ! Get_SqlParser_Flags(ALLOW_SPECIALTABLETYPE) && ( CmpCommon::getDefault(ALLOW_GHOST_OBJECTS) == DF_OFF ) @@ -31496,37 +31810,35 @@ alter_table_statement : TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name } $$ = new (PARSERHEAP()) StmtDDLAlterTableNamespace - (*$4); + (*$2); $$->castToStmtDDLAlterTable()-> setTableName(QualifiedName - (*$4 /*ddl_qualified_name*/, + (*$2 /*ddl_qualified_name*/, PARSERHEAP())); - if($2) + if($1) $$->setIsGhostObject(TRUE); else $$->setIsGhostObject(FALSE); - delete $4; // identifier + delete $2; // identifier } - | TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name online_or_offline + | alter_table_start_tokens ddl_qualified_name online_or_offline { StmtDDLAlterTable *pNode = new (PARSERHEAP()) StmtDDLAlterTable(DDL_ALTER_TABLE_TOGGLE_ONLINE); - pNode->setTableName(QualifiedName(*$4 , PARSERHEAP())); - pNode->setIsOnline($5); + pNode->setTableName(QualifiedName(*$2 , PARSERHEAP())); + pNode->setIsOnline($3); $$ = pNode; - if($2) - $$->setIsGhostObject(TRUE); + if($1) + $$->setIsGhostObject(TRUE); else - $$->setIsGhostObject(FALSE); - delete $4; + $$->setIsGhostObject(FALSE); + delete $2; } - | TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name online_or_offline TOK_FOR TOK_PURGEDATA + | alter_table_start_tokens ddl_qualified_name online_or_offline TOK_FOR TOK_PURGEDATA { if ((NOT Get_SqlParser_Flags(ALLOW_SPECIALTABLETYPE)) || - // (NOT Get_SqlParser_Flags(INTERNAL_QUERY_FROM_EXEUTIL)) || - ($2)) - //(CmpCommon::getDefault(EXE_PARALLEL_PURGEDATA) == DF_OFF)) + ($2)) // ghost { yyerror(""); YYERROR; /*internal syntax only!*/ @@ -31534,12 +31846,12 @@ alter_table_statement : TOK_ALTER optional_ghost TOK_TABLE ddl_qualified_name StmtDDLAlterTable *pNode = new (PARSERHEAP()) StmtDDLAlterTable(DDL_ALTER_TABLE_TOGGLE_ONLINE); - pNode->setTableName(QualifiedName(*$4 , PARSERHEAP())); - pNode->setIsOnline($5); + pNode->setTableName(QualifiedName(*$2 , PARSERHEAP())); + pNode->setIsOnline($3); pNode->setForPurgedata(TRUE); $$ = pNode; $$->setIsGhostObject(FALSE); - delete $4; + delete $2; } | TOK_ALTER TOK_VOLATILE TOK_TABLE volatile_ddl_qualified_name alter_table_action @@ -32369,6 +32681,9 @@ drop_table_statement : TOK_DROP special_table_name optional_drop_behavior drop_table_start_tokens : TOK_DROP TOK_TABLE { $$ = 0; + + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::DROP_, StmtDDLonHiveObjects::TABLE_); } | TOK_DROP ghost TOK_TABLE { @@ -32377,13 +32692,17 @@ drop_table_start_tokens : TOK_DROP TOK_TABLE | TOK_DROP TOK_TABLE TOK_IF TOK_EXISTS { $$ = 2; + + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::DROP_, StmtDDLonHiveObjects::TABLE_, TRUE); } | TOK_DROP TOK_EXTERNAL TOK_TABLE { $$ = 3; } | TOK_DROP TOK_EXTERNAL TOK_TABLE TOK_IF TOK_EXISTS - { + { + SqlParser_CurrentParser->hiveDDLInfo_->ifExistsOrNotExists_ = TRUE; $$ = 4; } @@ -32523,12 +32842,17 @@ drop_routine_statement : TOK_DROP drop_routine_type_tokens optional_if_exists_cl } /* type pStmtDDL */ -drop_view_statement : TOK_DROP TOK_VIEW ddl_qualified_name optional_cleanup +drop_view_statement : TOK_DROP TOK_VIEW optional_if_exists_clause + { + SqlParser_CurrentParser->hiveDDLInfo_-> + setValues(TRUE, StmtDDLonHiveObjects::DROP_, StmtDDLonHiveObjects::VIEW_, $3); + } + ddl_qualified_name optional_cleanup optional_drop_invalidate_dependent_behavior optional_validate optional_logfile { /* If VALIDATE, or LOG option specified, */ /* ALLOW_SPECIALTABLETYPE must also be specified */ - if (($6 || $7) && + if (($8 || $9) && !Get_SqlParser_Flags(ALLOW_SPECIALTABLETYPE)) { yyerror(""); YYERROR; /*internal syntax only!*/ @@ -32536,18 +32860,25 @@ drop_view_statement : TOK_DROP TOK_VIEW ddl_qualified_name optional_cleanup else { NAString *pLogFile = NULL; - if ($7) + if ($9) pLogFile = new (PARSERHEAP()) NAString - ( $7->data(), PARSERHEAP()); - $$ = new (PARSERHEAP()) - StmtDDLDropView( - *$3 /*ddl_qualified_name*/, - $5 /*optional_drop_invalidate_dependent_behavior*/, - $4 /*for CLEANUP mode set to TRUE*/, - $6 /*for VALIDATE mode set to FALSE*/, + ( $9->data(), PARSERHEAP()); + StmtDDLDropView * dropView = new (PARSERHEAP()) + StmtDDLDropView( + *$5 /*ddl_qualified_name*/, + $7 /*optional_drop_invalidate_dependent_behavior*/, + $6 /*for CLEANUP mode set to TRUE*/, + $8 /*for VALIDATE mode set to FALSE*/, pLogFile /*log_file_name*/); - delete $3 /*ddl_qualified_name*/; - delete $7 /*log_file_name*/; + + if ($3) + { + dropView->setDropIfExists(TRUE); + } + + delete $5 /*ddl_qualified_name*/; + delete $9 /*log_file_name*/; + $$ = dropView; } } @@ -32852,7 +33183,7 @@ nsk_node_name: BACKSLASH_SYSTEM_NAME // register [internal] hive {table|view|schema} // [if not exists] <obj-name> [cascade] // -register_hive_statement : TOK_REGISTER optional_internal_clause TOK_HIVE object_identifier optional_if_not_exists_clause ddl_qualified_name optional_cascade +register_hive_statement : TOK_REGISTER optional_internal_clause TOK_HIVE object_identifier optional_if_not_registered_clause ddl_qualified_name optional_cascade { if (NOT ((*$4 == "TABLE") || (*$4 == "VIEW") || @@ -32886,7 +33217,7 @@ register_hive_statement : TOK_REGISTER optional_internal_clause TOK_HIVE object_ // unregister [internal] hive {table|view|schema} // [if exists] <obj-name> [cascade] // -unregister_hive_statement : TOK_UNREGISTER optional_internal_clause TOK_HIVE object_identifier optional_if_exists_clause ddl_qualified_name optional_cascade optional_cleanup +unregister_hive_statement : TOK_UNREGISTER optional_internal_clause TOK_HIVE object_identifier optional_if_registered_clause ddl_qualified_name optional_cascade optional_cleanup { if (NOT ((*$4 == "TABLE") || (*$4 == "VIEW") || @@ -32919,7 +33250,7 @@ unregister_hive_statement : TOK_UNREGISTER optional_internal_clause TOK_HIVE obj /* type pStmtDDL */ // Syntax: register [internal] hbase table [if not exists] <table-name> -register_hbase_statement : TOK_REGISTER optional_internal_clause TOK_HBASE TOK_TABLE optional_if_not_exists_clause ddl_qualified_name +register_hbase_statement : TOK_REGISTER optional_internal_clause TOK_HBASE TOK_TABLE optional_if_not_registered_clause ddl_qualified_name { StmtDDLRegOrUnregObject *pNode = new (PARSERHEAP()) StmtDDLRegOrUnregObject( @@ -32939,7 +33270,7 @@ register_hbase_statement : TOK_REGISTER optional_internal_clause TOK_HBASE TOK_T /* type pStmtDDL */ // Syntax: unregister [internal] hbase table [if exists] <table-name> -unregister_hbase_statement : TOK_UNREGISTER optional_internal_clause TOK_HBASE TOK_TABLE optional_if_exists_clause ddl_qualified_name optional_cleanup +unregister_hbase_statement : TOK_UNREGISTER optional_internal_clause TOK_HBASE TOK_TABLE optional_if_registered_clause ddl_qualified_name optional_cleanup { $$ = new (PARSERHEAP()) StmtDDLRegOrUnregObject( @@ -33008,16 +33339,6 @@ drop_role_statement : TOK_DROP TOK_ROLE authorization_identifier delete $3; } -/* type pStmtDDL : ALTER DATABASE */ -alter_database_statement: TOK_ALTER TOK_DATABASE enable_status TOK_AUTHORIZATION - TOK_CHANGES - { - $$ = new (PARSERHEAP()) StmtDDLAlterDatabase - ( StmtDDLAlterDatabase::DBCMDTYPE_AUTHNAME - , $3 ); - } - - /* type pStmtDDL */ create_component_privilege_stmt : TOK_CREATE TOK_COMPONENT TOK_PRIVILEGE component_privilege_name @@ -33154,7 +33475,7 @@ create_synonym_stmt : TOK_CREATE TOK_SYNONYM } /* type longint */ -options : optional_options +showplan_options : optional_options { if ($1 == NULL) { http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/parser/ulexer.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/ulexer.cpp b/core/sql/parser/ulexer.cpp index 8fc8df4..26b1afb 100644 --- a/core/sql/parser/ulexer.cpp +++ b/core/sql/parser/ulexer.cpp @@ -569,13 +569,15 @@ Int32 yyULexer::setStringval(Int32 tokCod, const char *dbgstr, YYSTYPE *lvalp) (YYText(),YYLeng(),targetMBCS,PARSERHEAP()); if ( - (tokCod == DELIMITED_IDENTIFIER || tokCod == IDENTIFIER) + (tokCod == DELIMITED_IDENTIFIER || tokCod == IDENTIFIER || + tokCod == BACKQUOTED_IDENTIFIER) && targetMBCS != CharInfo::ISO88591 ) { NAString* tempstr = lvalp->stringval; // targetMBCS == ParScannedInputCharset if (tempstr == NULL) return invalidStrLitNonTranslatableChars(lvalp); + Int32 TSLen = (Int32)tempstr->length(); Int32 YYLen = (Int32)YYLeng(); if(TSLen != YYLen){ // need offset of ORIGINAL string @@ -2031,6 +2033,27 @@ Int32 yyULexer::yylex(YYSTYPE *lvalp) } } return prematureEOF(lvalp); + case L'`': + // "delimited identifier" enclosed within backquotes (`) + // + advance(); + while ((cc=peekAdvance()) != WEOF) + { + if (cc == L'`') + if ((cc= peekChar()) == L'`') + advance(); + else + { + doBeforeAction(); + // In Trafodion text, double quoted strings are + // delimited identifiers. + // + return setStringval(BACKQUOTED_IDENTIFIER, + DBGMSG("Backquoted identifier %s\n"), + lvalp); + } + } + return prematureEOF(lvalp); case L'.': advance(); if (U_isdigit(cc=peekChar())) http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/regress/compGeneral/EXPECTEDTOK ---------------------------------------------------------------------- diff --git a/core/sql/regress/compGeneral/EXPECTEDTOK b/core/sql/regress/compGeneral/EXPECTEDTOK index 9c3aa03..e2bd723 100644 --- a/core/sql/regress/compGeneral/EXPECTEDTOK +++ b/core/sql/regress/compGeneral/EXPECTEDTOK @@ -7,9 +7,9 @@ nnnn conflicts: 8 shift/reduce nnnn primary: row_subquery . nnnn conflicts: 1 shift/reduce nnnn sql_statement: TOK_BEGIN . TOK_DECLARE TOK_SECTION nnnn conflicts: 9 shift/reduce nnnn row_subquery: '(' row_subquery . ')' nnnn conflicts: 1 reduce/reduce nnnn row_subquery: rel_subquery . -nnnn conflicts: 1 reduce/reduce nnnn transaction_statement: TOK_BEGIN . nnnn conflicts: 1 shift/reduce nnnn show_statement: TOK_SHOWCONTROL showcontrol_type . optional_control_identifier optional_comma_match_clause nnnn conflicts: 1 shift/reduce nnnn table_as_stream_any: table_as_stream . +nnnn conflicts: 1 reduce/reduce nnnn transaction_statement: TOK_BEGIN . nnnn conflicts: 1 shift/reduce nnnn row_subquery: '(' row_subquery . ')' nnnn conflicts: 1 shift/reduce nnnn input_hostvar_expression: HOSTVAR . nnnn conflicts: 1 reduce/reduce nnnn primary: row_subquery . @@ -31,13 +31,13 @@ nnnn conflicts: 2 shift/reduce, 1 reduce/reduce nnnn query_exp_for_cursor: query nnnn conflicts: 8 shift/reduce nnnn query_spec_body: query_select_list into_clause table_expression . access_type optional_lock_mode nnnn conflicts: 1 shift/reduce nnnn query_spec_body: query_select_list table_expression access_type . optional_lock_mode nnnn conflicts: 1 shift/reduce nnnn mv_definition: create_mv_keywords ddl_qualified_name optional_view_column_list refresh_type . create_mv_attribute_table_lists mv_initialization_clause optional_query_rewrite optional_create_mv_file_options optional_in_memory_clause as_token query_expression +nnnn conflicts: 1 shift/reduce nnnn file_attribute_clause: file_attribute_keyword file_attribute_list . nnnn conflicts: 1 shift/reduce nnnn table_name_and_hint: table_name . optimizer_hint hbase_access_options nnnn conflicts: 1 shift/reduce nnnn table_reference: table_as_procedure . nnnn conflicts: 1 shift/reduce nnnn table_reference: table_as_stream_any . nnnn conflicts: 1 shift/reduce nnnn table_reference: table_as_tmudf_function . nnnn conflicts: 1 shift/reduce nnnn table_reference: rel_subquery . nnnn conflicts: 1 shift/reduce nnnn query_spec_body: query_select_list into_clause table_expression access_type . optional_lock_mode -nnnn conflicts: 1 shift/reduce nnnn file_attribute_clause: file_attribute_keyword file_attribute_list . nnnn conflicts: 1 shift/reduce nnnn id_group: '(' identifier . ')' TOK_TO identifier nnnn conflicts: 1 reduce/reduce nnnn table_reference: '(' Front_Of_Insert . Rest_Of_insert_statement ')' as_clause nnnn conflicts: 1 shift/reduce nnnn transpose_list: transpose_set . http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/regress/compGeneral/EXPECTEDTOK2 ---------------------------------------------------------------------- diff --git a/core/sql/regress/compGeneral/EXPECTEDTOK2 b/core/sql/regress/compGeneral/EXPECTEDTOK2 index 9c3aa03..e2bd723 100644 --- a/core/sql/regress/compGeneral/EXPECTEDTOK2 +++ b/core/sql/regress/compGeneral/EXPECTEDTOK2 @@ -7,9 +7,9 @@ nnnn conflicts: 8 shift/reduce nnnn primary: row_subquery . nnnn conflicts: 1 shift/reduce nnnn sql_statement: TOK_BEGIN . TOK_DECLARE TOK_SECTION nnnn conflicts: 9 shift/reduce nnnn row_subquery: '(' row_subquery . ')' nnnn conflicts: 1 reduce/reduce nnnn row_subquery: rel_subquery . -nnnn conflicts: 1 reduce/reduce nnnn transaction_statement: TOK_BEGIN . nnnn conflicts: 1 shift/reduce nnnn show_statement: TOK_SHOWCONTROL showcontrol_type . optional_control_identifier optional_comma_match_clause nnnn conflicts: 1 shift/reduce nnnn table_as_stream_any: table_as_stream . +nnnn conflicts: 1 reduce/reduce nnnn transaction_statement: TOK_BEGIN . nnnn conflicts: 1 shift/reduce nnnn row_subquery: '(' row_subquery . ')' nnnn conflicts: 1 shift/reduce nnnn input_hostvar_expression: HOSTVAR . nnnn conflicts: 1 reduce/reduce nnnn primary: row_subquery . @@ -31,13 +31,13 @@ nnnn conflicts: 2 shift/reduce, 1 reduce/reduce nnnn query_exp_for_cursor: query nnnn conflicts: 8 shift/reduce nnnn query_spec_body: query_select_list into_clause table_expression . access_type optional_lock_mode nnnn conflicts: 1 shift/reduce nnnn query_spec_body: query_select_list table_expression access_type . optional_lock_mode nnnn conflicts: 1 shift/reduce nnnn mv_definition: create_mv_keywords ddl_qualified_name optional_view_column_list refresh_type . create_mv_attribute_table_lists mv_initialization_clause optional_query_rewrite optional_create_mv_file_options optional_in_memory_clause as_token query_expression +nnnn conflicts: 1 shift/reduce nnnn file_attribute_clause: file_attribute_keyword file_attribute_list . nnnn conflicts: 1 shift/reduce nnnn table_name_and_hint: table_name . optimizer_hint hbase_access_options nnnn conflicts: 1 shift/reduce nnnn table_reference: table_as_procedure . nnnn conflicts: 1 shift/reduce nnnn table_reference: table_as_stream_any . nnnn conflicts: 1 shift/reduce nnnn table_reference: table_as_tmudf_function . nnnn conflicts: 1 shift/reduce nnnn table_reference: rel_subquery . nnnn conflicts: 1 shift/reduce nnnn query_spec_body: query_select_list into_clause table_expression access_type . optional_lock_mode -nnnn conflicts: 1 shift/reduce nnnn file_attribute_clause: file_attribute_keyword file_attribute_list . nnnn conflicts: 1 shift/reduce nnnn id_group: '(' identifier . ')' TOK_TO identifier nnnn conflicts: 1 reduce/reduce nnnn table_reference: '(' Front_Of_Insert . Rest_Of_insert_statement ')' as_clause nnnn conflicts: 1 shift/reduce nnnn transpose_list: transpose_set . http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/regress/hive/DIFF003.KNOWN ---------------------------------------------------------------------- diff --git a/core/sql/regress/hive/DIFF003.KNOWN b/core/sql/regress/hive/DIFF003.KNOWN index f8803ea..1b183ce 100644 --- a/core/sql/regress/hive/DIFF003.KNOWN +++ b/core/sql/regress/hive/DIFF003.KNOWN @@ -1,9 +1,9 @@ -543,546d542 +539,542d538 < *** WARNING[6008] Statistics for column (SS_SOLD_DATE_SK) from table HIVE.HIVE.STORE_SALES were not available. As a result, the access path chosen might not be the best possible. < < *** WARNING[6008] Statistics for column (SS_STORE_SK) from table HIVE.HIVE.STORE_SALES were not available. As a result, the access path chosen might not be the best possible. < -555,560c551,557 +551,556c547,553 < 6 . 7 root 2.92E+006 < 5 . 6 esp_exchange 1:2(hash2) 2.92E+006 < 3 . 5 hive_insert INS_STORE_SALES_SUMM 2.92E+006 @@ -18,7 +18,7 @@ > 2 . 3 esp_exchange 2(hash2):2(hash2) 1.09E+004 > 1 . 2 hash_partial_groupby 1.09E+004 > . . 1 hive_scan STORE_SALES 2.75E+006 -597,601c594 +593,597c590 < 3,10c3,4 < < *** WARNING[6008] Statistics for column (SS_SOLD_DATE_SK) from table HIVE.HIVE.STORE_SALES were not available. As a result, the access path chosen might not be the best possible. < < @@ -26,12 +26,12 @@ < < --- > 3,6c3,4 -615,618d607 +611,614d603 < *** WARNING[6008] Statistics for column (SS_SOLD_DATE_SK) from table HIVE.HIVE.STORE_SALES were not available. As a result, the access path chosen might not be the best possible. < < *** WARNING[6008] Statistics for column (SS_STORE_SK) from table HIVE.HIVE.STORE_SALES were not available. As a result, the access path chosen might not be the best possible. < -627,633c616,623 +623,629c612,619 < 8 . 9 root 2.92E+006 < 1 7 8 blocked_union 2.92E+006 < 6 . 7 esp_exchange 1:2(hash2) 2.92E+006 http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/regress/hive/DIFF008.KNOWN ---------------------------------------------------------------------- diff --git a/core/sql/regress/hive/DIFF008.KNOWN b/core/sql/regress/hive/DIFF008.KNOWN new file mode 100644 index 0000000..36d5524 --- /dev/null +++ b/core/sql/regress/hive/DIFF008.KNOWN @@ -0,0 +1,7 @@ +280c280,283 +< --- SQL command prepared. +--- +> *** ERROR[4002] Column T00804.A is not found. Table T00804 not exposed. Tables in scope: HIVE.HIVE.T00804. Default schema: HIVE.SCH008. +> +> *** ERROR[8822] The statement was not prepared. +> http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/regress/hive/DIFF009.KNOWN ---------------------------------------------------------------------- diff --git a/core/sql/regress/hive/DIFF009.KNOWN b/core/sql/regress/hive/DIFF009.KNOWN new file mode 100644 index 0000000..1d1cb73 --- /dev/null +++ b/core/sql/regress/hive/DIFF009.KNOWN @@ -0,0 +1,3 @@ +1071a1072,1073 +> *** WARNING[6008] Statistics for column (D_DATE) from table HIVE.HIVE.DATE_DIM were not available. As a result, the access path chosen might not be the best possible. +> http://git-wip-us.apache.org/repos/asf/trafodion/blob/6f490daf/core/sql/regress/hive/EXPECTED003 ---------------------------------------------------------------------- diff --git a/core/sql/regress/hive/EXPECTED003 b/core/sql/regress/hive/EXPECTED003 index e0f81a4..d4cafb8 100644 --- a/core/sql/regress/hive/EXPECTED003 +++ b/core/sql/regress/hive/EXPECTED003 @@ -528,7 +528,7 @@ T_TIME_SK T_TIME_ID T_TIME T_HOUR T_MINUTE T >>cqd HIVE_MAX_STRING_LENGTH_IN_BYTES '25' ; --- SQL operation complete. ->>truncate ins_store_sales_summary; +>>truncate table ins_store_sales_summary; --- SQL operation complete. >>control query shape esp_exchange(cut);
