[GitHub] incubator-trafodion pull request #1334: [TRAFODION-2804] Limit clause suppor...
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1334#discussion_r156551285 --- Diff: core/sql/regress/compGeneral/TEST045 --- @@ -498,8 +512,36 @@ update statistics for table date_dim on every column; update statistics for table date_dim on (d_qoy, d_year); update statistics for table store_sales on every column; + + + +?section common_subexpr --- End diff -- OK, understood. ---
[GitHub] incubator-trafodion pull request #1334: [TRAFODION-2804] Limit clause suppor...
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1334#discussion_r156549330 --- Diff: core/sql/regress/compGeneral/TEST045 --- @@ -498,8 +512,36 @@ update statistics for table date_dim on every column; update statistics for table date_dim on (d_qoy, d_year); update statistics for table store_sales on every column; + + + +?section common_subexpr --- End diff -- Sorry, didn't realize "common subexpressions" is name of a feature. Will find a better place to put these tests. ---
[GitHub] incubator-trafodion pull request #1334: [TRAFODION-2804] Limit clause suppor...
GitHub user EEDY opened a pull request: https://github.com/apache/incubator-trafodion/pull/1334 [TRAFODION-2804] Limit clause support in statements LOAD/INSERT/CREATE-TABLE + query add "LIMIT" clause support for statements create-as-select, insert-into-select and load-into-select You can merge this pull request into a Git repository by running: $ git pull https://github.com/EEDY/incubator-trafodion limit_clause Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/1334.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1334 commit 083f58d651f7e7ca631590fb7479df3b037d16fc Author: eedy <cqlc...@gmail.com> Date: 2017-11-14T09:44:58Z limit clause support in create-as-select/load-into-select: syntax support 1. add syntax support commit f574b540d6ba7de35493a672da544887b7d146e6 Author: eedy <cqlc...@gmail.com> Date: 2017-11-22T12:48:35Z add limit clause for insert-as-select statement add limit clause for insert-as-select statement commit 2299f3dfc156ca230c935c4ac150f7037d5d4dde Author: eedy <cqlc...@gmail.com> Date: 2017-12-03T11:43:31Z add limit clause support for LOAD-INTO statement. add limit clause support for LOAD-INTO statement. ---
[GitHub] incubator-trafodion pull request #1327: [TRAFODION-2803] add regression test...
GitHub user EEDY opened a pull request: https://github.com/apache/incubator-trafodion/pull/1327 [TRAFODION-2803] add regression test for COMMENT-ON statement add regression test for COMMENT-ON statement [https://issues.apache.org/jira/browse/TRAFODION-2803](url) You can merge this pull request into a Git repository by running: $ git pull https://github.com/EEDY/incubator-trafodion master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/1327.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1327 commit 18e4d721780b22e22a0308881c98f0fe0998a1d4 Author: EEDY <cqlc...@gmail.com> Date: 2017-12-06T06:43:25Z add regression test for COMMENT-ON statement ---
[GitHub] incubator-trafodion pull request #1301: new COMMENT-ON SQL statement: resolv...
GitHub user EEDY opened a pull request: https://github.com/apache/incubator-trafodion/pull/1301 new COMMENT-ON SQL statement: resolve merge conflict 1. resolve enum type conflict while merging to esgyn Compiled and test. You can merge this pull request into a Git repository by running: $ git pull https://github.com/EEDY/incubator-trafodion master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/1301.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1301 commit ad6d7350cef85de36e4af0cf035f1e557054aec4 Author: eedy <cqlc...@gmail.com> Date: 2017-11-16T04:04:33Z new COMMENT-ON SQL statement: resolve merge conflict 1. resolve enum type conflict while merging to esgyn ---
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150739956 --- Diff: core/sql/sqlcomp/CmpDescribe.cpp --- @@ -3059,6 +3061,54 @@ short CmpDescribeSeabaseTable ( outputLongLine(*space, viewtext, 0); + //display comment for VIEW + if (objectUID > 0) +{ + if (cmpSBD.switchCompiler()) +{ + *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS); + return -1; +} + + ComTdbVirtObjCommentInfo objCommentInfo; + if (cmpSBD.getSeabaseObjectComment(objectUID, COM_VIEW_OBJECT, objCommentInfo, heap)) +{ + *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS); + return -1; --- End diff -- Yes, we should. I will add compiler switch-back for all these error paths. ---
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150739473 --- Diff: core/sql/parser/sqlparser.y --- @@ -33167,7 +33173,106 @@ stats_merge_clause : /*empty */ { $$ = SQLCLI_PROGRESS_STATS; } | TOK_DEFAULT { $$ = SQLCLI_SAME_STATS; } - + + +/* type pStmtDDL */ +comment_on_statement : TOK_COMMENT TOK_ON comment_on_object_types ddl_qualified_name TOK_IS QUOTED_STRING + { + StmtDDLCommentOn *pNode = + new(PARSERHEAP()) StmtDDLCommentOn( + $3, + *$4, + *$6, + PARSERHEAP() + ); + + $$ = pNode; + } + | TOK_COMMENT TOK_ON TOK_SCHEMA schema_name TOK_IS QUOTED_STRING + { + // EJF L4J - CQD dynamic are not allowed in Compound Statements --- End diff -- No, i do not want to disallow COMMENT ON within a compound statement. I will remove this comment and if branch. ---
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150739440 --- Diff: core/sql/common/ComSmallDefs.h --- @@ -660,7 +662,9 @@ enum ComTextType {COM_VIEW_TEXT = 0, COM_HBASE_COL_FAMILY_TEXT = 5, COM_HBASE_SPLIT_TEXT = 6, COM_STORED_DESC_TEXT = 7, - COM_VIEW_REF_COLS_TEXT = 8 + COM_VIEW_REF_COLS_TEXT = 8, + COM_OBJET_COMMENT_TEXT = COM_TABLE_COMMENT_TEXT, --- End diff -- Yes, it should be COM_OBJECT_COMMENT_TEXT. ---
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1288#discussion_r149039000 --- Diff: core/sql/sqlcomp/CmpSeabaseDDLmd.h --- @@ -115,7 +115,8 @@ static const QString seabaseColumnsDDL[] = {" hbase_col_qualifier varchar(40) character set iso88591 not null not serialized, "}, {" direction char(2) character set iso88591 not null not serialized, "}, {" is_optional char(2) character set iso88591 not null not serialized, "}, - {" flags largeint not null not serialized "}, + {" flags largeint not null not serialized, "}, + {" comment VARCHAR(1000) CHARACTER SET UTF8 NOT NULL NOT SERIALIZED "}, --- End diff -- Need more time to do this TEXT table modification. ---
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1288#discussion_r149038713 --- Diff: core/sql/sqlcomp/CmpDescribe.cpp --- @@ -3059,6 +3061,36 @@ short CmpDescribeSeabaseTable ( outputLongLine(*space, viewtext, 0); + //display comment for VIEW + if (objectUID > 0/* && COMMENT_CQD*/) +{ + if (cmpSBD.switchCompiler()) +{ + *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_PRIVS); + return -1; --- End diff -- I add a new error code CAT_UNABLE_TO_RETRIEVE_COMMENTS=1033, is this a good way? ---
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1288#discussion_r149038134 --- Diff: core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp --- @@ -0,0 +1,202 @@ +/** +// @@@ 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 @@@ +**/ + +/* -*-C++-*- + * + * + * File: CmpSeabaseDDLcommentOn.cpp + * Description: Implements ddl operations for Seabase indexes. + * + * + * Created: 8/17/2017 + * Language: C++ + * + * + * + */ + +#define SQLPARSERGLOBALS_FLAGS // must precede all #include's +#define SQLPARSERGLOBALS_NADEFAULTS + +#include "ComObjectName.h" + +#include "CmpDDLCatErrorCodes.h" +#include "ElemDDLHbaseOptions.h" + +#include "SchemaDB.h" +#include "CmpSeabaseDDL.h" +#include "CmpDescribe.h" + +#include "ExpHbaseInterface.h" + +#include "ExExeUtilCli.h" +#include "Generator.h" + +#include "ComCextdecs.h" +#include "ComUser.h" + +#include "NumericType.h" + +#include "PrivMgrCommands.h" + +#include "StmtDDLCommentOn.h" + +#include "PrivMgrComponentPrivileges.h" +#include "PrivMgrCommands.h" +#include "ComUser.h" + + +void CmpSeabaseDDL::doSeabaseCommentOn(StmtDDLCommentOn *commentOnNode, +NAString , +NAString ) +{ + Lng32 cliRC; + Lng32 retcode; + + enum ComObjectType enMDObjType = COM_UNKNOWN_OBJECT; + + ComObjectName objectName(commentOnNode->getObjectName()); + ComAnsiNamePart currCatAnsiName(currCatName); + ComAnsiNamePart currSchAnsiName(currSchName); + objectName.applyDefaults(currCatAnsiName, currSchAnsiName); + + enum StmtDDLCommentOn::COMMENT_ON_TYPES commentObjectType = commentOnNode->getObjectType(); + + switch (commentObjectType) +{ +case StmtDDLCommentOn::COMMENT_ON_TYPE_TABLE: +enMDObjType = COM_BASE_TABLE_OBJECT; +break; + +case StmtDDLCommentOn::COMMENT_ON_TYPE_COLUMN: +enMDObjType = COM_BASE_TABLE_OBJECT; +break; + +case StmtDDLCommentOn::COMMENT_ON_TYPE_INDEX: +enMDObjType = COM_INDEX_OBJECT; +break; + +case StmtDDLCommentOn::COMMENT_ON_TYPE_SCHEMA: +enMDObjType = COM_PRIVATE_SCHEMA_OBJECT; +break; + +case StmtDDLCommentOn::COMMENT_ON_TYPE_VIEW: +enMDObjType = COM_VIEW_OBJECT; +break; + +case StmtDDLCommentOn::COMMENT_ON_TYPE_LIBRARY: +enMDObjType = COM_LIBRARY_OBJECT; +break; + +case StmtDDLCommentOn::COMMENT_ON_TYPE_PROCEDURE: +case StmtDDLCommentOn::COMMENT_ON_TYPE_FUNCTION: +enMDObjType = COM_USER_DEFINED_ROUTINE_OBJECT; +break; + +default: +break; + +} + + NAString catalogNamePart = objectName.getCatalogNamePartAsAnsiString(); + NAString schemaNamePart = objectName.getSchemaNamePartAsAnsiString(TRUE); + NAString objNamePart = objectName.getObjectNamePartAsAnsiString(TRUE); + + const NAString extObjName = objectName.getExternalName(TRUE); + + ExeCliInterface cliInterface(STMTHEAP, NULL, NULL, +
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1288#discussion_r149039165 --- Diff: core/sql/parser/sqlparser.y --- @@ -33167,7 +33173,102 @@ stats_merge_clause : /*empty */ { $$ = SQLCLI_PROGRESS_STATS; } | TOK_DEFAULT { $$ = SQLCLI_SAME_STATS; } - + + +/* type pStmtDDL */ +comment_on_statement : TOK_COMMENT TOK_ON comment_on_object_types ddl_qualified_name TOK_IS QUOTED_STRING + { + StmtDDLCommentOn *pNode = + new(PARSERHEAP()) StmtDDLCommentOn( + $3, + *$4, + *$6, + PARSERHEAP() + ); + + $$ = pNode; + } + | TOK_COMMENT TOK_ON TOK_SCHEMA schema_name TOK_IS QUOTED_STRING + { + // EJF L4J - CQD dynamic are not allowed in Compound Statements + if (beginsWith(SQLTEXT(),"BEGIN")) { + *SqlParser_Diags << DgSqlCode(-3175); + YYERROR; + } + else { // business as usual + NAString tmpSchema($4->getSchemaNameAsAnsiString()); + + if (! validateVolatileSchemaName(tmpSchema)) + { + YYERROR; + } + + StmtDDLCommentOn *pNode = new(PARSERHEAP()) StmtDDLCommentOn( + StmtDDLCommentOn::COMMENT_ON_TYPE_SCHEMA, + QualifiedName(SEABASE_SCHEMA_OBJECTNAME, $4->getSchemaName(), $4->getCatalogName(), PARSERHEAP()), + *$6, + PARSERHEAP()); + + $$ = pNode; + } + } + | TOK_COMMENT TOK_ON TOK_COLUMN qualified_name TOK_IS QUOTED_STRING + { + ShortStringSequence *seq = (ShortStringSequence *) $4; + UInt32 numParts = seq->numParts(); + + if (numParts < 2) + YYABORT; + + NAString strEmpty("", PARSERHEAP()); + + NAString *columnName = seq->extract(numParts - 1); + NAString *tableName = seq->extract(numParts - 2); + NAString *schemaName = numParts > 2 ? seq->extract(numParts - 3) : + NAString *catalogName = numParts > 3 ? seq->extract(numParts - 4) : + + QualifiedName tblName(*tableName, *schemaName, *catalogName, PARSERHEAP()); + ColRefName *colRefName = new(PARSERHEAP()) ColRefName(*columnName, CorrName(tblName, PARSERHEAP())); + StmtDDLCommentOn *pNode = + new(PARSERHEAP()) StmtDDLCommentOn( + StmtDDLCommentOn::COMMENT_ON_TYPE_COLUMN, + tblName, + *$6, + new(PARSERHEAP()) ColReference(colRefName), + PARSERHEAP() + ); + + $$ = pNode; + } + + +comment_on_object_types : TOK_TABLE + { + $$ = StmtDDLCommentOn::COMMENT_ON_TYPE_TABLE; + } + | TOK_INDEX + { + $$ = StmtDDLCommentOn::COMMENT_ON_TYPE_INDEX; + } + | TOK_VIEW + { + $$ = StmtDDLCommentOn::COMMENT_ON_TYPE_VIEW; + } + | TOK_LIBRARY + { + $$ = StmtDDLCommentOn::COMMENT_ON_TYPE_LIBRARY; + } + | TOK_PROCEDURE + { + $$ = StmtDDLCommentOn::COMMENT_ON_TYPE_PROCEDURE; + } + | TOK_FUNCTION + { + $$ = StmtDDLCommentOn::COMMENT_ON_TYPE_FUNCTION; + } + --- End diff -- Done ---
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
Github user EEDY commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1288#discussion_r149039183 --- Diff: core/sql/sqlcomp/CmpDescribe.cpp --- @@ -3059,6 +3061,36 @@ short CmpDescribeSeabaseTable ( outputLongLine(*space, viewtext, 0); + //display comment for VIEW + if (objectUID > 0/* && COMMENT_CQD*/) +{ + if (cmpSBD.switchCompiler()) +{ + *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_PRIVS); + return -1; +} + +ComTdbVirtObjCommentInfo * objCommentInfo = NULL; +cmpSBD.getSeabaseObjectComment(objectUID, COM_VIEW_OBJECT, objCommentInfo); + + if (objCommentInfo != NULL) +{ + //new line + outputLine(*space, "", 0); + + //display VIEW COMMENT statements + if (objCommentInfo->objectComment != NULL) + { +sprintf(buf, "COMMENT ON VIEW %s IS '%s' ;", + tableName.data(), + objCommentInfo->objectComment); +outputLine(*space, buf, 0); --- End diff -- Done ---
[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement
GitHub user EEDY opened a pull request: https://github.com/apache/incubator-trafodion/pull/1288 New COMMENT-ON SQL statement [SQL_COMMENT_feature_design.171025.docx](https://github.com/apache/incubator-trafodion/files/1437382/SQL_COMMENT_feature_design.171025.docx) 1. new SQL syntax: COMMENT ON 2. new component privilege: SQL_OPERATIONS::COMMENT 3. MD table changes: add new column named "COMMENT" for tables "_MD_".OBJECTS and "_MD_".COLUMNS 4. SHOWDDL changes: add COMMENT-ON output for each object 5. new build-in views: "_MD_".OBJECT_COMMENT_VIEW and "_MD_".COLUMN_COMMENT_VIEW You can merge this pull request into a Git repository by running: $ git pull https://github.com/EEDY/incubator-trafodion master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/1288.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1288 commit 078ed10cc8d5d4024b3a2dd2ff965cac46f38c9f Author: eedy <cqlc...@gmail.com> Date: 2017-11-02T09:17:31Z new COMMENT-ON SQL statement: init 1. new SQL syntax: COMMENT ON 2. new component privilege: SQL_OPERATIONS::COMMENT 3. MD table changes: add new column for tables "_MD_".OBJECTS and "_MD_".COLUMNS 4. SHOWDDL changes: add COMMENT-ON output for each object 5. new build-in views: "_MD_".OBJECT_COMMENT_VIEW and "_MD_".COLUMN_COMMENT_VIEW commit 69c284c607fe965623ed16342df73f96200d38f5 Author: eedy <cqlc...@gmail.com> Date: 2017-11-02T10:02:41Z new COMMENT-ON SQL statement: fix showddl schema error 1. fix error while showddl schema with comment ---