Repository: incubator-trafodion Updated Branches: refs/heads/master ebe876d63 -> 394d007a3
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/regress/seabase/EXPECTED002 ---------------------------------------------------------------------- diff --git a/core/sql/regress/seabase/EXPECTED002 b/core/sql/regress/seabase/EXPECTED002 new file mode 100644 index 0000000..ca328be --- /dev/null +++ b/core/sql/regress/seabase/EXPECTED002 @@ -0,0 +1,599 @@ +>>obey TEST002(setup); +>>create schema t002sch; + +--- SQL operation complete. +>>set schema t002sch; + +--- SQL operation complete. +>>create table t002t1(a int not null primary key, ++> b int not null, c int not null); + +--- SQL operation complete. +>>create index t002t1i1 on t002t1(b); + +--- SQL operation complete. +>>create index t002t1i2 on t002t1(c); + +--- SQL operation complete. +>>insert into t002t1 values (1,2, 3); + +--- 1 row(s) inserted. +>> +>>sh swhbase flush 'TRAFODION.T002SCH.T002T1'; +>>sh swhbase flush 'TRAFODION.T002SCH.T002T1I1'; +>>sh swhbase flush 'TRAFODION.T002SCH.T002T1I2'; +>> +>>select * from t002t1; + +A B C +----------- ----------- ----------- + + 1 2 3 + +--- 1 row(s) selected. +>> +>>create table t002t2(a int not null primary key, b int not null) ++> salt using 4 partitions; + +--- SQL operation complete. +>>create index t002t2i1 on t002t2(b); + +--- SQL operation complete. +>>insert into t002t2 values (1,2); + +--- 1 row(s) inserted. +>> +>>sh swhbase flush 'TRAFODION.T002SCH.T002T2'; +>>sh swhbase flush 'TRAFODION.T002SCH.T002T2I1'; +>> +>>select * from t002t2; + +A B +----------- ----------- + + 1 2 + +--- 1 row(s) selected. +>> +>>obey TEST002(dml); +>>set schema t002sch; + +--- SQL operation complete. +>>invoke table(region stats ()); + +-- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__ +-- Definition current Tue Nov 24 05:52:37 2015 + + ( + CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE + , SCHEMA_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE + , OBJECT_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE + , REGION_NUM LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , REGION_NAME CHAR(512 BYTES) CHARACTER SET UTF8 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE + , NUM_STORES INT NO DEFAULT NOT NULL NOT DROPPABLE + , NUM_STORE_FILES INT NO DEFAULT NOT NULL NOT DROPPABLE + , STORE_FILE_UNCOMP_SIZE LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , STORE_FILE_SIZE LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , MEM_STORE_SIZE LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , READ_REQUESTS_COUNT LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , WRITE_REQUESTS_COUNT LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + ) + +--- SQL operation complete. +>>invoke table(region stats (t002t1)); + +-- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__ +-- Definition current Tue Nov 24 05:52:39 2015 + + ( + CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE + , SCHEMA_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE + , OBJECT_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE + , REGION_NUM LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , REGION_NAME CHAR(512 BYTES) CHARACTER SET UTF8 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE + , NUM_STORES INT NO DEFAULT NOT NULL NOT DROPPABLE + , NUM_STORE_FILES INT NO DEFAULT NOT NULL NOT DROPPABLE + , STORE_FILE_UNCOMP_SIZE LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , STORE_FILE_SIZE LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , MEM_STORE_SIZE LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , READ_REQUESTS_COUNT LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + , WRITE_REQUESTS_COUNT LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE + ) + +--- SQL operation complete. +>> +>>select * from table(region stats(t002t1)); + +CATALOG_NAME SCHEMA_NAME OBJECT_NAME REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE READ_REQUESTS_COUNT WRITE_REQUESTS_COUNT +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- -------------------- + +TRAFODION T002SCH T002T1 1 TRAFODION.T002SCH.T002T1/ef30630e978f1a43649e0acb43831e07 2 0 0 0 0 2 1 + +--- 1 row(s) selected. +>>select * from table(region stats(index t002t1i1)); + +CATALOG_NAME SCHEMA_NAME OBJECT_NAME REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE READ_REQUESTS_COUNT WRITE_REQUESTS_COUNT +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- -------------------- + +TRAFODION T002SCH T002T1I1 1 TRAFODION.T002SCH.T002T1I1/10cce04b2019e41d952b125d5de8f9d3 2 0 0 0 0 0 1 + +--- 1 row(s) selected. +>>select * from table(region stats(t002t2)); + +CATALOG_NAME SCHEMA_NAME OBJECT_NAME REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE READ_REQUESTS_COUNT WRITE_REQUESTS_COUNT +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- -------------------- + +TRAFODION T002SCH T002T2 1 TRAFODION.T002SCH.T002T2/51b3489dadcbdeb27a93f4991209960f 2 0 0 0 0 0 0 +TRAFODION T002SCH T002T2 2 TRAFODION.T002SCH.T002T2/3db1a63606e9ca15cc8361174ef89ccc 2 0 0 0 0 1 1 +TRAFODION T002SCH T002T2 3 TRAFODION.T002SCH.T002T2/bac154d9e6b384d7c381a27bae9a0d78 2 0 0 0 0 0 0 +TRAFODION T002SCH T002T2 4 TRAFODION.T002SCH.T002T2/235850f5b3c7fe2c04028e59eab3a9a4 2 0 0 0 0 0 0 + +--- 4 row(s) selected. +>>select * from table(region stats(index t002t2i1)); + +CATALOG_NAME SCHEMA_NAME OBJECT_NAME REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE READ_REQUESTS_COUNT WRITE_REQUESTS_COUNT +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- -------------------- + +TRAFODION T002SCH T002T2I1 1 TRAFODION.T002SCH.T002T2I1/07b9f88515739a56ab74a0ed5a3fbfad 2 0 0 0 0 1 1 + +--- 1 row(s) selected. +>> +>>select left(trim(schema_name) || '.' || trim(object_name), 14), ++> sum(store_file_size), sum(read_requests_count), sum(write_requests_count) ++> from table(region stats (using (select * from ( ++> get tables in schema t002sch, no header, return full names) x(a) ))) ++> group by 1 order by 2 desc; + +(EXPR) (EXPR) (EXPR) (EXPR) +-------------------------------------------------------- -------------------- -------------------- -------------------- + +T002SCH.T002T2 0 1 1 +T002SCH.T002T1 0 2 1 + +--- 2 row(s) selected. +>> +>>get region stats for table t002t1; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 2 + TotalWriteRequestsCount: 1 + +Stats Details +============= + + RegionNum: 1 + RegionName: TRAFODION.T002SCH.T002T1/ef30630e978f1a43649e0acb43831e07 + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 2 + WriteRequestsCount: 1 + + +--- SQL operation complete. +>>get region stats for index t002t1i1; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T1I1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 0 + TotalWriteRequestsCount: 1 + +Stats Details +============= + + RegionNum: 1 + RegionName: TRAFODION.T002SCH.T002T1I1/10cce04b2019e41d952b125d5de8f9d3 + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 1 + + +--- SQL operation complete. +>>get region stats for table t002t2; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T2 + NumRegions: 4 + RegionsLocation: /hbase/data/default + TotalNumStores: 8 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 1 + TotalWriteRequestsCount: 1 + +Stats Details +============= + + RegionNum: 1 + RegionName: TRAFODION.T002SCH.T002T2/51b3489dadcbdeb27a93f4991209960f + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 0 + + RegionNum: 2 + RegionName: TRAFODION.T002SCH.T002T2/3db1a63606e9ca15cc8361174ef89ccc + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 1 + WriteRequestsCount: 1 + + RegionNum: 3 + RegionName: TRAFODION.T002SCH.T002T2/bac154d9e6b384d7c381a27bae9a0d78 + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 0 + + RegionNum: 4 + RegionName: TRAFODION.T002SCH.T002T2/235850f5b3c7fe2c04028e59eab3a9a4 + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 0 + + +--- SQL operation complete. +>>get region stats for index t002t2i1; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T2I1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 1 + TotalWriteRequestsCount: 1 + +Stats Details +============= + + RegionNum: 1 + RegionName: TRAFODION.T002SCH.T002T2I1/07b9f88515739a56ab74a0ed5a3fbfad + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 1 + WriteRequestsCount: 1 + + +--- SQL operation complete. +>> +>>get region stats for ++> (select * from ++> (get tables in schema t002sch, no header, return full names)x(a)); + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 2 + TotalWriteRequestsCount: 1 + +Stats Details +============= + + RegionNum: 1 + RegionName: TRAFODION.T002SCH.T002T1/ef30630e978f1a43649e0acb43831e07 + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 2 + WriteRequestsCount: 1 + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T2 + NumRegions: 4 + RegionsLocation: /hbase/data/default + TotalNumStores: 8 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 1 + TotalWriteRequestsCount: 1 + +Stats Details +============= + + RegionNum: 1 + RegionName: TRAFODION.T002SCH.T002T2/51b3489dadcbdeb27a93f4991209960f + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 0 + + RegionNum: 2 + RegionName: TRAFODION.T002SCH.T002T2/3db1a63606e9ca15cc8361174ef89ccc + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 1 + WriteRequestsCount: 1 + + RegionNum: 3 + RegionName: TRAFODION.T002SCH.T002T2/bac154d9e6b384d7c381a27bae9a0d78 + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 0 + + RegionNum: 4 + RegionName: TRAFODION.T002SCH.T002T2/235850f5b3c7fe2c04028e59eab3a9a4 + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 0 + + +--- SQL operation complete. +>> +>>-- stats for all indexes on a table +>>select * ++> from table(region stats (using (select * from ( ++> get indexes on table t002t1, no header, return full names) x(a) ))); + +CATALOG_NAME SCHEMA_NAME OBJECT_NAME REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE READ_REQUESTS_COUNT WRITE_REQUESTS_COUNT +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- -------------------- + +TRAFODION T002SCH T002T1I1 1 TRAFODION.T002SCH.T002T1I1/10cce04b2019e41d952b125d5de8f9d3 2 0 0 0 0 0 1 +TRAFODION T002SCH T002T1I2 1 TRAFODION.T002SCH.T002T1I2/b1651d2ed93286114f78e75feb3cf0ea 2 0 0 0 0 0 1 + +--- 2 row(s) selected. +>>get region stats for ++> (select * from ++> (get indexes on table t002t1, no header, return full names)x(a)); + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T1I1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 0 + TotalWriteRequestsCount: 1 + +Stats Details +============= + + RegionNum: 1 + RegionName: TRAFODION.T002SCH.T002T1I1/10cce04b2019e41d952b125d5de8f9d3 + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 1 + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T1I2 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 0 + TotalWriteRequestsCount: 1 + +Stats Details +============= + + RegionNum: 1 + RegionName: TRAFODION.T002SCH.T002T1I2/b1651d2ed93286114f78e75feb3cf0ea + NumStores: 2 + NumStoreFiles: 0 + UncompressedSize: 0 (less than 1MB) + StoreFileSize: 0 (less than 1MB) + MemStoreSize: 0 (less than 1MB) + ReadRequestsCount: 0 + WriteRequestsCount: 1 + + +--- SQL operation complete. +>> +>>-- return summary stats only +>>get region stats for table t002t1, summary; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 2 + TotalWriteRequestsCount: 1 + +--- SQL operation complete. +>>get region stats for index t002t1i1, summary; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T1I1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 0 + TotalWriteRequestsCount: 1 + +--- SQL operation complete. +>>get region stats for table t002t2, summary; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T2 + NumRegions: 4 + RegionsLocation: /hbase/data/default + TotalNumStores: 8 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 1 + TotalWriteRequestsCount: 1 + +--- SQL operation complete. +>>get region stats for index t002t2i1, summary; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T2I1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 1 + TotalWriteRequestsCount: 1 + +--- SQL operation complete. +>> +>>get region stats for ++> (select * from ++> (get tables in schema t002sch, no header, return full names)x(a)), summary; + + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T1 + NumRegions: 1 + RegionsLocation: /hbase/data/default + TotalNumStores: 2 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 2 + TotalWriteRequestsCount: 1 + +Stats Summary +============= + + ObjectName: TRAFODION.T002SCH.T002T2 + NumRegions: 4 + RegionsLocation: /hbase/data/default + TotalNumStores: 8 + TotalNumStoreFiles: 0 + TotalUncompressedSize: 0 + TotalStoreFileSize: 0 + TotalMemStoreSize: 0 + TotalReadRequestsCount: 1 + TotalWriteRequestsCount: 1 + +--- SQL operation complete. +>> +>>log; http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/regress/seabase/FILTER002 ---------------------------------------------------------------------- diff --git a/core/sql/regress/seabase/FILTER002 b/core/sql/regress/seabase/FILTER002 new file mode 100755 index 0000000..cca2c31 --- /dev/null +++ b/core/sql/regress/seabase/FILTER002 @@ -0,0 +1,29 @@ +#! /bin/sh +# @@@ 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 @@@ + +# Like the pattern-masking of QACOMP, here we filter out such stuff as +# transaction id. Called by the runregr script before doing diff. + +fil=$1 +sed " +s/TRAFODION\.T002SCH\.T002[A-Z0-9]*\/[A-Za-z0-9]*/REGION_NAME/g +" $fil http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/regress/seabase/TEST002 ---------------------------------------------------------------------- diff --git a/core/sql/regress/seabase/TEST002 b/core/sql/regress/seabase/TEST002 new file mode 100644 index 0000000..c7148fb --- /dev/null +++ b/core/sql/regress/seabase/TEST002 @@ -0,0 +1,105 @@ +-- @@@ 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 @@@ + +-- Tests for hbase timestamp and hbase version functionality + +obey TEST002(clean_up); + +log LOG002 clear; +obey TEST002(setup); +obey TEST002(dml); +log; +exit; + +?section setup +create schema t002sch; +set schema t002sch; +create table t002t1(a int not null primary key, + b int not null, c int not null); +create index t002t1i1 on t002t1(b); +create index t002t1i2 on t002t1(c); +insert into t002t1 values (1,2, 3); + +sh swhbase flush 'TRAFODION.T002SCH.T002T1'; +sh swhbase flush 'TRAFODION.T002SCH.T002T1I1'; +sh swhbase flush 'TRAFODION.T002SCH.T002T1I2'; + +select * from t002t1; + +create table t002t2(a int not null primary key, b int not null) + salt using 4 partitions; +create index t002t2i1 on t002t2(b); +insert into t002t2 values (1,2); + +sh swhbase flush 'TRAFODION.T002SCH.T002T2'; +sh swhbase flush 'TRAFODION.T002SCH.T002T2I1'; + +select * from t002t2; + +?section dml +set schema t002sch; +invoke table(region stats ()); +invoke table(region stats (t002t1)); + +select * from table(region stats(t002t1)); +select * from table(region stats(index t002t1i1)); +select * from table(region stats(t002t2)); +select * from table(region stats(index t002t2i1)); + +select left(trim(schema_name) || '.' || trim(object_name), 14), + sum(store_file_size), sum(read_requests_count), sum(write_requests_count) + from table(region stats (using (select * from ( + get tables in schema t002sch, no header, return full names) x(a) ))) + group by 1 order by 2 desc; + +get region stats for table t002t1; +get region stats for index t002t1i1; +get region stats for table t002t2; +get region stats for index t002t2i1; + +get region stats for + (select * from + (get tables in schema t002sch, no header, return full names)x(a)); + +-- stats for all indexes on a table +select * + from table(region stats (using (select * from ( + get indexes on table t002t1, no header, return full names) x(a) ))); +get region stats for + (select * from + (get indexes on table t002t1, no header, return full names)x(a)); + +-- return summary stats only +get region stats for table t002t1, summary; +get region stats for index t002t1i1, summary; +get region stats for table t002t2, summary; +get region stats for index t002t2i1, summary; + +get region stats for + (select * from + (get tables in schema t002sch, no header, return full names)x(a)), summary; + +?section clean_up +set schema t002sch; +drop table t002t1 cascade; +drop table t002t2 cascade; +drop schema t002sch; + http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/sqlcomp/CmpDescribe.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpDescribe.cpp b/core/sql/sqlcomp/CmpDescribe.cpp index f7a6027..05f861c 100644 --- a/core/sql/sqlcomp/CmpDescribe.cpp +++ b/core/sql/sqlcomp/CmpDescribe.cpp @@ -854,20 +854,10 @@ short CmpDescribe(const char *query, const RelExpr *queryExpr, } else // special virtual table { - ExplainFunc explainF; - StatisticsFunc statisticsF; HiveMDaccessFunc hiveMDF; const NAString& virtualTableName = d->getDescribedTableName().getQualifiedNameObj().getObjectName(); - if (virtualTableName == explainF.getVirtualTableName()) - { - tabledesc = explainF.createVirtualTableDesc(); - } - else if (virtualTableName == statisticsF.getVirtualTableName()) - { - tabledesc = statisticsF.createVirtualTableDesc(); - } - else if (strncmp(virtualTableName.data(), "HIVEMD_", 7) == 0) + if (strncmp(virtualTableName.data(), "HIVEMD_", 7) == 0) { NAString mdType = virtualTableName; mdType = mdType.strip(NAString::trailing, '_'); @@ -2572,6 +2562,13 @@ short CmpDescribeSeabaseTable ( const NAString& tableName = dtName.getQualifiedNameObj().getQualifiedNameAsAnsiString(TRUE); + if (CmpCommon::context()->isUninitializedSeabase()) + { + *CmpCommon::diags() << DgSqlCode(CmpCommon::context()->uninitializedSeabaseErrNum()); + + return -1; + } + // set isExternalTable to allow Hive External tables to be described BindWA bindWA(ActiveSchemaDB(), CmpCommon::context(), FALSE/*inDDL*/); bindWA.setAllowExternalTables (TRUE); http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java ---------------------------------------------------------------------- diff --git a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java index debd527..1860fc8 100644 --- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java +++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java @@ -729,8 +729,6 @@ public class HBaseClient { for (HTableDescriptor htd : htdl) { String tblName = htd.getNameAsString(); - // System.out.println(tblName); - byte[] b = tblName.getBytes(); hbaseTables.add(b); } @@ -741,6 +739,61 @@ public class HBaseClient { return hbaseTables; } + + public ByteArrayList getRegionStats(String tableName) + throws MasterNotRunningException, IOException { + if (logger.isDebugEnabled()) logger.debug("HBaseClient.getRegionStats(" + tableName + ") called."); + + HBaseAdmin admin = new HBaseAdmin(config); + HTable htbl = new HTable(config, tableName); + ByteArrayList regionInfo = new ByteArrayList(); + HRegionInfo hregInfo = null; + + try { + TrafRegionStats rsc = new TrafRegionStats(htbl, admin); + + NavigableMap<HRegionInfo, ServerName> locations + = htbl.getRegionLocations(); + + for (Map.Entry<HRegionInfo, ServerName> entry: + locations.entrySet()) { + + hregInfo = entry.getKey(); + byte[] regionName = hregInfo.getRegionName(); + String encodedRegionName = hregInfo.getEncodedName(); + String ppRegionName = HRegionInfo.prettyPrint(encodedRegionName); + SizeInfo regionSizeInfo = rsc.getRegionSizeInfo(regionName); + int numStores = regionSizeInfo.numStores; + int numStoreFiles = regionSizeInfo.numStoreFiles; + Long storeUncompSize = regionSizeInfo.storeUncompSize; + Long storeFileSize = regionSizeInfo.storeFileSize; + Long memStoreSize = regionSizeInfo.memStoreSize; + Long readRequestsCount = regionSizeInfo.readRequestsCount; + Long writeRequestsCount = regionSizeInfo.writeRequestsCount; + + String oneRegion; + // oneRegion = "/hbase/data/hbase/default/" + tableName + "/" + ppRegionName + "|"; + oneRegion = tableName + "/" + ppRegionName + "|"; + oneRegion += String.valueOf(numStores) + "|"; + oneRegion += String.valueOf(numStoreFiles) + "|"; + oneRegion += String.valueOf(storeUncompSize) + "|"; + oneRegion += String.valueOf(storeFileSize) + "|"; + oneRegion += String.valueOf(memStoreSize) + "|"; + oneRegion += String.valueOf(readRequestsCount) + "|"; + oneRegion += String.valueOf(writeRequestsCount) + "|"; + + regionInfo.add(oneRegion.getBytes()); + + } + + } + finally { + admin.close(); + } + + return regionInfo; + } + public boolean copy(String currTblName, String oldTblName) throws MasterNotRunningException, IOException, SnapshotCreationException, InterruptedException { if (logger.isDebugEnabled()) logger.debug("HBaseClient.copy(" + currTblName + oldTblName + ") called."); http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java ---------------------------------------------------------------------- diff --git a/core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java b/core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java new file mode 100644 index 0000000..fe583a0 --- /dev/null +++ b/core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java @@ -0,0 +1,144 @@ +// @@@ 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 @@@ + +package org.trafodion.sql; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.ClusterStatus; +import org.apache.hadoop.hbase.HRegionInfo; +import org.apache.hadoop.hbase.RegionLoad; +import org.apache.hadoop.hbase.ServerLoad; +import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.client.HTable; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; +import org.apache.hadoop.hbase.util.Bytes; + +class SizeInfo { + int numStores; + int numStoreFiles; + Long storeUncompSize; + Long storeFileSize; + Long memStoreSize; + Long readRequestsCount; + Long writeRequestsCount; +}; + +public class TrafRegionStats { + + private final Map<byte[], SizeInfo> sizeInfoMap = + new TreeMap<byte[], SizeInfo>(Bytes.BYTES_COMPARATOR); + + static final String ENABLE_REGIONSIZECALCULATOR = "hbase.regionsizecalculator.enable"; + + boolean enabled(Configuration configuration) { + return configuration.getBoolean(ENABLE_REGIONSIZECALCULATOR, true); + } + + /** + * Returns size of given region in bytes. Returns 0 if region was not found. + * */ + public SizeInfo getRegionSizeInfo(byte[] regionId) { + SizeInfo sizeInfo = sizeInfoMap.get(regionId); + return sizeInfo; + } + + public Map<byte[], SizeInfo> getRegionSizeMap() { + return Collections.unmodifiableMap(sizeInfoMap); + } + + /** + * Computes size of each region for table and given column families. + * */ + public TrafRegionStats(HTable table) throws IOException { + this(table, new HBaseAdmin(table.getConfiguration())); + } + + public TrafRegionStats (HTable table, HBaseAdmin admin) throws IOException { + + try { + if (!enabled(table.getConfiguration())) { + System.out.println("Region size calculation disabled."); + return; + } + + //get regions for table + Set<HRegionInfo> tableRegionInfos = table.getRegionLocations().keySet(); + Set<byte[]> tableRegions = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR); + for (HRegionInfo regionInfo : tableRegionInfos) { + tableRegions.add(regionInfo.getRegionName()); + } + + ClusterStatus clusterStatus = admin.getClusterStatus(); + Collection<ServerName> servers = clusterStatus.getServers(); + final long megaByte = 1024L * 1024L; + + //iterate all cluster regions, filter regions from our table and compute their size + for (ServerName serverName: servers) { + ServerLoad serverLoad = clusterStatus.getLoad(serverName); + + for (RegionLoad regionLoad: serverLoad.getRegionsLoad().values()) { + byte[] regionId = regionLoad.getName(); + + if (tableRegions.contains(regionId)) { + + int numStores = regionLoad.getStores(); + int numStoreFiles = regionLoad.getStorefiles(); + Long storeUncompSizeBytes = regionLoad.getStoreUncompressedSizeMB() * megaByte; + Long storeFileSizeBytes = regionLoad.getStorefileSizeMB() * megaByte; + Long memStoreSizeBytes = regionLoad.getMemStoreSizeMB() * megaByte; + + // this method is available in HBase 2.0.0 + // Long lastMajorCompactionTs = regionLoad.getLastMajorCompactionTs(); + + SizeInfo sizeInfo = new SizeInfo(); + sizeInfo.numStores = numStores; + sizeInfo.numStoreFiles = numStoreFiles; + sizeInfo.storeUncompSize = storeUncompSizeBytes; + sizeInfo.storeFileSize = storeFileSizeBytes; + sizeInfo.memStoreSize = memStoreSizeBytes; + + sizeInfo.readRequestsCount = regionLoad.getReadRequestsCount(); + sizeInfo.writeRequestsCount = regionLoad.getWriteRequestsCount(); + + sizeInfoMap.put(regionId, sizeInfo); + + // System.out.println("RegionNameAsString " + regionLoad.getNameAsString()); + } + } + } + + } finally { + admin.close(); + } + } +} +
