Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 192 additions & 3 deletions core/sql/regress/compGeneral/EXPECTED072
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
>>drop schema IF EXISTS t072sch_comment cascade;

--- SQL operation complete.
>>unregister hbase table if exists t072t1_comment;

*** ERROR[3251] UNREGISTER operation could not be completed. Reason: Specified object T072T1_COMMENT does not exist.

--- SQL operation failed with errors.
>>drop external table if exists t072t1_comment;

--- SQL operation complete.
>>drop hbase table t072t1_comment;

*** WARNING[1004] Object T072T1_COMMENT does not exist or object type is invalid for the current operation.

--- SQL operation complete.
>>
>>
>>obey TEST072(compile_libs);
>>--------------------------------------------------------------------------
Expand Down Expand Up @@ -78,6 +92,17 @@
+> --UNSIGNED INTEGER
+>;

--- SQL operation complete.
>>
>>create hbase table t072t1_comment ( column family 'cf');

--- SQL operation complete.
>>create external table t072t1_comment
+> (row_id varchar(20) not null primary key,
+> row_value varchar (1000))
+> attribute default column family 'cf'
+> map to hbase table t072t1_comment;

--- SQL operation complete.
>>
>>
Expand Down Expand Up @@ -133,7 +158,15 @@

--- SQL operation complete.
>>
>>
>>comment on table hbase."_CELL_".t072t1_comment is 'This is a new comment of hbase._CELL_.TABLE.这个是一个中文的table的注释。》》、……' ;

--- SQL operation complete.
>>comment on table hbase."_ROW_".t072t1_comment is 'This is a new comment of hbase._ROW_.TABLE.这个是一个中文的table的注释。》》、……' ;

--- SQL operation complete.
>>comment on table hbase."_MAP_".t072t1_comment is 'This is a new comment of hbase._MAP__.TABLE.这个是一个中文的table的注释。》》、……' ;

--- SQL operation complete.
>>obey TEST072(showcomment);
>>--------------------------------------------------------------------------
>>
Expand Down Expand Up @@ -315,7 +348,80 @@ COMMENT ON SEQUENCE TRAFODION.T072SCH_COMMENT.T072SEQ IS
'This is a new comment of SEQUENCE.' ;

--- SQL operation complete.
>>
>>showddl hbase."_CELL_".t072t1_comment;

/*
CREATE TABLE HBASE."_CELL_".T072T1_COMMENT
(
ROW_ID VARCHAR(100) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, COL_FAMILY VARCHAR(100) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, COL_NAME VARCHAR(100) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, COL_TIMESTAMP LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
, COL_VALUE VARCHAR(1000) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, PRIMARY KEY (ROW_ID ASC)
)
;
*/

/* HBase DDL */
CREATE HBASE TABLE T072T1_COMMENT ( COLUMN FAMILY '#1')

REGISTER /*INTERNAL*/ HBASE TABLE T072T1_COMMENT;
/* ObjectUID = _nnnnnnnnnnnnnnnnnn */

COMMENT ON TABLE HBASE."_CELL_".T072T1_COMMENT IS
'This is a new comment of hbase._CELL_.TABLE.这个是一个中文的table的注释。》》、……'
;

--- SQL operation complete.
>>showddl hbase."_ROW_".t072t1_comment;

/*
CREATE TABLE HBASE."_ROW_".T072T1_COMMENT
(
ROW_ID VARCHAR(100) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, COLUMN_DETAILS VARCHAR(10000) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, PRIMARY KEY (ROW_ID ASC)
)
;
*/

/* HBase DDL */
CREATE HBASE TABLE T072T1_COMMENT ( COLUMN FAMILY '#1')

REGISTER /*INTERNAL*/ HBASE TABLE T072T1_COMMENT;
/* ObjectUID = _nnnnnnnnnnnnnnnnnn */

COMMENT ON TABLE HBASE."_ROW_".T072T1_COMMENT IS
'This is a new comment of hbase._ROW_.TABLE.这个是一个中文的table的注释。》》、……'
;

--- SQL operation complete.
>>showddl hbase."_MAP_".t072t1_comment;

CREATE EXTERNAL TABLE T072T1_COMMENT
(
"cf".ROW_ID VARCHAR(20) CHARACTER SET ISO88591 COLLATE
DEFAULT NO @eof@ NULL NOT DROPPABLE
, "cf".ROW_VALUE VARCHAR(1000) CHARACTER SET ISO88591
COLLATE DEFAULT DEFAULT NULL
, PRIMARY KEY NOT SERIALIZED (ROW_ID ASC)
)
ATTRIBUTES DEFAULT COLUMN FAMILY 'cf'
MAP TO HBASE TABLE T072T1_COMMENT DATA FORMAT VARCHAR
;

COMMENT ON TABLE TRAFODION."_HB_MAP_".T072T1_COMMENT IS
'This is a new comment of hbase._MAP__.TABLE.这个是一个中文的table的注释。》》、……'
;

--- SQL operation complete.
>>
>>
>>obey TEST072(comment02);
Expand Down Expand Up @@ -580,7 +686,80 @@ COMMENT ON SEQUENCE TRAFODION.T072SCH_COMMENT.T072SEQ IS
'This is a Modified comment: This is a comment of SEQUENCE.' ;

--- SQL operation complete.
>>
>>showddl hbase."_CELL_".t072t1_comment;

/*
CREATE TABLE HBASE."_CELL_".T072T1_COMMENT
(
ROW_ID VARCHAR(100) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, COL_FAMILY VARCHAR(100) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, COL_NAME VARCHAR(100) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, COL_TIMESTAMP LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
, COL_VALUE VARCHAR(1000) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, PRIMARY KEY (ROW_ID ASC)
)
;
*/

/* HBase DDL */
CREATE HBASE TABLE T072T1_COMMENT ( COLUMN FAMILY '#1')

REGISTER /*INTERNAL*/ HBASE TABLE T072T1_COMMENT;
/* ObjectUID = _nnnnnnnnnnnnnnnnnn */

COMMENT ON TABLE HBASE."_CELL_".T072T1_COMMENT IS
'This is a new comment of hbase._CELL_.TABLE.这个是一个中文的table的注释。》》、……'
;

--- SQL operation complete.
>>showddl hbase."_ROW_".t072t1_comment;

/*
CREATE TABLE HBASE."_ROW_".T072T1_COMMENT
(
ROW_ID VARCHAR(100) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, COLUMN_DETAILS VARCHAR(10000) CHARACTER SET ISO88591
COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
, PRIMARY KEY (ROW_ID ASC)
)
;
*/

/* HBase DDL */
CREATE HBASE TABLE T072T1_COMMENT ( COLUMN FAMILY '#1')

REGISTER /*INTERNAL*/ HBASE TABLE T072T1_COMMENT;
/* ObjectUID = _nnnnnnnnnnnnnnnnnn */

COMMENT ON TABLE HBASE."_ROW_".T072T1_COMMENT IS
'This is a new comment of hbase._ROW_.TABLE.这个是一个中文的table的注释。》》、……'
;

--- SQL operation complete.
>>showddl hbase."_MAP_".t072t1_comment;

CREATE EXTERNAL TABLE T072T1_COMMENT
(
"cf".ROW_ID VARCHAR(20) CHARACTER SET ISO88591 COLLATE
DEFAULT NO @eof@ NULL NOT DROPPABLE
, "cf".ROW_VALUE VARCHAR(1000) CHARACTER SET ISO88591
COLLATE DEFAULT DEFAULT NULL
, PRIMARY KEY NOT SERIALIZED (ROW_ID ASC)
)
ATTRIBUTES DEFAULT COLUMN FAMILY 'cf'
MAP TO HBASE TABLE T072T1_COMMENT DATA FORMAT VARCHAR
;

COMMENT ON TABLE TRAFODION."_HB_MAP_".T072T1_COMMENT IS
'This is a new comment of hbase._MAP__.TABLE.这个是一个中文的table的注释。》》、……'
;

--- SQL operation complete.
>>
>>
>>obey TEST072(comment03);
Expand Down Expand Up @@ -1137,6 +1316,16 @@ COMMENT ON SEQUENCE TRAFODION.T072SCH_COMMENT.T072SEQ IS
>>drop schema IF EXISTS t072sch_comment cascade;

--- SQL operation complete.
>>unregister hbase table if exists t072t1_comment;

--- SQL operation complete.
>>drop external table if exists t072t1_comment;

--- SQL operation complete.
>>drop hbase table t072t1_comment;

--- SQL operation complete.
>>
>>
>>obey TEST072(showcomment);
>>--------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions core/sql/regress/compGeneral/FILTER072
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ fi

sed "
s/FILE '.*rundir\(.*\)'/FILE '\$rundir\1'/g
s/ObjectUID = [0-9]\{19\}/ObjectUID = _nnnnnnnnnnnnnnnnnn/g
" $fil
19 changes: 17 additions & 2 deletions core/sql/regress/compGeneral/TEST072
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ CREATE SEQUENCE t072sch_comment.t072seq
--UNSIGNED INTEGER
;

create hbase table t072t1_comment ( column family 'cf');
create external table t072t1_comment
(row_id varchar(20) not null primary key,
row_value varchar (1000))
attribute default column family 'cf'
map to hbase table t072t1_comment;


?section comment01
--------------------------------------------------------------------------
Expand All @@ -141,7 +148,9 @@ comment on column t072sch_comment.t072view1.col1 is 'This is a V0
comment on column t072sch_comment.t072view1.col2 is 'This is a V02 column new comment of view.' ;
comment on column t072sch_comment.t072view1.col3 is 'This is a V03 column new comment of view.大家好。' ;


comment on table hbase."_CELL_".t072t1_comment is 'This is a new comment of hbase._CELL_.TABLE.这个是一个中文的table的注释。》》、……' ;
comment on table hbase."_ROW_".t072t1_comment is 'This is a new comment of hbase._ROW_.TABLE.这个是一个中文的table的注释。》》、……' ;
comment on table hbase."_MAP_".t072t1_comment is 'This is a new comment of hbase._MAP__.TABLE.这个是一个中文的table的注释。》》、……' ;
?section comment02
--------------------------------------------------------------------------

Expand Down Expand Up @@ -240,7 +249,9 @@ showddl library t072sch_comment.t072jar;
showddl function t072sch_comment.t072func;
showddl procedure t072sch_comment.t072spj;
showddl sequence t072sch_comment.t072seq;

showddl hbase."_CELL_".t072t1_comment;
showddl hbase."_ROW_".t072t1_comment;
showddl hbase."_MAP_".t072t1_comment;

?section showddl2
--------------------------------------------------------------------------
Expand All @@ -259,4 +270,8 @@ showddl sequence t072sch_comment.t072seq;

-- CLEANUP database
drop schema IF EXISTS t072sch_comment cascade;
unregister hbase table if exists t072t1_comment;
drop external table if exists t072t1_comment;
drop hbase table t072t1_comment;


25 changes: 25 additions & 0 deletions core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,31 @@ void CmpSeabaseDDL::doSeabaseCommentOn(StmtDDLCommentOn *commentOnNode,

ExeCliInterface cliInterface(STMTHEAP, NULL, NULL,
CmpCommon::context()->sqlSession()->getParentQid());
//if comment on native HBASE first shoud register first
if (CmpSeabaseDDL::isHbase(catalogNamePart))
{
// HBase."MAP" fromater should covert
if (ComIsHBaseMappedExtFormat(catalogNamePart, schemaNamePart))
{
ComConvertHBaseMappedExtToInt(catalogNamePart, schemaNamePart, catalogNamePart, schemaNamePart);
}
else
{
//HBASE erternal table already register in create time no need to register again
NAString ddl = "REGISTER INTERNAL HBASE TABLE IF NOT REGISTERED ";
ddl.append(extObjName.data());

Lng32 cliRC = cliInterface.executeImmediate(ddl.data());
// error code -8102 means the object already register
if (cliRC < 0 && cliRC != -8102)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the ddl issued is 'register ...if not registered', an 8102 error will
not be returned if object already exists.
This check should not be done and all errors should be returned.

{
cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
processReturn();
return;
}
}

}
Int64 objUID = 0;
Int32 objectOwnerID = ROOT_USER_ID;
Int32 schemaOwnerID = ROOT_USER_ID;
Expand Down
7 changes: 6 additions & 1 deletion core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10558,7 +10558,12 @@ short CmpSeabaseDDL::unregisterNativeTable
objectNamePart.data(),
objType
);


// drop comment text
retcode = deleteFromTextTable(&cliInterface,
objUID,
ComTextType::COM_OBJECT_COMMENT_TEXT,
0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if retcode is < 0, it should return -1 indicating an error.

return 0;
}

Expand Down