You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2015/12/03 20:51:34 UTC
[1/9] incubator-trafodion git commit: JIRA Trafodion-1645 SQL
commands to retrieve region stats.
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();
+ }
+ }
+}
+
[5/9] incubator-trafodion git commit: regression test file updates.
Posted by sa...@apache.org.
regression test file updates.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/0a46c5b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/0a46c5b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/0a46c5b3
Branch: refs/heads/master
Commit: 0a46c5b384069933a06280840b59c8e812e55fb7
Parents: 9e0a88b
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Sat Nov 28 05:34:11 2015 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Sat Nov 28 05:34:11 2015 +0000
----------------------------------------------------------------------
core/sql/regress/seabase/EXPECTED002 | 107 +++++++++++++++++++-----------
core/sql/regress/seabase/FILTER002 | 4 +-
core/sql/regress/seabase/TEST002 | 39 +++++++++--
3 files changed, 103 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0a46c5b3/core/sql/regress/seabase/EXPECTED002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED002 b/core/sql/regress/seabase/EXPECTED002
index ca328be..a1c7ec2 100644
--- a/core/sql/regress/seabase/EXPECTED002
+++ b/core/sql/regress/seabase/EXPECTED002
@@ -62,7 +62,7 @@ A B
>>invoke table(region stats ());
-- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__
--- Definition current Tue Nov 24 05:52:37 2015
+-- Definition current Sat Nov 28 05:32:23 2015
(
CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -87,7 +87,7 @@ A B
>>invoke table(region stats (t002t1));
-- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__
--- Definition current Tue Nov 24 05:52:39 2015
+-- Definition current Sat Nov 28 05:32:25 2015
(
CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -110,39 +110,62 @@ A B
--- SQL operation complete.
>>
->>select * from table(region stats(t002t1));
+>>select left(trim(schema_name) || '.' || trim(object_name), 14),
++> region_num, region_name, num_stores, num_store_files,
++> store_file_uncomp_size, store_file_size, mem_store_size,
++> 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
++> 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
++> 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
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- --------------------
+(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
+-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-TRAFODION T002SCH T002T1 1 TRAFODION.T002SCH.T002T1/ef30630e978f1a43649e0acb43831e07
2 0 0 0 0 2 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/1b28a9e5d128ef99fb399760368ef0a2 2 0 0 0 0 ReadRequestsCount: 2 WriteRequestsCount: 1
--- 1 row(s) selected.
->>select * from table(region stats(index t002t1i1));
+>>
+>>select left(trim(schema_name) || '.' || trim(object_name), 14),
++> region_num, region_name, num_stores, num_store_files,
++> store_file_uncomp_size, store_file_size, mem_store_size,
++> 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
++> 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
++> 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
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- --------------------
+(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
+-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-TRAFODION T002SCH T002T1I1 1 TRAFODION.T002SCH.T002T1I1/10cce04b2019e41d952b125d5de8f9d3
2 0 0 0 0 0 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/978dc9ee33815b6cfcbe6f3ea6760aeb 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
--- 1 row(s) selected.
->>select * from table(region stats(t002t2));
+>>
+>>select left(trim(schema_name) || '.' || trim(object_name), 14),
++> region_num, region_name, num_stores, num_store_files,
++> store_file_uncomp_size, store_file_size, mem_store_size,
++> 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
++> 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
++> 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
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- --------------------
+(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
+-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-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
+T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2/d18351fff7a9f9608630c8cadae4ca59 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
+T002SCH.T002T2 2 TRAFODION.T002SCH.T002T2/046b619bea33e4b9d5b4ffa2f15c3b01 2 0 0 0 0 ReadRequestsCount: 1 WriteRequestsCount: 1
+T002SCH.T002T2 3 TRAFODION.T002SCH.T002T2/e38826a2cde7005f4f67cdb2320ddb76 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
+T002SCH.T002T2 4 TRAFODION.T002SCH.T002T2/2c134f9a4f67ef528f1dbe9a4914b96c 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
--- 4 row(s) selected.
->>select * from table(region stats(index t002t2i1));
+>>
+>>select left(trim(schema_name) || '.' || trim(object_name), 14),
++> region_num, region_name, num_stores, num_store_files,
++> store_file_uncomp_size, store_file_size, mem_store_size,
++> 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
++> 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
++> 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
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- --------------------
+(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
+-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-TRAFODION T002SCH T002T2I1 1 TRAFODION.T002SCH.T002T2I1/07b9f88515739a56ab74a0ed5a3fbfad
2 0 0 0 0 1 1
+T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2I1/677788cf794f01923614f3ece5b49b3f 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
--- 1 row(s) selected.
>>
@@ -181,7 +204,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1/ef30630e978f1a43649e0acb43831e07
+ RegionName: TRAFODION.T002SCH.T002T1/1b28a9e5d128ef99fb399760368ef0a2
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -213,7 +236,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I1/10cce04b2019e41d952b125d5de8f9d3
+ RegionName: TRAFODION.T002SCH.T002T1I1/978dc9ee33815b6cfcbe6f3ea6760aeb
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -245,7 +268,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2/51b3489dadcbdeb27a93f4991209960f
+ RegionName: TRAFODION.T002SCH.T002T2/d18351fff7a9f9608630c8cadae4ca59
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -255,7 +278,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 2
- RegionName: TRAFODION.T002SCH.T002T2/3db1a63606e9ca15cc8361174ef89ccc
+ RegionName: TRAFODION.T002SCH.T002T2/046b619bea33e4b9d5b4ffa2f15c3b01
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -265,7 +288,7 @@ Stats Details
WriteRequestsCount: 1
RegionNum: 3
- RegionName: TRAFODION.T002SCH.T002T2/bac154d9e6b384d7c381a27bae9a0d78
+ RegionName: TRAFODION.T002SCH.T002T2/e38826a2cde7005f4f67cdb2320ddb76
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -275,7 +298,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 4
- RegionName: TRAFODION.T002SCH.T002T2/235850f5b3c7fe2c04028e59eab3a9a4
+ RegionName: TRAFODION.T002SCH.T002T2/2c134f9a4f67ef528f1dbe9a4914b96c
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -307,7 +330,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2I1/07b9f88515739a56ab74a0ed5a3fbfad
+ RegionName: TRAFODION.T002SCH.T002T2I1/677788cf794f01923614f3ece5b49b3f
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -342,7 +365,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1/ef30630e978f1a43649e0acb43831e07
+ RegionName: TRAFODION.T002SCH.T002T1/1b28a9e5d128ef99fb399760368ef0a2
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -370,7 +393,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2/51b3489dadcbdeb27a93f4991209960f
+ RegionName: TRAFODION.T002SCH.T002T2/d18351fff7a9f9608630c8cadae4ca59
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -380,7 +403,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 2
- RegionName: TRAFODION.T002SCH.T002T2/3db1a63606e9ca15cc8361174ef89ccc
+ RegionName: TRAFODION.T002SCH.T002T2/046b619bea33e4b9d5b4ffa2f15c3b01
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -390,7 +413,7 @@ Stats Details
WriteRequestsCount: 1
RegionNum: 3
- RegionName: TRAFODION.T002SCH.T002T2/bac154d9e6b384d7c381a27bae9a0d78
+ RegionName: TRAFODION.T002SCH.T002T2/e38826a2cde7005f4f67cdb2320ddb76
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -400,7 +423,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 4
- RegionName: TRAFODION.T002SCH.T002T2/235850f5b3c7fe2c04028e59eab3a9a4
+ RegionName: TRAFODION.T002SCH.T002T2/2c134f9a4f67ef528f1dbe9a4914b96c
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -413,15 +436,19 @@ Stats Details
--- SQL operation complete.
>>
>>-- stats for all indexes on a table
->>select *
+>>select left(trim(schema_name) || '.' || trim(object_name), 14),
++> region_num, region_name, num_stores, num_store_files,
++> store_file_uncomp_size, store_file_size, mem_store_size,
++> 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
++> 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
+> 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
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- -------------------- --------------------
+(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
+-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-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
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/978dc9ee33815b6cfcbe6f3ea6760aeb 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I2/f3031fdb15e35a869d6c8f8232e749b4 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
--- 2 row(s) selected.
>>get region stats for
@@ -447,7 +474,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I1/10cce04b2019e41d952b125d5de8f9d3
+ RegionName: TRAFODION.T002SCH.T002T1I1/978dc9ee33815b6cfcbe6f3ea6760aeb
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -475,7 +502,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I2/b1651d2ed93286114f78e75feb3cf0ea
+ RegionName: TRAFODION.T002SCH.T002T1I2/f3031fdb15e35a869d6c8f8232e749b4
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0a46c5b3/core/sql/regress/seabase/FILTER002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/FILTER002 b/core/sql/regress/seabase/FILTER002
index cca2c31..d232963 100755
--- a/core/sql/regress/seabase/FILTER002
+++ b/core/sql/regress/seabase/FILTER002
@@ -25,5 +25,7 @@
fil=$1
sed "
-s/TRAFODION\.T002SCH\.T002[A-Z0-9]*\/[A-Za-z0-9]*/REGION_NAME/g
+s/TRAFODION\.T002SCH\.T002[A-Z0-9]*\/[A-Za-z0-9]*/REGION_NAME /g
+s/ReadRequestsCount: [0-9 ]*/READ_REQUESTS_COUNT /g
+s/WriteRequestsCount: [0-9 ]*/WRITE_REQUESTS_COUNT /g
" $fil
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0a46c5b3/core/sql/regress/seabase/TEST002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST002 b/core/sql/regress/seabase/TEST002
index c7148fb..900b2d2 100644
--- a/core/sql/regress/seabase/TEST002
+++ b/core/sql/regress/seabase/TEST002
@@ -19,7 +19,7 @@
--
-- @@@ END COPYRIGHT @@@
--- Tests for hbase timestamp and hbase version functionality
+-- Tests to retrieve region space and access stats
obey TEST002(clean_up);
@@ -59,10 +59,33 @@ 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),
+ region_num, region_name, num_stores, num_store_files,
+ store_file_uncomp_size, store_file_size, mem_store_size,
+ 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
+ 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
+ from table(region stats(t002t1));
+
+select left(trim(schema_name) || '.' || trim(object_name), 14),
+ region_num, region_name, num_stores, num_store_files,
+ store_file_uncomp_size, store_file_size, mem_store_size,
+ 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
+ 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
+ from table(region stats(index t002t1i1));
+
+select left(trim(schema_name) || '.' || trim(object_name), 14),
+ region_num, region_name, num_stores, num_store_files,
+ store_file_uncomp_size, store_file_size, mem_store_size,
+ 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
+ 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
+ from table(region stats(t002t2));
+
+select left(trim(schema_name) || '.' || trim(object_name), 14),
+ region_num, region_name, num_stores, num_store_files,
+ store_file_uncomp_size, store_file_size, mem_store_size,
+ 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
+ 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
+ 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)
@@ -80,7 +103,11 @@ get region stats for
(get tables in schema t002sch, no header, return full names)x(a));
-- stats for all indexes on a table
-select *
+select left(trim(schema_name) || '.' || trim(object_name), 14),
+ region_num, region_name, num_stores, num_store_files,
+ store_file_uncomp_size, store_file_size, mem_store_size,
+ 'ReadRequestsCount: ' || cast(read_requests_count as varchar(10)),
+ 'WriteRequestsCount: ' || cast(write_requests_count as varchar(10))
from table(region stats (using (select * from (
get indexes on table t002t1, no header, return full names) x(a) )));
get region stats for
[7/9] incubator-trafodion git commit: fixes based on review comments.
Posted by sa...@apache.org.
fixes based on review comments.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/c73e0652
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/c73e0652
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/c73e0652
Branch: refs/heads/master
Commit: c73e0652a669ca54199f905faa68253287edb688
Parents: b4b9203
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Tue Dec 1 23:13:48 2015 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Tue Dec 1 23:13:48 2015 +0000
----------------------------------------------------------------------
core/sql/comexe/ComTdbExeUtil.h | 10 +--
core/sql/executor/ExExeUtilGet.cpp | 46 ++++++++++---
core/sql/parser/ParKeyWords.cpp | 2 +-
core/sql/parser/sqlparser.y | 30 ++++++---
core/sql/regress/seabase/EXPECTED002 | 103 ++++++++++++++++++++++--------
core/sql/regress/seabase/TEST002 | 10 +++
6 files changed, 149 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c73e0652/core/sql/comexe/ComTdbExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbExeUtil.h b/core/sql/comexe/ComTdbExeUtil.h
index b33ab5b..be1825b 100644
--- a/core/sql/comexe/ComTdbExeUtil.h
+++ b/core/sql/comexe/ComTdbExeUtil.h
@@ -3470,13 +3470,15 @@ static const ComTdbVirtTableColumnInfo comTdbRegionStatsVirtTableColumnInfo[] =
{ "WRITE_REQUESTS_COUNT", 11, COM_USER_COLUMN, REC_BIN64_SIGNED, 8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 }
};
+#define STATS_NAME_MAX_LEN 256
+#define STATS_REGION_NAME_MAX_LEN 512
struct ComTdbRegionStatsVirtTableColumnStruct
{
- char catalogName[256];
- char schemaName[256];
- char objectName[256];
+ char catalogName[STATS_NAME_MAX_LEN];
+ char schemaName[STATS_NAME_MAX_LEN];
+ char objectName[STATS_NAME_MAX_LEN];
Int64 regionNum;
- char regionName[512];
+ char regionName[STATS_REGION_NAME_MAX_LEN];
Lng32 numStores;
Lng32 numStoreFiles;
Int64 storeFileUncompSize;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c73e0652/core/sql/executor/ExExeUtilGet.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilGet.cpp b/core/sql/executor/ExExeUtilGet.cpp
index 963a999..cbf1d89 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -5404,8 +5404,8 @@ ExExeUtilRegionStatsTcb::ExExeUtilRegionStatsTcb(
tableName_ = new(glob->getDefaultHeap()) char[2000];
- // get hbase rootdir location
- hbaseRootdir_ = new(glob->getDefaultHeap()) char[1000];
+ // get hbase rootdir location. Max linux pathlength is 1024.
+ hbaseRootdir_ = new(glob->getDefaultHeap()) char[1030];
strcpy(hbaseRootdir_, "/hbase");
step_ = INITIAL_;
@@ -5708,6 +5708,25 @@ ExExeUtilRegionStatsFormatTcb::ExExeUtilRegionStatsFormatTcb(
step_ = INITIAL_;
}
+static NAString removeTrailingBlanks(char * name, Lng32 maxLen)
+{
+ NAString nas;
+
+ if (! name)
+ return nas;
+
+ Lng32 i = maxLen;
+ while ((i > 0) && (name[i-1] == ' '))
+ {
+ i--;
+ }
+
+ if (i > 0)
+ nas = NAString(name, i);
+
+ return nas;
+}
+
short ExExeUtilRegionStatsFormatTcb::initTotals()
{
statsTotals_->numStores = 0;
@@ -5724,11 +5743,14 @@ short ExExeUtilRegionStatsFormatTcb::initTotals()
short ExExeUtilRegionStatsFormatTcb::computeTotals()
{
str_pad(statsTotals_->catalogName, sizeof(statsTotals_->catalogName), ' ');
- str_cpy_and_null(statsTotals_->catalogName, catName_, strlen(catName_), '\0', ' ', TRUE);
+ str_cpy_all(statsTotals_->catalogName, catName_, strlen(catName_));
+
str_pad(statsTotals_->schemaName, sizeof(statsTotals_->schemaName), ' ');
- str_cpy_and_null(statsTotals_->schemaName, schName_, strlen(schName_), '\0', ' ', TRUE);
+ str_cpy_all(statsTotals_->schemaName, schName_, strlen(schName_));
+
str_pad(statsTotals_->objectName, sizeof(statsTotals_->objectName), ' ');
- str_cpy_and_null(statsTotals_->objectName, objName_, strlen(objName_), '\0', ' ', TRUE);
+ str_cpy_all(statsTotals_->objectName, objName_, strlen(objName_));
+
str_pad(statsTotals_->regionName, sizeof(statsTotals_->regionName), ' ');
for (Int32 currIndex = 0; currIndex < regionInfoList_->getSize(); currIndex++)
@@ -5877,11 +5899,14 @@ short ExExeUtilRegionStatsFormatTcb::work()
if (moveRowToUpQueue(buf, strlen(buf), &rc))
return rc;
- NAString objName = statsTotals_->catalogName;
+ NAString objName =
+ removeTrailingBlanks(statsTotals_->catalogName, STATS_NAME_MAX_LEN);
objName += ".";
- objName += statsTotals_->schemaName;
+ objName +=
+ removeTrailingBlanks(statsTotals_->schemaName, STATS_NAME_MAX_LEN);
objName += ".";
- objName += statsTotals_->objectName;
+ objName +=
+ removeTrailingBlanks(statsTotals_->objectName, STATS_NAME_MAX_LEN);
str_sprintf(buf, " ObjectName: %s", objName.data());
if (moveRowToUpQueue(buf, strlen(buf), &rc))
@@ -5985,7 +6010,7 @@ short ExExeUtilRegionStatsFormatTcb::work()
break;
}
- if (populateStats(currIndex_, TRUE))
+ if (populateStats(currIndex_))
{
step_ = HANDLE_ERROR_;
break;
@@ -6016,7 +6041,8 @@ short ExExeUtilRegionStatsFormatTcb::work()
if (moveRowToUpQueue(buf, strlen(buf), &rc))
return rc;
- str_sprintf(buf, " RegionName: %s", stats_->regionName);
+ str_sprintf(buf, " RegionName: %s",
+ removeTrailingBlanks(stats_->regionName, STATS_REGION_NAME_MAX_LEN).data(), TRUE);
if (moveRowToUpQueue(buf, strlen(buf), &rc))
return rc;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c73e0652/core/sql/parser/ParKeyWords.cpp
----------------------------------------------------------------------
diff --git a/core/sql/parser/ParKeyWords.cpp b/core/sql/parser/ParKeyWords.cpp
index 8c467ed..b46660e 100644
--- a/core/sql/parser/ParKeyWords.cpp
+++ b/core/sql/parser/ParKeyWords.cpp
@@ -1030,7 +1030,7 @@ ParKeyWord ParKeyWords::keyWords_[] = {
// used in QAT tests
ParKeyWord("STATEMENT", TOK_STATEMENT, NONRESTOKEN_),
ParKeyWord("STATIC", TOK_STATIC, NONRESTOKEN_),
- ParKeyWord("STATISTICS", TOK_STATISTICS, SECOND_|NONRESTOKEN_),
+ ParKeyWord("STATISTICS", TOK_STATISTICS, NONRESTOKEN_),
ParKeyWord("STATS", TOK_STATS, NONRESTOKEN_),
ParKeyWord("STATUS", TOK_STATUS, NONRESTOKEN_),
ParKeyWord("STDDEV", TOK_STDDEV, NONRESTOKEN_),
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c73e0652/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index 671d0c1..fe9d74e 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -2783,6 +2783,7 @@ static void enableMakeQuotedStringISO88591Mechanism()
%type <relx> exe_util_cleanup_volatile_tables
%type <relx> exe_util_aqr
%type <relx> exe_util_get_region_access_stats
+%type <boolean> stats_or_statistics
%type <aqrOptionsList> aqr_options_list
%type <aqrOption> aqr_option
%type <uint> aqr_task
@@ -6008,23 +6009,23 @@ TOK_TABLE '(' TOK_INTERNALSP '(' character_string_literal ')' ')'
$$ = lle;
}
-| TOK_TABLE '(' TOK_REGION TOK_STATS '(' ')' ')'
+| TOK_TABLE '(' TOK_REGION stats_or_statistics '(' ')' ')'
{
$$ = new (PARSERHEAP())
ExeUtilRegionStats(CorrName(""), FALSE, FALSE, FALSE, NULL, PARSERHEAP());
}
-| TOK_TABLE '(' TOK_REGION TOK_STATS '(' table_name ')' ')'
+| TOK_TABLE '(' TOK_REGION stats_or_statistics '(' table_name ')' ')'
{
$$ = new (PARSERHEAP())
ExeUtilRegionStats(*$6, FALSE, FALSE, FALSE, NULL, PARSERHEAP());
}
-| TOK_TABLE '(' TOK_REGION TOK_STATS '(' TOK_INDEX table_name ')' ')'
+| TOK_TABLE '(' TOK_REGION stats_or_statistics '(' TOK_INDEX table_name ')' ')'
{
$7->setSpecialType(ExtendedQualName::INDEX_TABLE);
$$ = new (PARSERHEAP())
ExeUtilRegionStats(*$7, FALSE, TRUE, FALSE, NULL, PARSERHEAP());
}
-| TOK_TABLE '(' TOK_REGION TOK_STATS '(' TOK_USING rel_subquery ')' ')'
+| TOK_TABLE '(' TOK_REGION stats_or_statistics '(' TOK_USING rel_subquery ')' ')'
{
$$ = new (PARSERHEAP())
ExeUtilRegionStats(CorrName("DUMMY"), FALSE, FALSE, FALSE, $7, PARSERHEAP());
@@ -16211,43 +16212,52 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
}
/* type relx */
-exe_util_get_region_access_stats : TOK_GET TOK_REGION TOK_STATS TOK_FOR TOK_TABLE table_name
+exe_util_get_region_access_stats : TOK_GET TOK_REGION stats_or_statistics TOK_FOR TOK_TABLE table_name
{
$$ = new (PARSERHEAP())
ExeUtilRegionStats(*$6, FALSE, FALSE, TRUE, NULL, PARSERHEAP());
}
- | TOK_GET TOK_REGION TOK_STATS TOK_FOR TOK_INDEX table_name
+ | TOK_GET TOK_REGION stats_or_statistics TOK_FOR TOK_INDEX table_name
{
$6->setSpecialType(ExtendedQualName::INDEX_TABLE);
$$ = new (PARSERHEAP())
ExeUtilRegionStats(*$6, FALSE, TRUE, TRUE, NULL, PARSERHEAP());
}
- | TOK_GET TOK_REGION TOK_STATS TOK_FOR rel_subquery
+ | TOK_GET TOK_REGION stats_or_statistics TOK_FOR rel_subquery
{
$$ = new (PARSERHEAP())
ExeUtilRegionStats(
CorrName("DUMMY"), FALSE, TRUE, TRUE, $5, PARSERHEAP());
}
- | TOK_GET TOK_REGION TOK_STATS TOK_FOR TOK_TABLE table_name ',' TOK_SUMMARY
+ | TOK_GET TOK_REGION stats_or_statistics TOK_FOR TOK_TABLE table_name ',' TOK_SUMMARY
{
$$ = new (PARSERHEAP())
ExeUtilRegionStats(*$6, TRUE, FALSE, TRUE, NULL, PARSERHEAP());
}
- | TOK_GET TOK_REGION TOK_STATS TOK_FOR TOK_INDEX table_name ',' TOK_SUMMARY
+ | TOK_GET TOK_REGION stats_or_statistics TOK_FOR TOK_INDEX table_name ',' TOK_SUMMARY
{
$6->setSpecialType(ExtendedQualName::INDEX_TABLE);
$$ = new (PARSERHEAP())
ExeUtilRegionStats(*$6, TRUE, TRUE, TRUE, NULL, PARSERHEAP());
}
- | TOK_GET TOK_REGION TOK_STATS TOK_FOR rel_subquery ',' TOK_SUMMARY
+ | TOK_GET TOK_REGION stats_or_statistics TOK_FOR rel_subquery ',' TOK_SUMMARY
{
$$ = new (PARSERHEAP())
ExeUtilRegionStats(
CorrName("DUMMY"), TRUE, TRUE, TRUE, $5, PARSERHEAP());
}
+stats_or_statistics : TOK_STATS
+ {
+ $$ = TRUE;
+ }
+ | TOK_STATISTICS
+ {
+ $$ = TRUE;
+ }
+
/*
* 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
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c73e0652/core/sql/regress/seabase/EXPECTED002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED002 b/core/sql/regress/seabase/EXPECTED002
index 1b56260..22131c5 100644
--- a/core/sql/regress/seabase/EXPECTED002
+++ b/core/sql/regress/seabase/EXPECTED002
@@ -62,7 +62,7 @@ A B
>>invoke table(region stats ());
-- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__
--- Definition current Sat Nov 28 16:07:27 2015
+-- Definition current Tue Dec 1 20:28:59 2015
(
CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -87,7 +87,7 @@ A B
>>invoke table(region stats (t002t1));
-- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__
--- Definition current Sat Nov 28 16:07:28 2015
+-- Definition current Tue Dec 1 20:29:01 2015
(
CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -120,7 +120,7 @@ A B
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/8bb4f679579199d03d7f610bec389948 2 0 0 0 0 ReadRequestsCount: 2 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/d8e501bc4b1e00c4a363ddbfddb73ce6 2 0 0 0 0 ReadRequestsCount: 2 WriteRequestsCount: 1
--- 1 row(s) selected.
>>
@@ -134,7 +134,7 @@ T002SCH.T002T1 1
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/063997b7b1aa3d335501fc78296708ba 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/6ecaf721eab09f276a465486204b9224 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
--- 1 row(s) selected.
>>
@@ -148,10 +148,10 @@ T002SCH.T002T1 1
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2/57b9567e1e3ade7a22dba5447579dd6f 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
-T002SCH.T002T2 2 TRAFODION.T002SCH.T002T2/48d51d2d9395038ad05201c03701330b 2 0 0 0 0 ReadRequestsCount: 1 WriteRequestsCount: 1
-T002SCH.T002T2 3 TRAFODION.T002SCH.T002T2/bbe7fd3cb6b812f201be57047c266ce9 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
-T002SCH.T002T2 4 TRAFODION.T002SCH.T002T2/e3fd1521aca16734c6e1afe2a493d5d7 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
+T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2/08950a2e799b5158e7bc01f7d381da15 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
+T002SCH.T002T2 2 TRAFODION.T002SCH.T002T2/8f5f1f95e9f83eb80059038985b55e56 2 0 0 0 0 ReadRequestsCount: 1 WriteRequestsCount: 1
+T002SCH.T002T2 3 TRAFODION.T002SCH.T002T2/74c3d257b6633eeb7097c587dadd2e1e 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
+T002SCH.T002T2 4 TRAFODION.T002SCH.T002T2/eb2ed476df0e857b6a8eaa9618b1923b 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
--- 4 row(s) selected.
>>
@@ -165,7 +165,7 @@ T002SCH.T002T2 4
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2I1/47d3338bc9349068a1461da09fe0d3bd 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2I1/94aaac02a94952f6bd9b33f408f8c0dc 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
--- 1 row(s) selected.
>>
@@ -185,6 +185,22 @@ T002SCH.T002T1 0
--- 2 row(s) selected.
>>
+>>select left(trim(schema_name) || '.' || trim(object_name), 14),
++> sum(store_file_size),
++> 'ReadRequestsCount: ' || cast(sum(read_requests_count) as varchar(10)),
++> 'WriteRequestsCount: ' || cast(sum(write_requests_count) as varchar(10))
++> from table(region statistics (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 ReadRequestsCount: 1 WriteRequestsCount: 1
+T002SCH.T002T1 0 ReadRequestsCount: 2 WriteRequestsCount: 1
+
+--- 2 row(s) selected.
+>>
>>get region stats for table t002t1;
@@ -206,7 +222,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1/8bb4f679579199d03d7f610bec389948
+ RegionName: TRAFODION.T002SCH.T002T1/d8e501bc4b1e00c4a363ddbfddb73ce6
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -238,7 +254,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I1/063997b7b1aa3d335501fc78296708ba
+ RegionName: TRAFODION.T002SCH.T002T1I1/6ecaf721eab09f276a465486204b9224
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -270,7 +286,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2/57b9567e1e3ade7a22dba5447579dd6f
+ RegionName: TRAFODION.T002SCH.T002T2/08950a2e799b5158e7bc01f7d381da15
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -280,7 +296,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 2
- RegionName: TRAFODION.T002SCH.T002T2/48d51d2d9395038ad05201c03701330b
+ RegionName: TRAFODION.T002SCH.T002T2/8f5f1f95e9f83eb80059038985b55e56
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -290,7 +306,7 @@ Stats Details
WriteRequestsCount: 1
RegionNum: 3
- RegionName: TRAFODION.T002SCH.T002T2/bbe7fd3cb6b812f201be57047c266ce9
+ RegionName: TRAFODION.T002SCH.T002T2/74c3d257b6633eeb7097c587dadd2e1e
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -300,7 +316,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 4
- RegionName: TRAFODION.T002SCH.T002T2/e3fd1521aca16734c6e1afe2a493d5d7
+ RegionName: TRAFODION.T002SCH.T002T2/eb2ed476df0e857b6a8eaa9618b1923b
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -325,20 +341,53 @@ Stats Summary
TotalUncompressedSize: 0
TotalStoreFileSize: 0
TotalMemStoreSize: 0
- TotalReadRequestsCount: 1
+ TotalReadRequestsCount: 0
TotalWriteRequestsCount: 1
Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2I1/47d3338bc9349068a1461da09fe0d3bd
+ RegionName: TRAFODION.T002SCH.T002T2I1/94aaac02a94952f6bd9b33f408f8c0dc
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
StoreFileSize: 0 (less than 1MB)
MemStoreSize: 0 (less than 1MB)
- ReadRequestsCount: 1
+ ReadRequestsCount: 0
+ WriteRequestsCount: 1
+
+
+--- SQL operation complete.
+>>
+>>get region statistics 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/d8e501bc4b1e00c4a363ddbfddb73ce6
+ NumStores: 2
+ NumStoreFiles: 0
+ UncompressedSize: 0 (less than 1MB)
+ StoreFileSize: 0 (less than 1MB)
+ MemStoreSize: 0 (less than 1MB)
+ ReadRequestsCount: 2
WriteRequestsCount: 1
@@ -367,7 +416,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1/8bb4f679579199d03d7f610bec389948
+ RegionName: TRAFODION.T002SCH.T002T1/d8e501bc4b1e00c4a363ddbfddb73ce6
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -395,7 +444,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2/57b9567e1e3ade7a22dba5447579dd6f
+ RegionName: TRAFODION.T002SCH.T002T2/08950a2e799b5158e7bc01f7d381da15
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -405,7 +454,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 2
- RegionName: TRAFODION.T002SCH.T002T2/48d51d2d9395038ad05201c03701330b
+ RegionName: TRAFODION.T002SCH.T002T2/8f5f1f95e9f83eb80059038985b55e56
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -415,7 +464,7 @@ Stats Details
WriteRequestsCount: 1
RegionNum: 3
- RegionName: TRAFODION.T002SCH.T002T2/bbe7fd3cb6b812f201be57047c266ce9
+ RegionName: TRAFODION.T002SCH.T002T2/74c3d257b6633eeb7097c587dadd2e1e
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -425,7 +474,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 4
- RegionName: TRAFODION.T002SCH.T002T2/e3fd1521aca16734c6e1afe2a493d5d7
+ RegionName: TRAFODION.T002SCH.T002T2/eb2ed476df0e857b6a8eaa9618b1923b
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -449,8 +498,8 @@ Stats Details
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/063997b7b1aa3d335501fc78296708ba 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
-T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I2/e1d921638743bb5988eb7e011dbdd3f3 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/6ecaf721eab09f276a465486204b9224 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I2/b36b08f5d1152de7006cc11bc2c07e26 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
--- 2 row(s) selected.
>>get region stats for
@@ -476,7 +525,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I1/063997b7b1aa3d335501fc78296708ba
+ RegionName: TRAFODION.T002SCH.T002T1I1/6ecaf721eab09f276a465486204b9224
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -504,7 +553,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I2/e1d921638743bb5988eb7e011dbdd3f3
+ RegionName: TRAFODION.T002SCH.T002T1I2/b36b08f5d1152de7006cc11bc2c07e26
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c73e0652/core/sql/regress/seabase/TEST002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST002 b/core/sql/regress/seabase/TEST002
index 60c159e..7a97e49 100644
--- a/core/sql/regress/seabase/TEST002
+++ b/core/sql/regress/seabase/TEST002
@@ -95,11 +95,21 @@ select left(trim(schema_name) || '.' || trim(object_name), 14),
get tables in schema t002sch, no header, return full names) x(a) )))
group by 1 order by 2 desc;
+select left(trim(schema_name) || '.' || trim(object_name), 14),
+ sum(store_file_size),
+ 'ReadRequestsCount: ' || cast(sum(read_requests_count) as varchar(10)),
+ 'WriteRequestsCount: ' || cast(sum(write_requests_count) as varchar(10))
+ from table(region statistics (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 statistics for table t002t1;
+
get region stats for
(select * from
(get tables in schema t002sch, no header, return full names)x(a));
[2/9] incubator-trafodion git commit: JIRA Trafodion-1645 SQL
commands to retrieve region stats.
Posted by sa...@apache.org.
JIRA Trafodion-1645 SQL commands to retrieve region stats.
Details in JIRA.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/51698645
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/51698645
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/51698645
Branch: refs/heads/master
Commit: 51698645d910ee0eee1b9301caae3f743bbbba07
Parents: 1baeae6
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Wed Nov 25 20:28:24 2015 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Wed Nov 25 20:28:24 2015 +0000
----------------------------------------------------------------------
core/sqf/tools/sqtools.sh | 4 +-
core/sql/comexe/ComTdb.h | 2 +-
core/sql/comexe/ComTdbExeUtil.cpp | 27 +
core/sql/comexe/ComTdbExeUtil.h | 117 +++
core/sql/executor/ExComTdb.cpp | 7 +
core/sql/executor/ExExeUtil.h | 167 ++++
core/sql/executor/ExExeUtilCommon.cpp | 7 +-
core/sql/executor/ExExeUtilGet.cpp | 798 ++++++++++++++++++-
core/sql/executor/HBaseClient_JNI.cpp | 58 ++
core/sql/executor/HBaseClient_JNI.h | 2 +
core/sql/exp/ExpHbaseInterface.cpp | 16 +
core/sql/exp/ExpHbaseInterface.h | 3 +
core/sql/generator/GenRelExeUtil.cpp | 119 +++
core/sql/optimizer/BindRelExpr.cpp | 5 +
core/sql/optimizer/RelExeUtil.cpp | 128 ++-
core/sql/optimizer/RelExeUtil.h | 60 ++
core/sql/parser/ParKeyWords.cpp | 2 +
core/sql/parser/sqlparser.y | 102 ++-
core/sql/regress/seabase/EXPECTED002 | 599 ++++++++++++++
core/sql/regress/seabase/FILTER002 | 29 +
core/sql/regress/seabase/TEST002 | 105 +++
core/sql/sqlcomp/CmpDescribe.cpp | 19 +-
.../java/org/trafodion/sql/HBaseClient.java | 57 +-
.../java/org/trafodion/sql/TrafRegionStats.java | 144 ++++
24 files changed, 2541 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sqf/tools/sqtools.sh
----------------------------------------------------------------------
diff --git a/core/sqf/tools/sqtools.sh b/core/sqf/tools/sqtools.sh
index 4832308..0c7767c 100644
--- a/core/sqf/tools/sqtools.sh
+++ b/core/sqf/tools/sqtools.sh
@@ -953,7 +953,9 @@ function cdt {
function cdc {
cd /local/cores/$UID
}
-
+function cdj {
+ cd $MY_SQROOT/../sql/src/main/java/org/trafodion/sql
+}
# ls variants
function lst {
ls -lsrt $*
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/comexe/ComTdb.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdb.h b/core/sql/comexe/ComTdb.h
index 93f3553..5846fd8 100644
--- a/core/sql/comexe/ComTdb.h
+++ b/core/sql/comexe/ComTdb.h
@@ -290,7 +290,7 @@ public:
ex_GET_VERSION_INFO = 118,
ex_SUSPEND_ACTIVATE = 121,
ex_DISK_LABEL_STATISTICS = 122,
- ex_GET_DISK_LABEL_STATS = 123,
+ ex_REGION_STATS = 123,
ex_GET_FORMATTED_DISK_STATS = 124,
ex_SHOW_SET = 125,
ex_AQR = 126,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/comexe/ComTdbExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbExeUtil.cpp b/core/sql/comexe/ComTdbExeUtil.cpp
index 1463a07..631969f 100644
--- a/core/sql/comexe/ComTdbExeUtil.cpp
+++ b/core/sql/comexe/ComTdbExeUtil.cpp
@@ -2778,3 +2778,30 @@ void ComTdbExeUtilHBaseBulkUnLoad::displayContents(Space * space,ULng32 flag)
}
}
+ComTdbExeUtilRegionStats::ComTdbExeUtilRegionStats
+(
+ char * tableName,
+ ex_expr_base * input_expr,
+ ULng32 input_rowlen,
+ ex_cri_desc * work_cri_desc,
+ const unsigned short work_atp_index,
+ ex_cri_desc * given_cri_desc,
+ ex_cri_desc * returned_cri_desc,
+ queue_index down,
+ queue_index up,
+ Lng32 num_buffers,
+ ULng32 buffer_size)
+ : ComTdbExeUtil(ComTdbExeUtil::REGION_STATS_,
+ NULL, 0, (Int16)SQLCHARSETCODE_UNKNOWN,
+ tableName, strlen(tableName),
+ input_expr, input_rowlen,
+ NULL, 0,
+ NULL,
+ work_cri_desc, work_atp_index,
+ given_cri_desc, returned_cri_desc,
+ down, up,
+ num_buffers, buffer_size),
+ flags_(0)
+{
+ setNodeType(ComTdb::ex_REGION_STATS);
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/comexe/ComTdbExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbExeUtil.h b/core/sql/comexe/ComTdbExeUtil.h
index 8389bcc..b33ab5b 100644
--- a/core/sql/comexe/ComTdbExeUtil.h
+++ b/core/sql/comexe/ComTdbExeUtil.h
@@ -69,6 +69,7 @@ public:
GET_MAINTAIN_INFO_ = 9,
GET_STATISTICS_ = 10,
USER_LOAD_ = 11,
+ REGION_STATS_ = 12,
LONG_RUNNING_ = 13,
GET_METADATA_INFO_ = 14,
GET_VERSION_INFO_ = 15,
@@ -3452,6 +3453,122 @@ private:
NABasicPtr snapshotSuffix_; // 30 - 37
char fillersExeUtilHbaseUnLoad_[16]; // 38 - 53
};
+
+static const ComTdbVirtTableColumnInfo comTdbRegionStatsVirtTableColumnInfo[] =
+ {
+ { "CATALOG_NAME", 0, COM_USER_COLUMN, REC_BYTE_F_ASCII, 256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "SCHEMA_NAME", 1, COM_USER_COLUMN, REC_BYTE_F_ASCII, 256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "OBJECT_NAME", 2, COM_USER_COLUMN, REC_BYTE_F_ASCII, 256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "REGION_NUM", 3, COM_USER_COLUMN, REC_BIN64_SIGNED, 4, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "REGION_NAME", 4, COM_USER_COLUMN, REC_BYTE_F_ASCII, 512, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "NUM_STORES", 5, COM_USER_COLUMN, REC_BIN32_SIGNED, 8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "NUM_STORE_FILES", 6, COM_USER_COLUMN, REC_BIN32_SIGNED, 8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "STORE_FILE_UNCOMP_SIZE", 7, COM_USER_COLUMN, REC_BIN64_SIGNED, 8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "STORE_FILE_SIZE", 8, COM_USER_COLUMN, REC_BIN64_SIGNED, 8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "MEM_STORE_SIZE", 9, COM_USER_COLUMN, REC_BIN64_SIGNED, 8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "READ_REQUESTS_COUNT", 10, COM_USER_COLUMN, REC_BIN64_SIGNED, 8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 },
+ { "WRITE_REQUESTS_COUNT", 11, COM_USER_COLUMN, REC_BIN64_SIGNED, 8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0 }
+ };
+
+struct ComTdbRegionStatsVirtTableColumnStruct
+{
+ char catalogName[256];
+ char schemaName[256];
+ char objectName[256];
+ Int64 regionNum;
+ char regionName[512];
+ Lng32 numStores;
+ Lng32 numStoreFiles;
+ Int64 storeFileUncompSize;
+ Int64 storeFileSize;
+ Int64 memStoreSize;
+ Int64 readRequestsCount;
+ Int64 writeRequestsCount;
+};
+
+
+class ComTdbExeUtilRegionStats : public ComTdbExeUtil
+{
+ friend class ExExeUtilRegionStatsTcb;
+ friend class ExExeUtilRegionStatsPrivateState;
+
+public:
+ ComTdbExeUtilRegionStats()
+ : ComTdbExeUtil()
+ {}
+
+ ComTdbExeUtilRegionStats(
+ char * tableName,
+ ex_expr_base * input_expr,
+ ULng32 input_rowlen,
+ ex_cri_desc * work_cri_desc,
+ const unsigned short work_atp_index,
+ ex_cri_desc * given_cri_desc,
+ ex_cri_desc * returned_cri_desc,
+ queue_index down,
+ queue_index up,
+ Lng32 num_buffers,
+ ULng32 buffer_size
+ );
+
+ // Long pack (void *);
+ // Lng32 unpack(void *, void * reallocator);
+
+ void setIsIndex(NABoolean v)
+ {(v ? flags_ |= IS_INDEX : flags_ &= ~IS_INDEX); };
+ NABoolean isIndex() { return (flags_ & IS_INDEX) != 0; };
+
+ void setDisplayFormat(NABoolean v)
+ {(v ? flags_ |= DISPLAY_FORMAT : flags_ &= ~DISPLAY_FORMAT); };
+ NABoolean displayFormat() { return (flags_ & DISPLAY_FORMAT) != 0; };
+
+ void setSummaryOnly(NABoolean v)
+ {(v ? flags_ |= SUMMARY_ONLY : flags_ &= ~SUMMARY_ONLY); };
+ NABoolean summaryOnly() { return (flags_ & SUMMARY_ONLY) != 0; };
+
+ // ---------------------------------------------------------------------
+ // Redefine virtual functions required for Versioning.
+ //----------------------------------------------------------------------
+ virtual short getClassSize() {return (short)sizeof(ComTdbExeUtilRegionStats);}
+
+ virtual const char *getNodeName() const
+ {
+ return "GET_REGION_STATS";
+ };
+
+ static int getVirtTableNumCols()
+ {
+ return sizeof(comTdbRegionStatsVirtTableColumnInfo)/sizeof(ComTdbVirtTableColumnInfo);
+ }
+
+ static ComTdbVirtTableColumnInfo * getVirtTableColumnInfo()
+ {
+ return (ComTdbVirtTableColumnInfo*)comTdbRegionStatsVirtTableColumnInfo;
+ }
+
+ static int getVirtTableNumKeys()
+ {
+ return 0;
+ }
+
+ static ComTdbVirtTableKeyInfo * getVirtTableKeyInfo()
+ {
+ return NULL;
+ }
+
+private:
+ enum
+ {
+ IS_INDEX = 0x0001,
+ DISPLAY_FORMAT = 0x0002,
+ SUMMARY_ONLY = 0x0004
+ };
+
+ UInt32 flags_; // 00-03
+
+ char fillersComTdbExeUtilRegionStats_[76]; // 04-79
+};
+
#endif
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/executor/ExComTdb.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExComTdb.cpp b/core/sql/executor/ExComTdb.cpp
index 00d35b0..54ce150 100644
--- a/core/sql/executor/ExComTdb.cpp
+++ b/core/sql/executor/ExComTdb.cpp
@@ -696,6 +696,13 @@ NA_EIDPROC char *ComTdb::findVTblPtrExe(short classID)
break;
}
+ case ex_REGION_STATS:
+ {
+ GetVTblPtr(vtblptr,ExExeUtilRegionStatsTdb);
+
+ break;
+ }
+
#endif
default:
ex_assert(0, "findVTblPtrExe(): Cannot find entry of this ClassId"); // LCOV_EXCL_LINE
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/executor/ExExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtil.h b/core/sql/executor/ExExeUtil.h
index 61fd4b9..5c8e0b6 100755
--- a/core/sql/executor/ExExeUtil.h
+++ b/core/sql/executor/ExExeUtil.h
@@ -3635,6 +3635,173 @@ class ExExeUtilHbaseUnLoadPrivateState : public ex_tcb_private_state
protected:
};
+//////////////////////////////////////////////////////////////////////////
+// -----------------------------------------------------------------------
+// ExExeUtilRegionStatsTdb
+// -----------------------------------------------------------------------
+class ExExeUtilRegionStatsTdb : public ComTdbExeUtilRegionStats
+{
+public:
+
+ // ---------------------------------------------------------------------
+ // Constructor is only called to instantiate an object used for
+ // retrieval of the virtual table function pointer of the class while
+ // unpacking. An empty constructor is enough.
+ // ---------------------------------------------------------------------
+ NA_EIDPROC ExExeUtilRegionStatsTdb()
+ {}
+
+ NA_EIDPROC virtual ~ExExeUtilRegionStatsTdb()
+ {}
+
+ // ---------------------------------------------------------------------
+ // Build a TCB for this TDB. Redefined in the Executor project.
+ // ---------------------------------------------------------------------
+ NA_EIDPROC virtual ex_tcb *build(ex_globals *globals);
+
+private:
+ // ---------------------------------------------------------------------
+ // !!!!!!! IMPORTANT -- NO DATA MEMBERS ALLOWED IN EXECUTOR TDB !!!!!!!!
+ // *********************************************************************
+ // The Executor TDB's are only used for the sole purpose of providing a
+ // way to supplement the Compiler TDB's (in comexe) with methods whose
+ // implementation depends on Executor objects. This is done so as to
+ // decouple the Compiler from linking in Executor objects unnecessarily.
+ //
+ // When a Compiler generated TDB arrives at the Executor, the same data
+ // image is "cast" as an Executor TDB after unpacking. Therefore, it is
+ // a requirement that a Compiler TDB has the same object layout as its
+ // corresponding Executor TDB. As a result of this, all Executor TDB's
+ // must have absolutely NO data members, but only member functions. So,
+ // if you reach here with an intention to add data members to a TDB, ask
+ // yourself two questions:
+ //
+ // 1. Are those data members Compiler-generated?
+ // If yes, put them in the ComTdbDLL instead.
+ // If no, they should probably belong to someplace else (like TCB).
+ //
+ // 2. Are the classes those data members belong defined in the executor
+ // project?
+ // If your answer to both questions is yes, you might need to move
+ // the classes to the comexe project.
+ // ---------------------------------------------------------------------
+};
+
+//////////////////////////////////////////////////////////////////////////
+// -----------------------------------------------------------------------
+// ExExeUtilRegionStatsTcb
+// -----------------------------------------------------------------------
+class ExExeUtilRegionStatsTcb : public ExExeUtilTcb
+{
+ friend class ExExeUtilRegionStatsTdb;
+ friend class ExExeUtilPrivateState;
+
+public:
+ // Constructor
+ ExExeUtilRegionStatsTcb(const ComTdbExeUtilRegionStats & exe_util_tdb,
+ ex_globals * glob = 0);
+
+ ~ExExeUtilRegionStatsTcb();
+
+ virtual short work();
+
+ ExExeUtilRegionStatsTdb & getDLStdb() const
+ {
+ return (ExExeUtilRegionStatsTdb &) tdb;
+ };
+
+private:
+ enum Step
+ {
+ INITIAL_,
+ EVAL_INPUT_,
+ COLLECT_STATS_,
+ POPULATE_STATS_BUF_,
+ RETURN_STATS_BUF_,
+ HANDLE_ERROR_,
+ DONE_
+ };
+ Step step_;
+
+protected:
+ Int64 getEmbeddedNumValue(char* &sep, char endChar,
+ NABoolean adjustLen = TRUE);
+
+ short collectStats(char * tableName);
+ short populateStats(Int32 currIndex, NABoolean nullTerminate = FALSE);
+
+ char * hbaseRootdir_;
+
+ char * tableName_;
+
+ char * inputNameBuf_;
+
+ char * statsBuf_;
+ Lng32 statsBufLen_;
+ ComTdbRegionStatsVirtTableColumnStruct* stats_;
+
+ ExpHbaseInterface * ehi_;
+ ByteArrayList * regionInfoList_;
+
+ Int32 currIndex_;
+
+ char * catName_;
+ char * schName_;
+ char * objName_;
+ char * regionName_;
+};
+
+//////////////////////////////////////////////////////////////////////////
+// -----------------------------------------------------------------------
+// ExExeUtilRegionStatsFormatTcb
+// -----------------------------------------------------------------------
+class ExExeUtilRegionStatsFormatTcb : public ExExeUtilRegionStatsTcb
+{
+ friend class ExExeUtilRegionStatsTdb;
+ friend class ExExeUtilPrivateState;
+
+public:
+ // Constructor
+ ExExeUtilRegionStatsFormatTcb(const ComTdbExeUtilRegionStats & exe_util_tdb,
+ ex_globals * glob = 0);
+
+ virtual short work();
+
+private:
+ enum Step
+ {
+ INITIAL_,
+ COLLECT_STATS_,
+ EVAL_INPUT_,
+ COMPUTE_TOTALS_,
+ RETURN_SUMMARY_,
+ RETURN_DETAILS_,
+ POPULATE_STATS_BUF_,
+ RETURN_REGION_INFO_,
+ HANDLE_ERROR_,
+ DONE_
+ };
+
+ Step step_;
+
+ char * statsTotalsBuf_;
+ ComTdbRegionStatsVirtTableColumnStruct* statsTotals_;
+
+ short initTotals();
+ short computeTotals();
+};
+
+////////////////////////////////////////////////////////////////////////////
+class ExExeUtilRegionStatsPrivateState : public ex_tcb_private_state
+{
+ friend class ExExeUtilRegionStatsTcb;
+
+public:
+ ExExeUtilRegionStatsPrivateState();
+ ~ExExeUtilRegionStatsPrivateState(); // destructor
+protected:
+};
+
#endif
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/executor/ExExeUtilCommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilCommon.cpp b/core/sql/executor/ExExeUtilCommon.cpp
index 1552b75..51bac92 100644
--- a/core/sql/executor/ExExeUtilCommon.cpp
+++ b/core/sql/executor/ExExeUtilCommon.cpp
@@ -326,7 +326,7 @@ short ExExeUtilTcb::extractObjectParts(
NABoolean ExExeUtilTcb::isUpQueueFull(short size)
{
- if ((qparent_.up->getSize() - qparent_.up->getLength()) < 5)
+ if ((qparent_.up->getSize() - qparent_.up->getLength()) < size)
return TRUE;
else
return FALSE;
@@ -335,8 +335,9 @@ NABoolean ExExeUtilTcb::isUpQueueFull(short size)
short ExExeUtilTcb::moveRowToUpQueue(const char * row, Lng32 len,
short * rc, NABoolean isVarchar)
{
- return ex_tcb::moveRowToUpQueue(&qparent_, exeUtilTdb().tuppIndex_,
- row, len, rc, isVarchar);
+ short retcode = ex_tcb::moveRowToUpQueue(&qparent_, exeUtilTdb().tuppIndex_,
+ row, len, rc, isVarchar);
+ return retcode;
}
char * ExExeUtilTcb::getTimeAsString(Int64 elapsedTime, char * timeBuf)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/executor/ExExeUtilGet.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilGet.cpp b/core/sql/executor/ExExeUtilGet.cpp
index 55ff963..963a999 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -64,6 +64,7 @@
#include "PrivMgrCommands.h"
#include "ExpHbaseInterface.h"
+#include "sql_buffer_size.h"
//******************************************************************************
// *
@@ -221,7 +222,7 @@ static const QueryString getComponentPrivilegesForUser[] =
static const QueryString getTrafTablesInSchemaQuery[] =
{
- {" select object_name from "},
+ {" select %sobject_name%s from "},
{" %s.\"%s\".%s "},
{" where catalog_name = '%s' and "},
{" schema_name = '%s' and "},
@@ -243,6 +244,21 @@ static const QueryString getTrafIndexesInSchemaQuery[] =
{" ; "}
};
+static const QueryString getTrafIndexesOnTableQuery[] =
+{
+ {" select %sO2.object_name%s from "},
+ {" %s.\"%s\".%s I, "},
+ {" %s.\"%s\".%s O, "},
+ {" %s.\"%s\".%s O2 "},
+ {" where O.catalog_name = '%s' "},
+ {" and O.schema_name = '%s' "},
+ {" and O.object_name = '%s' "},
+ {" and I.base_table_uid = O.object_uid "},
+ {" and I.index_uid = O2.object_uid "},
+ {" order by 1 "},
+ {" ; "}
+};
+
static const QueryString getTrafProceduresInSchemaQuery[] =
{
{" select object_name from "},
@@ -1657,6 +1673,7 @@ short ExExeUtilGetMetadataInfoTcb::work()
char sch[100];
char pmsch[100];
char tab[100];
+ char indexes[100];
char view[100];
char view_usage[100];
char auths[100];
@@ -1675,6 +1692,7 @@ short ExExeUtilGetMetadataInfoTcb::work()
strcpy(tab, SEABASE_OBJECTS);
strcpy(view, SEABASE_VIEWS);
strcpy(view_usage, SEABASE_VIEWS_USAGE);
+ strcpy(indexes, SEABASE_INDEXES);
strcpy(auths, SEABASE_AUTHS);
strcpy(role_usage, "ROLE_USAGE");
strcpy(components, "COMPONENTS");
@@ -1711,11 +1729,13 @@ short ExExeUtilGetMetadataInfoTcb::work()
qs = getTrafTablesInSchemaQuery;
sizeOfqs = sizeof(getTrafTablesInSchemaQuery);
- param_[0] = cat;
- param_[1] = sch;
- param_[2] = tab;
- param_[3] = getMItdb().cat_;
- param_[4] = getMItdb().sch_;
+ param_[0] = catSchValue;
+ param_[1] = endQuote;
+ param_[2] = cat;
+ param_[3] = sch;
+ param_[4] = tab;
+ param_[5] = getMItdb().cat_;
+ param_[6] = getMItdb().sch_;
}
break;
@@ -1785,6 +1805,29 @@ short ExExeUtilGetMetadataInfoTcb::work()
}
break;
+ case ComTdbExeUtilGetMetadataInfo::INDEXES_ON_TABLE_:
+ {
+ qs = getTrafIndexesOnTableQuery;
+ sizeOfqs = sizeof(getTrafIndexesOnTableQuery);
+
+ param_[0] = catSchValue;
+ param_[1] = endQuote;
+ param_[2] = cat;
+ param_[3] = sch;
+ param_[4] = indexes;
+ param_[5] = cat;
+ param_[6] = sch;
+ param_[7] = tab;
+ param_[8] = cat;
+ param_[9] = sch;
+ param_[10] = tab;
+ param_[11] = getMItdb().cat_;
+ param_[12] = getMItdb().sch_;
+ param_[13] = getMItdb().obj_;
+
+ }
+ break;
+
case ComTdbExeUtilGetMetadataInfo::VIEWS_ON_TABLE_:
case ComTdbExeUtilGetMetadataInfo::VIEWS_ON_VIEW_:
{
@@ -3450,7 +3493,7 @@ short ExExeUtilGetMetadataInfoVersionTcb::work()
// make sure there is enough space to move header
if (isUpQueueFull(5))
{
- return WORK_OK; // come back later
+ return WORK_CALL_AGAIN; // come back later
}
if (numOutputEntries_ == 2)
@@ -5315,4 +5358,745 @@ ExExeUtilHiveMDaccessPrivateState::~ExExeUtilHiveMDaccessPrivateState()
{
};
+///////////////////////////////////////////////////////////////////
+ex_tcb * ExExeUtilRegionStatsTdb::build(ex_globals * glob)
+{
+ ExExeUtilRegionStatsTcb * exe_util_tcb;
+
+ if (displayFormat())
+ exe_util_tcb = new(glob->getSpace()) ExExeUtilRegionStatsFormatTcb(*this, glob);
+ else
+ exe_util_tcb = new(glob->getSpace()) ExExeUtilRegionStatsTcb(*this, glob);
+
+ exe_util_tcb->registerSubtasks();
+
+ return (exe_util_tcb);
+}
+
+////////////////////////////////////////////////////////////////
+// Constructor for class ExExeUtilRegionStatsTcb
+///////////////////////////////////////////////////////////////
+ExExeUtilRegionStatsTcb::ExExeUtilRegionStatsTcb(
+ const ComTdbExeUtilRegionStats & exe_util_tdb,
+ ex_globals * glob)
+ : ExExeUtilTcb( exe_util_tdb, NULL, glob)
+{
+ statsBuf_ = new(glob->getDefaultHeap()) char[sizeof(ComTdbRegionStatsVirtTableColumnStruct)];
+ statsBufLen_ = sizeof(ComTdbRegionStatsVirtTableColumnStruct);
+
+ stats_ = (ComTdbRegionStatsVirtTableColumnStruct*)statsBuf_;
+
+ inputNameBuf_ = NULL;
+ if (exe_util_tdb.inputExpr_)
+ {
+ inputNameBuf_ = new(glob->getDefaultHeap()) char[exe_util_tdb.inputRowlen_];
+ }
+
+ int jniDebugPort = 0;
+ int jniDebugTimeout = 0;
+ ehi_ = ExpHbaseInterface::newInstance(glob->getDefaultHeap(),
+ (char*)"", //exe_util_tdb.server(),
+ (char*)"", //exe_util_tdb.zkPort(),
+ jniDebugPort,
+ jniDebugTimeout);
+
+ regionInfoList_ = NULL;
+
+ tableName_ = new(glob->getDefaultHeap()) char[2000];
+
+ // get hbase rootdir location
+ hbaseRootdir_ = new(glob->getDefaultHeap()) char[1000];
+ strcpy(hbaseRootdir_, "/hbase");
+
+ step_ = INITIAL_;
+}
+
+ExExeUtilRegionStatsTcb::~ExExeUtilRegionStatsTcb()
+{
+ if (statsBuf_)
+ NADELETEBASIC(statsBuf_, getGlobals()->getDefaultHeap());
+
+ if (ehi_)
+ delete ehi_;
+
+ statsBuf_ = NULL;
+}
+
+//////////////////////////////////////////////////////
+// work() for ExExeUtilRegionStatsTcb
+//////////////////////////////////////////////////////
+Int64 ExExeUtilRegionStatsTcb::getEmbeddedNumValue
+(char* &sep, char endChar, NABoolean adjustLen)
+{
+ Int64 num = -1;
+ char * sepEnd = strchr(sep+1, endChar);
+ if (sepEnd)
+ {
+ char longBuf[30];
+
+ Lng32 len = sepEnd - sep - 1;
+ str_cpy_all(longBuf, (sep+1), len);
+ longBuf[len] = 0;
+
+ num = str_atoi(longBuf, len);
+
+ sep += len + 1;
+
+ if ((adjustLen) && (num == 0))
+ num = 1024;
+ }
+
+ return num;
+}
+
+short ExExeUtilRegionStatsTcb::collectStats(char * tableName)
+{
+ // populate catName_, schName_, objName_.
+ if (extractParts(tableName,
+ &catName_, &schName_, &objName_))
+ {
+ return -1;
+ }
+
+ // collect stats from ehi.
+ HbaseStr tblName;
+
+ NAString extNameForHbase =
+ NAString(catName_) + "." + NAString(schName_) + "." + NAString(objName_);
+ tblName.val = (char*)extNameForHbase.data();
+ tblName.len = extNameForHbase.length();
+
+ regionInfoList_ = ehi_->getRegionStats(tblName);
+ if (! regionInfoList_)
+ {
+ return -1;
+ }
+
+ currIndex_ = 0;
+
+ return 0;
+}
+
+short ExExeUtilRegionStatsTcb::populateStats
+(Int32 currIndex, NABoolean nullTerminate)
+{
+ str_pad(stats_->catalogName, sizeof(stats_->catalogName), ' ');
+ str_cpy_all(stats_->catalogName, catName_, strlen(catName_));
+ if (nullTerminate)
+ stats_->catalogName[strlen(catName_)] = 0;
+
+ str_pad(stats_->schemaName, sizeof(stats_->schemaName), ' ');
+ str_cpy_all(stats_->schemaName, schName_, strlen(schName_));
+ if (nullTerminate)
+ stats_->schemaName[strlen(schName_)] = 0;
+
+ str_pad(stats_->objectName, sizeof(stats_->objectName), ' ');
+ str_cpy_all(stats_->objectName, objName_, strlen(objName_));
+ if (nullTerminate)
+ stats_->objectName[strlen(objName_)] = 0;
+
+ str_pad(stats_->regionName, sizeof(stats_->regionName), ' ');
+ stats_->regionNum = currIndex_+1;
+
+ char regionInfoBuf[5000];
+ Int32 len = 0;
+ char * regionInfo =
+ regionInfoList_->getEntry
+ (currIndex, regionInfoBuf, 5000, len);
+ regionInfo[len] = 0;
+
+ stats_->numStores = 0;
+ stats_->numStoreFiles = 0;
+ stats_->storeFileUncompSize = 0;
+ stats_->storeFileSize = 0;
+ stats_->memStoreSize = 0;
+
+ char longBuf[30];
+ char * sep1 = strchr(regionInfo, '|');
+ if (sep1)
+ {
+ str_cpy_all(stats_->regionName, regionInfo,
+ (Lng32)(sep1 - regionInfo));
+
+ if (nullTerminate)
+ stats_->regionName[sep1 - regionInfo] = 0;
+ }
+
+ char * sepStart = sep1;
+ stats_->numStores = getEmbeddedNumValue(sepStart, '|', FALSE);
+ stats_->numStoreFiles = getEmbeddedNumValue(sepStart, '|', FALSE);
+ stats_->storeFileUncompSize = getEmbeddedNumValue(sepStart, '|', FALSE);
+ stats_->storeFileSize = getEmbeddedNumValue(sepStart, '|', FALSE);
+ stats_->memStoreSize = getEmbeddedNumValue(sepStart, '|', FALSE);
+ stats_->readRequestsCount = getEmbeddedNumValue(sepStart, '|', FALSE);
+ stats_->writeRequestsCount = getEmbeddedNumValue(sepStart, '|', FALSE);
+
+ return 0;
+}
+
+short ExExeUtilRegionStatsTcb::work()
+{
+ short retcode = 0;
+ Lng32 cliRC = 0;
+
+ // if no parent request, return
+ if (qparent_.down->isEmpty())
+ return WORK_OK;
+
+ // if no room in up queue, won't be able to return data/status.
+ // Come back later.
+ if (qparent_.up->isFull())
+ return WORK_OK;
+
+ ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
+ ExExeUtilPrivateState & pstate =
+ *((ExExeUtilPrivateState*) pentry_down->pstate);
+
+ // Get the globals stucture of the master executor.
+ ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
+ ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
+ ContextCli * currContext = masterGlob->getCliGlobals()->currContext();
+
+ while (1)
+ {
+ switch (step_)
+ {
+ case INITIAL_:
+ {
+ if (ehi_ == NULL)
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ if (getDLStdb().inputExpr())
+ {
+ step_ = EVAL_INPUT_;
+ break;
+ }
+
+ strcpy(tableName_, getDLStdb().getTableName());
+
+ step_ = COLLECT_STATS_;
+ }
+ break;
+
+ case EVAL_INPUT_:
+ {
+ workAtp_->getTupp(getDLStdb().workAtpIndex())
+ .setDataPointer(inputNameBuf_);
+
+ ex_expr::exp_return_type exprRetCode =
+ getDLStdb().inputExpr()->eval(pentry_down->getAtp(), workAtp_);
+ if (exprRetCode == ex_expr::EXPR_ERROR)
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ short len = *(short*)inputNameBuf_;
+ str_cpy_all(tableName_, &inputNameBuf_[2], len);
+ tableName_[len] = 0;
+
+ step_ = COLLECT_STATS_;
+ }
+ break;
+
+ case COLLECT_STATS_:
+ {
+ if (collectStats(tableName_))
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ currIndex_ = 0;
+
+ step_ = POPULATE_STATS_BUF_;
+ }
+ break;
+
+ case POPULATE_STATS_BUF_:
+ {
+ if (currIndex_ == regionInfoList_->getSize())
+ {
+ step_ = DONE_;
+ break;
+ }
+
+ if (populateStats(currIndex_))
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ step_ = RETURN_STATS_BUF_;
+ }
+ break;
+
+ case RETURN_STATS_BUF_:
+ {
+ if (qparent_.up->isFull())
+ return WORK_OK;
+
+ short rc = 0;
+ if (moveRowToUpQueue((char*)stats_, statsBufLen_, &rc, FALSE))
+ return rc;
+
+ currIndex_++;
+
+ step_ = POPULATE_STATS_BUF_;
+ }
+ break;
+
+ case HANDLE_ERROR_:
+ {
+ retcode = handleError();
+ if (retcode == 1)
+ return WORK_OK;
+
+ step_ = DONE_;
+ }
+ break;
+
+ case DONE_:
+ {
+ retcode = handleDone();
+ if (retcode == 1)
+ return WORK_OK;
+
+ step_ = INITIAL_;
+
+ return WORK_CALL_AGAIN;
+ }
+ break;
+
+
+ } // switch
+
+ } // while
+
+ return WORK_OK;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Constructor and destructor for ExeUtil_private_state
+/////////////////////////////////////////////////////////////////////////////
+ExExeUtilRegionStatsPrivateState::ExExeUtilRegionStatsPrivateState()
+{
+}
+
+ExExeUtilRegionStatsPrivateState::~ExExeUtilRegionStatsPrivateState()
+{
+};
+
+
+////////////////////////////////////////////////////////////////
+// Constructor for class ExExeUtilRegionStatsFormatTcb
+///////////////////////////////////////////////////////////////
+ExExeUtilRegionStatsFormatTcb::ExExeUtilRegionStatsFormatTcb(
+ const ComTdbExeUtilRegionStats & exe_util_tdb,
+ ex_globals * glob)
+ : ExExeUtilRegionStatsTcb( exe_util_tdb, glob)
+{
+ statsTotalsBuf_ = new(glob->getDefaultHeap()) char[sizeof(ComTdbRegionStatsVirtTableColumnStruct)];
+
+ statsTotals_ = (ComTdbRegionStatsVirtTableColumnStruct*)statsTotalsBuf_;
+
+ initTotals();
+
+ step_ = INITIAL_;
+}
+
+short ExExeUtilRegionStatsFormatTcb::initTotals()
+{
+ statsTotals_->numStores = 0;
+ statsTotals_->numStoreFiles = 0;
+ statsTotals_->readRequestsCount = 0;
+ statsTotals_->writeRequestsCount = 0;
+ statsTotals_->storeFileUncompSize = 0;
+ statsTotals_->storeFileSize = 0;
+ statsTotals_->memStoreSize = 0;
+
+ return 0;
+}
+
+short ExExeUtilRegionStatsFormatTcb::computeTotals()
+{
+ str_pad(statsTotals_->catalogName, sizeof(statsTotals_->catalogName), ' ');
+ str_cpy_and_null(statsTotals_->catalogName, catName_, strlen(catName_), '\0', ' ', TRUE);
+ str_pad(statsTotals_->schemaName, sizeof(statsTotals_->schemaName), ' ');
+ str_cpy_and_null(statsTotals_->schemaName, schName_, strlen(schName_), '\0', ' ', TRUE);
+ str_pad(statsTotals_->objectName, sizeof(statsTotals_->objectName), ' ');
+ str_cpy_and_null(statsTotals_->objectName, objName_, strlen(objName_), '\0', ' ', TRUE);
+ str_pad(statsTotals_->regionName, sizeof(statsTotals_->regionName), ' ');
+
+ for (Int32 currIndex = 0; currIndex < regionInfoList_->getSize(); currIndex++)
+ {
+ if (populateStats(currIndex))
+ return -1;
+
+ statsTotals_->numStores += stats_->numStores;
+ statsTotals_->numStoreFiles += stats_->numStoreFiles;
+ statsTotals_->storeFileUncompSize += stats_->storeFileUncompSize;
+ statsTotals_->storeFileSize += stats_->storeFileSize;
+ statsTotals_->memStoreSize += stats_->memStoreSize;
+ statsTotals_->readRequestsCount += stats_->readRequestsCount;
+ statsTotals_->writeRequestsCount += stats_->writeRequestsCount;
+ }
+
+ return 0;
+}
+
+short ExExeUtilRegionStatsFormatTcb::work()
+{
+ short retcode = 0;
+ Lng32 cliRC = 0;
+
+ // if no parent request, return
+ if (qparent_.down->isEmpty())
+ return WORK_OK;
+
+ // if no room in up queue, won't be able to return data/status.
+ // Come back later.
+ if (qparent_.up->isFull())
+ return WORK_OK;
+
+ ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
+ ExExeUtilPrivateState & pstate =
+ *((ExExeUtilPrivateState*) pentry_down->pstate);
+
+ // Get the globals stucture of the master executor.
+ ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
+ ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
+ ContextCli * currContext = masterGlob->getCliGlobals()->currContext();
+
+ while (1)
+ {
+ switch (step_)
+ {
+ case INITIAL_:
+ {
+ if (ehi_ == NULL)
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ initTotals();
+
+ if (getDLStdb().inputExpr())
+ {
+ step_ = EVAL_INPUT_;
+ break;
+ }
+
+ strcpy(tableName_, getDLStdb().getTableName());
+
+ step_ = COLLECT_STATS_;
+ }
+ break;
+
+ case EVAL_INPUT_:
+ {
+ workAtp_->getTupp(getDLStdb().workAtpIndex())
+ .setDataPointer(inputNameBuf_);
+
+ ex_expr::exp_return_type exprRetCode =
+ getDLStdb().inputExpr()->eval(pentry_down->getAtp(), workAtp_);
+ if (exprRetCode == ex_expr::EXPR_ERROR)
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ short len = *(short*)inputNameBuf_;
+ str_cpy_all(tableName_, &inputNameBuf_[2], len);
+ tableName_[len] = 0;
+
+ step_ = COLLECT_STATS_;
+ }
+ break;
+
+ case COLLECT_STATS_:
+ {
+ if (collectStats(tableName_))
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ currIndex_ = 0;
+
+ step_ = COMPUTE_TOTALS_;
+ }
+ break;
+
+ case COMPUTE_TOTALS_:
+ {
+ if (computeTotals())
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ step_ = RETURN_SUMMARY_;
+ }
+ break;
+
+ case RETURN_SUMMARY_:
+ {
+ // make sure there is enough space to move header
+ if (isUpQueueFull(14))
+ {
+ return WORK_CALL_AGAIN; // come back later
+ }
+
+ ULng32 neededSize = SqlBufferNeededSize(14, 250);
+ if (! pool_->get_free_buffer(neededSize))
+ {
+ return WORK_CALL_AGAIN;
+ }
+
+ char buf[1000];
+ short rc = 0;
+
+ str_sprintf(buf, " ");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, "Stats Summary");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, "=============");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " ");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ NAString objName = statsTotals_->catalogName;
+ objName += ".";
+ objName += statsTotals_->schemaName;
+ objName += ".";
+ objName += statsTotals_->objectName;
+
+ str_sprintf(buf, " ObjectName: %s", objName.data());
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " NumRegions: %d", regionInfoList_->getSize());
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " RegionsLocation: %s/data/default",
+ hbaseRootdir_);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " TotalNumStores: %d", statsTotals_->numStores);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " TotalNumStoreFiles: %d", statsTotals_->numStoreFiles);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " TotalUncompressedSize: %Ld", statsTotals_->storeFileUncompSize);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " TotalStoreFileSize: %Ld", statsTotals_->storeFileSize);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " TotalMemStoreSize: %Ld", statsTotals_->memStoreSize);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " TotalReadRequestsCount: %Ld", statsTotals_->readRequestsCount);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " TotalWriteRequestsCount: %Ld", statsTotals_->writeRequestsCount);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ step_ = RETURN_DETAILS_;
+ return WORK_RESCHEDULE_AND_RETURN;
+ }
+ break;
+
+ case RETURN_DETAILS_:
+ {
+
+ if ((getDLStdb().summaryOnly()) ||
+ (regionInfoList_->getSize() == 0))
+ {
+ step_ = DONE_;
+ break;
+ }
+
+ // make sure there is enough space to move header
+ if (isUpQueueFull(4))
+ {
+ return WORK_CALL_AGAIN; // come back later
+ }
+
+ ULng32 neededSize = SqlBufferNeededSize(4, 250);
+ if (! pool_->get_free_buffer(neededSize))
+ {
+ return WORK_CALL_AGAIN;
+ }
+
+ char buf[1000];
+ short rc = 0;
+
+ str_sprintf(buf, " ");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, "Stats Details");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, "=============");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " ");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ currIndex_ = 0;
+ step_ = POPULATE_STATS_BUF_;
+
+ return WORK_RESCHEDULE_AND_RETURN;
+ }
+ break;
+
+ case POPULATE_STATS_BUF_:
+ {
+ if (currIndex_ == regionInfoList_->getSize())
+ {
+ step_ = DONE_;
+ break;
+ }
+
+ if (populateStats(currIndex_, TRUE))
+ {
+ step_ = HANDLE_ERROR_;
+ break;
+ }
+
+ step_ = RETURN_REGION_INFO_;
+ }
+ break;
+
+ case RETURN_REGION_INFO_:
+ {
+ // make sure there is enough space to move header
+ if (isUpQueueFull(10))
+ {
+ return WORK_CALL_AGAIN; // come back later
+ }
+
+ ULng32 neededSize = SqlBufferNeededSize(4, 100);
+ if (! pool_->get_free_buffer(neededSize))
+ {
+ return WORK_CALL_AGAIN;
+ }
+
+ char buf[1000];
+ short rc = 0;
+
+ str_sprintf(buf, " RegionNum: %d", currIndex_+1);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " RegionName: %s", stats_->regionName);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " NumStores: %d", stats_->numStores);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " NumStoreFiles: %d", stats_->numStoreFiles);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ if (stats_->storeFileUncompSize == 0)
+ str_sprintf(buf, " UncompressedSize: %Ld (less than 1MB)", stats_->storeFileUncompSize);
+ else
+ str_sprintf(buf, " UncompressedSize: %Ld Bytes", stats_->storeFileUncompSize);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ if (stats_->storeFileSize == 0)
+ str_sprintf(buf, " StoreFileSize: %Ld (less than 1MB)", stats_->storeFileSize);
+ else
+ str_sprintf(buf, " StoreFileSize: %Ld Bytes", stats_->storeFileSize);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ if (stats_->memStoreSize == 0)
+ str_sprintf(buf, " MemStoreSize: %Ld (less than 1MB)", stats_->memStoreSize);
+ else
+ str_sprintf(buf, " MemStoreSize: %Ld Bytes", stats_->memStoreSize);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " ReadRequestsCount: %Ld", stats_->readRequestsCount);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " WriteRequestsCount: %Ld", stats_->writeRequestsCount);
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ str_sprintf(buf, " ");
+ if (moveRowToUpQueue(buf, strlen(buf), &rc))
+ return rc;
+
+ currIndex_++;
+
+ step_ = POPULATE_STATS_BUF_;
+
+ return WORK_RESCHEDULE_AND_RETURN;
+ }
+ break;
+
+ case HANDLE_ERROR_:
+ {
+ retcode = handleError();
+ if (retcode == 1)
+ return WORK_OK;
+
+ step_ = DONE_;
+ }
+ break;
+
+ case DONE_:
+ {
+ retcode = handleDone();
+ if (retcode == 1)
+ return WORK_OK;
+
+ step_ = INITIAL_;
+
+ return WORK_CALL_AGAIN;
+ }
+ break;
+
+
+ } // switch
+
+ } // while
+
+ return WORK_OK;
+}
+
//LCOV_EXCL_STOP
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/executor/HBaseClient_JNI.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/HBaseClient_JNI.cpp b/core/sql/executor/HBaseClient_JNI.cpp
index e0712b2..c728733 100644
--- a/core/sql/executor/HBaseClient_JNI.cpp
+++ b/core/sql/executor/HBaseClient_JNI.cpp
@@ -449,6 +449,8 @@ HBC_RetCode HBaseClient_JNI::init()
JavaMethods_[JM_DROP_ALL ].jm_signature = "(Ljava/lang/String;)Z";
JavaMethods_[JM_LIST_ALL ].jm_name = "listAll";
JavaMethods_[JM_LIST_ALL ].jm_signature = "(Ljava/lang/String;)Lorg/trafodion/sql/ByteArrayList;";
+ JavaMethods_[JM_GET_REGION_STATS ].jm_name = "getRegionStats";
+ JavaMethods_[JM_GET_REGION_STATS ].jm_signature = "(Ljava/lang/String;)Lorg/trafodion/sql/ByteArrayList;";
JavaMethods_[JM_COPY ].jm_name = "copy";
JavaMethods_[JM_COPY ].jm_signature = "(Ljava/lang/String;Ljava/lang/String;)Z";
JavaMethods_[JM_EXISTS ].jm_name = "exists";
@@ -1465,6 +1467,62 @@ ByteArrayList* HBaseClient_JNI::listAll(const char* pattern)
//////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////////
+ByteArrayList* HBaseClient_JNI::getRegionStats(const char* tblName)
+{
+ QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "HBaseClient_JNI::getRegionStats(%s) called.", tblName);
+
+ if (jenv_ == NULL)
+ if (initJVM() != JOI_OK)
+ return NULL;
+
+ if (jenv_->PushLocalFrame(jniHandleCapacity_) != 0) {
+ getExceptionDetails();
+ return NULL;
+ }
+ jstring js_tblName = jenv_->NewStringUTF(tblName);
+ if (js_tblName == NULL)
+ {
+ GetCliGlobals()->setJniErrorStr(getErrorText(HBC_ERROR_DROP_PARAM));
+ jenv_->PopLocalFrame(NULL);
+ return NULL;
+ }
+
+ tsRecentJMFromJNI = JavaMethods_[JM_GET_REGION_STATS].jm_full_name;
+ jobject jByteArrayList =
+ jenv_->CallObjectMethod(javaObj_, JavaMethods_[JM_GET_REGION_STATS].methodID, js_tblName);
+
+ jenv_->DeleteLocalRef(js_tblName);
+
+ if (jenv_->ExceptionCheck())
+ {
+ getExceptionDetails(jenv_);
+ logError(CAT_SQL_HBASE, __FILE__, __LINE__);
+ logError(CAT_SQL_HBASE, "HBaseClient_JNI::getRegionStats()", getLastError());
+ jenv_->PopLocalFrame(NULL);
+ return NULL;
+ }
+
+ if (jByteArrayList == NULL) {
+ jenv_->PopLocalFrame(NULL);
+ return NULL;
+ }
+
+ ByteArrayList* regionInfo = new (heap_) ByteArrayList(heap_, jByteArrayList);
+ jenv_->DeleteLocalRef(jByteArrayList);
+ if (regionInfo->init() != BAL_OK)
+ {
+ NADELETE(regionInfo, ByteArrayList, heap_);
+ jenv_->PopLocalFrame(NULL);
+ return NULL;
+ }
+
+ jenv_->PopLocalFrame(NULL);
+ return regionInfo;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//////////////////////////////////////////////////////////////////////////////
HBC_RetCode HBaseClient_JNI::copy(const char* currTblName, const char* oldTblName)
{
QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "HBaseClient_JNI::copy(%s,%s) called.", currTblName, oldTblName);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/executor/HBaseClient_JNI.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/HBaseClient_JNI.h b/core/sql/executor/HBaseClient_JNI.h
index e4129d1..b7edd01 100644
--- a/core/sql/executor/HBaseClient_JNI.h
+++ b/core/sql/executor/HBaseClient_JNI.h
@@ -513,6 +513,7 @@ public:
HBC_RetCode dropAll(const char* pattern, bool async);
HBC_RetCode copy(const char* currTblName, const char* oldTblName);
ByteArrayList* listAll(const char* pattern);
+ ByteArrayList* getRegionStats(const char* tblName);
static HBC_RetCode flushAllTablesStatic();
HBC_RetCode flushAllTables();
HBC_RetCode exists(const char* fileName);
@@ -597,6 +598,7 @@ private:
,JM_DROP
,JM_DROP_ALL
,JM_LIST_ALL
+ ,JM_GET_REGION_STATS
,JM_COPY
,JM_EXISTS
,JM_FLUSHALL
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/exp/ExpHbaseInterface.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpHbaseInterface.cpp b/core/sql/exp/ExpHbaseInterface.cpp
index 90a79dc..8a43330 100644
--- a/core/sql/exp/ExpHbaseInterface.cpp
+++ b/core/sql/exp/ExpHbaseInterface.cpp
@@ -1568,3 +1568,19 @@ Lng32 ExpHbaseInterface_JNI::getBlockCacheFraction(float& frac)
retCode_ = client_->getBlockCacheFraction(frac);
return retCode_;
}
+
+ByteArrayList * ExpHbaseInterface_JNI::getRegionStats(const HbaseStr& tblName)
+{
+ if (client_ == NULL)
+ {
+ if (init(hbs_) != HBASE_ACCESS_SUCCESS)
+ return NULL;
+ }
+
+ ByteArrayList* regionStats = client_->getRegionStats(tblName.val);
+ if (regionStats == NULL)
+ return NULL;
+
+ return regionStats;
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/exp/ExpHbaseInterface.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpHbaseInterface.h b/core/sql/exp/ExpHbaseInterface.h
index 8647806..1bf50b5 100644
--- a/core/sql/exp/ExpHbaseInterface.h
+++ b/core/sql/exp/ExpHbaseInterface.h
@@ -380,6 +380,8 @@ class ExpHbaseInterface : public NABasicObject
Int32 partns,
ARRAY(const char *)& nodeNames) = 0;
+ // get regions and size
+ virtual ByteArrayList* getRegionStats(const HbaseStr& tblName) = 0;
protected:
enum
@@ -679,6 +681,7 @@ virtual Lng32 initHFileParams(HbaseStr &tblName,
Int32 partns,
ARRAY(const char *)& nodeNames) ;
+ virtual ByteArrayList* getRegionStats(const HbaseStr& tblName);
private:
bool useTRex_;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/generator/GenRelExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelExeUtil.cpp b/core/sql/generator/GenRelExeUtil.cpp
index ba307b2..fe4c757 100644
--- a/core/sql/generator/GenRelExeUtil.cpp
+++ b/core/sql/generator/GenRelExeUtil.cpp
@@ -3275,6 +3275,125 @@ short ExeUtilFastDelete::codeGen(Generator * generator)
return 0;
}
+////////////////////////////////////////////////////////////////////
+// class ExeUtilRegionStats
+////////////////////////////////////////////////////////////////////
+const char * ExeUtilRegionStats::getVirtualTableName()
+{ return ("EXE_UTIL_REGION_STATS__"); }
+
+desc_struct *ExeUtilRegionStats::createVirtualTableDesc()
+{
+ desc_struct * table_desc = NULL;
+ if (displayFormat_)
+ table_desc = ExeUtilExpr::createVirtualTableDesc();
+ else
+ table_desc = Generator::createVirtualTableDesc(
+ getVirtualTableName(),
+ ComTdbExeUtilRegionStats::getVirtTableNumCols(),
+ ComTdbExeUtilRegionStats::getVirtTableColumnInfo(),
+ ComTdbExeUtilRegionStats::getVirtTableNumKeys(),
+ ComTdbExeUtilRegionStats::getVirtTableKeyInfo());
+ return table_desc;
+}
+
+short ExeUtilRegionStats::codeGen(Generator * generator)
+{
+ ExpGenerator * expGen = generator->getExpGenerator();
+ Space * space = generator->getSpace();
+
+ // allocate a map table for the retrieved columns
+ generator->appendAtEnd();
+
+ ex_cri_desc * givenDesc
+ = generator->getCriDesc(Generator::DOWN);
+
+ ex_cri_desc * returnedDesc
+ = new(space) ex_cri_desc(givenDesc->noTuples() + 1, space);
+
+ ex_cri_desc * workCriDesc = new(space) ex_cri_desc(4, space);
+ const int work_atp = 1;
+ const int exe_util_row_atp_index = 2;
+
+ short rc = processOutputRow(generator, work_atp, exe_util_row_atp_index,
+ returnedDesc);
+ if (rc)
+ {
+ return -1;
+ }
+
+ ex_expr * input_expr = 0;
+ ULng32 inputRowLen = 0;
+
+ if (inputColList_)
+ {
+ ValueIdList inputVIDList;
+ ItemExpr * inputExpr = new(generator->wHeap())
+ Cast(inputColList_,
+ new (generator->wHeap())
+ SQLVarChar(inputColList_->getValueId().getType().getNominalSize(),
+ inputColList_->getValueId().getType().supportsSQLnull()));
+
+ inputExpr->bindNode(generator->getBindWA());
+ inputVIDList.insert(inputExpr->getValueId());
+
+ expGen->
+ processValIdList(inputVIDList,
+ ExpTupleDesc::SQLARK_EXPLODED_FORMAT,
+ inputRowLen,
+ work_atp,
+ exe_util_row_atp_index
+ );
+
+ expGen->
+ generateContiguousMoveExpr(inputVIDList,
+ 0, // don't add conv nodes
+ work_atp,
+ exe_util_row_atp_index,
+ ExpTupleDesc::SQLARK_EXPLODED_FORMAT,
+ inputRowLen,
+ &input_expr);
+ }
+
+ char * tableName = space->AllocateAndCopyToAlignedSpace
+ (generator->genGetNameAsAnsiNAString(getTableName()), 0);
+
+ ComTdbExeUtilRegionStats * exe_util_tdb = new(space)
+ ComTdbExeUtilRegionStats(
+ tableName,
+ input_expr,
+ inputRowLen,
+ workCriDesc,
+ exe_util_row_atp_index,
+ givenDesc,
+ returnedDesc,
+ (queue_index)64,
+ (queue_index)64,
+ 4,
+ 64000);
+ generator->initTdbFields(exe_util_tdb);
+
+ exe_util_tdb->setIsIndex(isIndex_);
+
+ exe_util_tdb->setDisplayFormat(displayFormat_);
+
+ exe_util_tdb->setSummaryOnly(summaryOnly_);
+
+ if(!generator->explainDisabled()) {
+ generator->setExplainTuple(
+ addExplainInfo(exe_util_tdb, 0, 0, generator));
+ }
+
+ generator->setCriDesc(givenDesc, Generator::DOWN);
+ generator->setCriDesc(returnedDesc, Generator::UP);
+ generator->setGenObj(this, exe_util_tdb);
+
+ // users should not start a transaction.
+ generator->setTransactionFlag(0);
+
+ return 0;
+}
+
+
// See ControlRunningQuery
/////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 5832abe..963b609 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -1302,6 +1302,11 @@ desc_struct *generateSpecialDesc(const CorrName& corrName)
StatisticsFunc sf;
desc = sf.createVirtualTableDesc();
}
+ else if (corrName.getQualifiedNameObj().getObjectName() == ExeUtilRegionStats::getVirtualTableNameStr())
+ {
+ ExeUtilRegionStats eudss;
+ desc = eudss.createVirtualTableDesc();
+ }
}
return desc;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/optimizer/RelExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelExeUtil.cpp b/core/sql/optimizer/RelExeUtil.cpp
index 55a5210..6095050 100644
--- a/core/sql/optimizer/RelExeUtil.cpp
+++ b/core/sql/optimizer/RelExeUtil.cpp
@@ -410,6 +410,10 @@ const NAString ExeUtilExpr::getText() const
result = "GET_QID";
break;
+ case REGION_STATS_:
+ result = "REGION_STATS";
+ break;
+
default:
result = "ADD_TO_EXEUTILEXPR::GETTEXT()";
@@ -3089,7 +3093,129 @@ RelExpr * ExeUtilAQR::copyTopNode(RelExpr *derivedNode, CollHeap* outHeap)
return ExeUtilExpr::copyTopNode(result, outHeap);
}
-// See ControlRunningQuery
+// -----------------------------------------------------------------------
+// Member functions for class ExeUtilRegionStats
+// -----------------------------------------------------------------------
+ExeUtilRegionStats::ExeUtilRegionStats
+(const CorrName &objectName,
+ NABoolean summaryOnly,
+ NABoolean isIndex,
+ NABoolean forDisplay,
+ RelExpr * child,
+ CollHeap *oHeap)
+ : ExeUtilExpr(REGION_STATS_, objectName,
+ NULL, child, NULL, CharInfo::UnknownCharSet, oHeap),
+ summaryOnly_(summaryOnly),
+ isIndex_(isIndex),
+ displayFormat_(forDisplay),
+ errorInParams_(FALSE),
+ inputColList_(NULL)
+{
+}
+
+RelExpr * ExeUtilRegionStats::copyTopNode(RelExpr *derivedNode, CollHeap* outHeap)
+{
+ ExeUtilRegionStats *result;
+
+ if (derivedNode == NULL)
+ result = new (outHeap) ExeUtilRegionStats(getTableName(),
+ summaryOnly_, isIndex_,
+ displayFormat_,
+ NULL,
+ outHeap);
+ else
+ result = (ExeUtilRegionStats *) derivedNode;
+
+ result->errorInParams_ = errorInParams_;
+
+ return ExeUtilExpr::copyTopNode(result, outHeap);
+}
+
+// -----------------------------------------------------------------------
+// member functions for class ExeUtilRegionStats
+// -----------------------------------------------------------------------
+RelExpr * ExeUtilRegionStats::bindNode(BindWA *bindWA)
+{
+ if (errorInParams_)
+ {
+ *CmpCommon::diags() << DgSqlCode(-4218) << DgString0("GET ");
+
+ bindWA->setErrStatus();
+ return this;
+ }
+
+ if (nodeIsBound()) {
+ bindWA->getCurrentScope()->setRETDesc(getRETDesc());
+ return this;
+ }
+
+ if (getTableName().getQualifiedNameObj().getObjectName().isNull())
+ {
+ *CmpCommon::diags() << DgSqlCode(-4218) << DgString0("REGION STATS");
+
+ bindWA->setErrStatus();
+ return this;
+ }
+
+ if (! child(0))
+ {
+ NATable * naTable = bindWA->getNATable(getTableName());
+ if ((!naTable) || (bindWA->errStatus()))
+ return this;
+ }
+
+ RelExpr * childExpr = NULL;
+
+ if (getArity() > 0)
+ {
+ childExpr = child(0)->bindNode(bindWA);
+ if (bindWA->errStatus())
+ return NULL;
+
+ if ((childExpr->getRETDesc() == NULL) ||
+ (childExpr->getRETDesc()->getDegree() > 1) ||
+ (childExpr->getRETDesc()->getType(0).getTypeQualifier() != NA_CHARACTER_TYPE))
+ {
+ *CmpCommon::diags() << DgSqlCode(-4218) << DgString0("REGION STATS ");
+
+ bindWA->setErrStatus();
+ return this;
+ }
+
+ inputColList_ = childExpr->getRETDesc()->getValueId(0).getItemExpr();
+
+ setChild(0, NULL);
+ }
+
+ RelExpr * boundExpr = ExeUtilExpr::bindNode(bindWA);
+ if (bindWA->errStatus())
+ return NULL;
+
+ if (childExpr)
+ {
+ RelExpr * re = new(PARSERHEAP()) Join
+ (childExpr, boundExpr, REL_TSJ_FLOW, NULL);
+ ((Join*)re)->doNotTransformToTSJ();
+ ((Join*)re)->setTSJForWrite(TRUE);
+
+ boundExpr = re->bindNode(bindWA);
+ if (bindWA->errStatus())
+ return NULL;
+ }
+
+ return boundExpr;
+}
+
+void ExeUtilRegionStats::recomputeOuterReferences()
+{
+ if (inputColList_)
+ {
+ ValueIdSet outerRefs = getGroupAttr()->getCharacteristicInputs();
+ outerRefs += inputColList_->getValueId();
+
+ getGroupAttr()->setCharacteristicInputs(outerRefs);
+ }
+} // ExeUtilRegionStats::recomputeOuterReferences()
// -----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/optimizer/RelExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelExeUtil.h b/core/sql/optimizer/RelExeUtil.h
index 7a3e976..404797b 100644
--- a/core/sql/optimizer/RelExeUtil.h
+++ b/core/sql/optimizer/RelExeUtil.h
@@ -87,6 +87,10 @@ public:
stmtText_ = NULL;
};
+ GenericUtilExpr(OperatorTypeEnum otype)
+ : RelExpr(otype, NULL, NULL, NULL)
+ {};
+
virtual RelExpr * bindNode(BindWA *bindWAPtr);
// method to do code generation
@@ -491,6 +495,7 @@ public:
GET_METADATA_INFO_ = 12,
GET_VERSION_INFO_ = 13,
SUSPEND_ACTIVATE_ = 14,
+ REGION_STATS_ = 15,
SHOWSET_DEFAULTS_ = 18,
AQR_ = 19,
DISPLAY_EXPLAIN_COMPLEX_ = 20,
@@ -527,6 +532,9 @@ public:
{
};
+ ExeUtilExpr()
+ : GenericUtilExpr(REL_EXE_UTIL) {};
+
virtual RelExpr * copyTopNode(RelExpr *derivedNode = NULL,
CollHeap* outHeap = 0);
virtual const NAString getText() const;
@@ -1656,6 +1664,58 @@ private:
AQRTask task_;
};
+class ExeUtilRegionStats : public ExeUtilExpr
+{
+public:
+
+ ExeUtilRegionStats(const CorrName &objectName,
+ NABoolean summaryOnly,
+ NABoolean isIndex,
+ NABoolean forDisplay,
+ RelExpr * child = NULL,
+ CollHeap *oHeap = CmpCommon::statementHeap());
+
+ ExeUtilRegionStats():
+ summaryOnly_(FALSE),
+ isIndex_(FALSE),
+ displayFormat_(FALSE)
+ {}
+
+ virtual RelExpr * bindNode(BindWA *bindWAPtr);
+
+ // a method used for recomputing the outer references (external dataflow
+ // input values) that are needed by this operator.
+ virtual void recomputeOuterReferences();
+
+ virtual RelExpr * copyTopNode(RelExpr *derivedNode = NULL,
+ CollHeap* outHeap = 0);
+
+ // method to do code generation
+ virtual short codeGen(Generator*);
+
+ virtual const char *getVirtualTableName();
+ static const char * getVirtualTableNameStr()
+ { return "EXE_UTIL_REGION_STATS__";}
+ virtual desc_struct *createVirtualTableDesc();
+
+ virtual NABoolean producesOutput() { return TRUE; }
+
+ virtual int getArity() const { return ((child(0) == NULL) ? 0 : 1); }
+
+ virtual NABoolean aqrSupported() { return TRUE; }
+
+private:
+ ItemExpr * inputColList_;
+
+ NABoolean summaryOnly_;
+
+ NABoolean isIndex_;
+
+ NABoolean displayFormat_;
+
+ NABoolean errorInParams_;
+};
+
class ExeUtilLongRunning : public ExeUtilExpr
{
public:
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/parser/ParKeyWords.cpp
----------------------------------------------------------------------
diff --git a/core/sql/parser/ParKeyWords.cpp b/core/sql/parser/ParKeyWords.cpp
index 9824f70..8c467ed 100644
--- a/core/sql/parser/ParKeyWords.cpp
+++ b/core/sql/parser/ParKeyWords.cpp
@@ -858,6 +858,7 @@ ParKeyWord ParKeyWords::keyWords_[] = {
ParKeyWord("REFERENCES", TOK_REFERENCES, ANS_|RESWORD_),
ParKeyWord("REFERENCING", TOK_REFERENCING, ANS_|RESWORD_|NONRESTOKEN_),
ParKeyWord("REFRESH", TOK_REFRESH, FLAGSNONE_),
+ ParKeyWord("REGION", TOK_REGION, NONRESTOKEN_),
ParKeyWord("REGISTER", TOK_REGISTER, NONRESTOKEN_),
ParKeyWord("REINITIALIZE", TOK_REINITIALIZE, FIRST_|NONRESTOKEN_),
ParKeyWord("RELATED", TOK_RELATED, NONRESTOKEN_),
@@ -1030,6 +1031,7 @@ ParKeyWord ParKeyWords::keyWords_[] = {
ParKeyWord("STATEMENT", TOK_STATEMENT, NONRESTOKEN_),
ParKeyWord("STATIC", TOK_STATIC, NONRESTOKEN_),
ParKeyWord("STATISTICS", TOK_STATISTICS, SECOND_|NONRESTOKEN_),
+ ParKeyWord("STATS", TOK_STATS, NONRESTOKEN_),
ParKeyWord("STATUS", TOK_STATUS, NONRESTOKEN_),
ParKeyWord("STDDEV", TOK_STDDEV, NONRESTOKEN_),
ParKeyWord("STOP", TOK_STOP, NONRESTOKEN_),
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/51698645/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index e7166cf..671d0c1 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -1353,6 +1353,7 @@ static void enableMakeQuotedStringISO88591Mechanism()
%token <tokval> TOK_RANGELOG /* MV */
%token <tokval> TOK_REBUILD
%token <tokval> TOK_REFERENCES
+%token <tokval> TOK_REGION
%token <tokval> TOK_REGISTER /* Tandem extension */
%token <tokval> TOK_UNREGISTER /* Tandem extension */
%token <tokval> TOK_RENAME /* Tandem extension */
@@ -1368,6 +1369,7 @@ static void enableMakeQuotedStringISO88591Mechanism()
%token <tokval> TOK_STORE /* Tandem extension */
%token <tokval> TOK_STORAGE
%token <tokval> TOK_STATISTICS /* Tandem extension non-reserved word */
+%token <tokval> TOK_STATS
%token <tokval> TOK_UNBOUNDED /* Tandem extension */
%token <tokval> TOK_VIEW
%token <tokval> TOK_VIEWS
@@ -2780,6 +2782,7 @@ static void enableMakeQuotedStringISO88591Mechanism()
%type <relx> exe_util_maintain_object
%type <relx> exe_util_cleanup_volatile_tables
%type <relx> exe_util_aqr
+%type <relx> exe_util_get_region_access_stats
%type <aqrOptionsList> aqr_options_list
%type <aqrOption> aqr_option
%type <uint> aqr_task
@@ -5942,7 +5945,9 @@ TOK_TABLE '(' TOK_INTERNALSP '(' character_string_literal ')' ')'
, $5
, REL_INTERNALSP
, PARSERHEAP()
- , RelInternalSP::executeInSameArkcmp | RelInternalSP::suppressDefaultSchema | RelInternalSP::requiresTMFTransaction);
+ , RelInternalSP::executeInSameArkcmp |
+ RelInternalSP::suppressDefaultSchema |
+ RelInternalSP::requiresTMFTransaction);
}
| TOK_TABLE '(' TOK_RELATEDNESS '(' value_expression_list ')' ')'
{
@@ -5950,7 +5955,9 @@ TOK_TABLE '(' TOK_INTERNALSP '(' character_string_literal ')' ')'
, $5
, REL_INTERNALSP
, PARSERHEAP()
- , RelInternalSP::executeInSameArkcmp | RelInternalSP::suppressDefaultSchema | RelInternalSP::requiresTMFTransaction);
+ , RelInternalSP::executeInSameArkcmp |
+ RelInternalSP::suppressDefaultSchema |
+ RelInternalSP::requiresTMFTransaction);
}
| TOK_TABLE '(' TOK_FEATURE_VERSION_INFO '(' value_expression_list ')' ')'
{
@@ -5958,7 +5965,9 @@ TOK_TABLE '(' TOK_INTERNALSP '(' character_string_literal ')' ')'
, $5
, REL_INTERNALSP
, PARSERHEAP()
- , RelInternalSP::executeInSameArkcmp | RelInternalSP::suppressDefaultSchema | RelInternalSP::requiresTMFTransaction);
+ , RelInternalSP::executeInSameArkcmp |
+ RelInternalSP::suppressDefaultSchema |
+ RelInternalSP::requiresTMFTransaction);
}
| sp_proxy_stmt_prefix '(' proxy_columns ')' ')'
{
@@ -5996,8 +6005,30 @@ TOK_TABLE '(' TOK_INTERNALSP '(' character_string_literal ')' ')'
(handle,
ExeUtilLobExtract::TO_STRING_,
NULL, NULL, 0, 0);
- }
+ $$ = lle;
+ }
+| TOK_TABLE '(' TOK_REGION TOK_STATS '(' ')' ')'
+ {
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(CorrName(""), FALSE, FALSE, FALSE, NULL, PARSERHEAP());
+ }
+| TOK_TABLE '(' TOK_REGION TOK_STATS '(' table_name ')' ')'
+ {
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(*$6, FALSE, FALSE, FALSE, NULL, PARSERHEAP());
+ }
+| TOK_TABLE '(' TOK_REGION TOK_STATS '(' TOK_INDEX table_name ')' ')'
+ {
+ $7->setSpecialType(ExtendedQualName::INDEX_TABLE);
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(*$7, FALSE, TRUE, FALSE, NULL, PARSERHEAP());
+ }
+| TOK_TABLE '(' TOK_REGION TOK_STATS '(' TOK_USING rel_subquery ')' ')'
+ {
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(CorrName("DUMMY"), FALSE, FALSE, FALSE, $7, PARSERHEAP());
+ }
hivemd_identifier :
TOK_ALIAS { $$ = new (PARSERHEAP()) NAString("ALIAS"); }
@@ -14503,6 +14534,11 @@ interactive_query_expression:
{
$$ = finalize($1);
}
+ | exe_util_get_region_access_stats
+ {
+ $$ = finalize($1);
+ }
+
| TOK_SELECT TOK_UUID '(' ')'
{
NAString * v = new (PARSERHEAP()) NAString("1");
@@ -16174,6 +16210,43 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
$$ = de;
}
+/* type relx */
+exe_util_get_region_access_stats : TOK_GET TOK_REGION TOK_STATS TOK_FOR TOK_TABLE table_name
+ {
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(*$6, FALSE, FALSE, TRUE, NULL, PARSERHEAP());
+ }
+ | TOK_GET TOK_REGION TOK_STATS TOK_FOR TOK_INDEX table_name
+ {
+ $6->setSpecialType(ExtendedQualName::INDEX_TABLE);
+
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(*$6, FALSE, TRUE, TRUE, NULL, PARSERHEAP());
+ }
+ | TOK_GET TOK_REGION TOK_STATS TOK_FOR rel_subquery
+ {
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(
+ CorrName("DUMMY"), FALSE, TRUE, TRUE, $5, PARSERHEAP());
+ }
+ | TOK_GET TOK_REGION TOK_STATS TOK_FOR TOK_TABLE table_name ',' TOK_SUMMARY
+ {
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(*$6, TRUE, FALSE, TRUE, NULL, PARSERHEAP());
+ }
+ | TOK_GET TOK_REGION TOK_STATS TOK_FOR TOK_INDEX table_name ',' TOK_SUMMARY
+ {
+ $6->setSpecialType(ExtendedQualName::INDEX_TABLE);
+
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(*$6, TRUE, TRUE, TRUE, NULL, PARSERHEAP());
+ }
+ | TOK_GET TOK_REGION TOK_STATS TOK_FOR rel_subquery ',' TOK_SUMMARY
+ {
+ $$ = new (PARSERHEAP())
+ ExeUtilRegionStats(
+ CorrName("DUMMY"), TRUE, TRUE, TRUE, $5, PARSERHEAP());
+ }
/*
* The purpose of dummy_token_lookahead is to force the lexer to look
@@ -22155,19 +22228,26 @@ show_statement:
$2->getOperatorType() == REL_EXE_UTIL ||
$2->getOperatorType() == REL_SCAN)
{
- if ($2->getOperatorType() != REL_SCAN)
- {
+ if ($2->getOperatorType() == REL_EXE_UTIL)
+ {
c = new(PARSERHEAP())
- CorrName(((TableValuedFunction *)$2)->
+ CorrName(((ExeUtilExpr *)$2)->
getVirtualTableName());
- c->setSpecialType(ExtendedQualName::VIRTUAL_TABLE);
- }
- else
+ c->setSpecialType(ExtendedQualName::VIRTUAL_TABLE);
+ }
+ else if ($2->getOperatorType() == REL_SCAN)
{
Scan* ha = (Scan*)$2;
c = new(PARSERHEAP())
CorrName(ha->getTableName());
}
+ else
+ {
+ c = new(PARSERHEAP())
+ CorrName(((TableValuedFunction *)$2)->
+ getVirtualTableName());
+ c->setSpecialType(ExtendedQualName::VIRTUAL_TABLE);
+ }
$$ = new (PARSERHEAP())
RelRoot(new (PARSERHEAP())
@@ -32853,6 +32933,7 @@ nonreserved_word : TOK_ABORT
| TOK_RECOVER
| TOK_RECOVERY
| TOK_REFRESH // MV
+ | TOK_REGION
| TOK_REGISTER
| TOK_REINITIALIZE
| TOK_RELATED
@@ -32922,6 +33003,7 @@ nonreserved_word : TOK_ABORT
| TOK_STATEMENT
| TOK_STATIC
| TOK_STATISTICS
+ | TOK_STATS
| TOK_STATUS
| TOK_STORAGE
| TOK_STORE
[3/9] incubator-trafodion git commit: Merge remote branch
'origin/master' into br_regstats
Posted by sa...@apache.org.
Merge remote branch 'origin/master' into br_regstats
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/0b869345
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/0b869345
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/0b869345
Branch: refs/heads/master
Commit: 0b8693459d37367a674dcafe96ad3eca65b3c353
Parents: 5169864 f8856eb
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Wed Nov 25 20:29:22 2015 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Wed Nov 25 20:29:22 2015 +0000
----------------------------------------------------------------------
core/sqf/sql/scripts/gensq.pl | 20 +++-
core/sqf/sql/scripts/lobstart | 4 +-
core/sqf/sql/scripts/makemsg.ksh | 2 +-
core/sql/ustat/hs_cli.cpp | 4 +-
core/sql/ustat/hs_cli.h | 2 +-
core/sql/ustat/hs_globals.cpp | 128 ++-----------------------
core/sql/ustat/hs_globals.h | 2 -
core/sql/ustat/hs_la.h | 6 +-
core/sql/ustat/hs_parser.cpp | 1 -
win-odbc64/odbcclient/drvr35/cconnect.cpp | 8 +-
10 files changed, 37 insertions(+), 140 deletions(-)
----------------------------------------------------------------------
[6/9] incubator-trafodion git commit: regr file updates #2
Posted by sa...@apache.org.
regr file updates #2
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/b4b9203b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/b4b9203b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/b4b9203b
Branch: refs/heads/master
Commit: b4b9203b0ae72c1e0bab86a9661ea8d8ca94ce3a
Parents: 0a46c5b
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Sat Nov 28 16:08:18 2015 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Sat Nov 28 16:08:18 2015 +0000
----------------------------------------------------------------------
core/sql/regress/seabase/EXPECTED002 | 62 ++++++++++++++++---------------
core/sql/regress/seabase/FILTER002 | 4 +-
core/sql/regress/seabase/TEST002 | 4 +-
3 files changed, 37 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b4b9203b/core/sql/regress/seabase/EXPECTED002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED002 b/core/sql/regress/seabase/EXPECTED002
index a1c7ec2..1b56260 100644
--- a/core/sql/regress/seabase/EXPECTED002
+++ b/core/sql/regress/seabase/EXPECTED002
@@ -62,7 +62,7 @@ A B
>>invoke table(region stats ());
-- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__
--- Definition current Sat Nov 28 05:32:23 2015
+-- Definition current Sat Nov 28 16:07:27 2015
(
CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -87,7 +87,7 @@ A B
>>invoke table(region stats (t002t1));
-- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__
--- Definition current Sat Nov 28 05:32:25 2015
+-- Definition current Sat Nov 28 16:07:28 2015
(
CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -120,7 +120,7 @@ A B
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/1b28a9e5d128ef99fb399760368ef0a2 2 0 0 0 0 ReadRequestsCount: 2 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/8bb4f679579199d03d7f610bec389948 2 0 0 0 0 ReadRequestsCount: 2 WriteRequestsCount: 1
--- 1 row(s) selected.
>>
@@ -134,7 +134,7 @@ T002SCH.T002T1 1
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/978dc9ee33815b6cfcbe6f3ea6760aeb 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/063997b7b1aa3d335501fc78296708ba 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
--- 1 row(s) selected.
>>
@@ -148,10 +148,10 @@ T002SCH.T002T1 1
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2/d18351fff7a9f9608630c8cadae4ca59 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
-T002SCH.T002T2 2 TRAFODION.T002SCH.T002T2/046b619bea33e4b9d5b4ffa2f15c3b01 2 0 0 0 0 ReadRequestsCount: 1 WriteRequestsCount: 1
-T002SCH.T002T2 3 TRAFODION.T002SCH.T002T2/e38826a2cde7005f4f67cdb2320ddb76 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
-T002SCH.T002T2 4 TRAFODION.T002SCH.T002T2/2c134f9a4f67ef528f1dbe9a4914b96c 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
+T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2/57b9567e1e3ade7a22dba5447579dd6f 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
+T002SCH.T002T2 2 TRAFODION.T002SCH.T002T2/48d51d2d9395038ad05201c03701330b 2 0 0 0 0 ReadRequestsCount: 1 WriteRequestsCount: 1
+T002SCH.T002T2 3 TRAFODION.T002SCH.T002T2/bbe7fd3cb6b812f201be57047c266ce9 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
+T002SCH.T002T2 4 TRAFODION.T002SCH.T002T2/e3fd1521aca16734c6e1afe2a493d5d7 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0
--- 4 row(s) selected.
>>
@@ -165,21 +165,23 @@ T002SCH.T002T2 4
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2I1/677788cf794f01923614f3ece5b49b3f 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2I1/47d3338bc9349068a1461da09fe0d3bd 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 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)
++> sum(store_file_size),
++> 'ReadRequestsCount: ' || cast(sum(read_requests_count) as varchar(10)),
++> 'WriteRequestsCount: ' || cast(sum(write_requests_count) as varchar(10))
+> 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)
--------------------------------------------------------- -------------------- -------------------- --------------------
+(EXPR) (EXPR) (EXPR) (EXPR)
+-------------------------------------------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T2 0 1 1
-T002SCH.T002T1 0 2 1
+T002SCH.T002T2 0 ReadRequestsCount: 1 WriteRequestsCount: 1
+T002SCH.T002T1 0 ReadRequestsCount: 2 WriteRequestsCount: 1
--- 2 row(s) selected.
>>
@@ -204,7 +206,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1/1b28a9e5d128ef99fb399760368ef0a2
+ RegionName: TRAFODION.T002SCH.T002T1/8bb4f679579199d03d7f610bec389948
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -236,7 +238,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I1/978dc9ee33815b6cfcbe6f3ea6760aeb
+ RegionName: TRAFODION.T002SCH.T002T1I1/063997b7b1aa3d335501fc78296708ba
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -268,7 +270,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2/d18351fff7a9f9608630c8cadae4ca59
+ RegionName: TRAFODION.T002SCH.T002T2/57b9567e1e3ade7a22dba5447579dd6f
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -278,7 +280,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 2
- RegionName: TRAFODION.T002SCH.T002T2/046b619bea33e4b9d5b4ffa2f15c3b01
+ RegionName: TRAFODION.T002SCH.T002T2/48d51d2d9395038ad05201c03701330b
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -288,7 +290,7 @@ Stats Details
WriteRequestsCount: 1
RegionNum: 3
- RegionName: TRAFODION.T002SCH.T002T2/e38826a2cde7005f4f67cdb2320ddb76
+ RegionName: TRAFODION.T002SCH.T002T2/bbe7fd3cb6b812f201be57047c266ce9
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -298,7 +300,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 4
- RegionName: TRAFODION.T002SCH.T002T2/2c134f9a4f67ef528f1dbe9a4914b96c
+ RegionName: TRAFODION.T002SCH.T002T2/e3fd1521aca16734c6e1afe2a493d5d7
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -330,7 +332,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2I1/677788cf794f01923614f3ece5b49b3f
+ RegionName: TRAFODION.T002SCH.T002T2I1/47d3338bc9349068a1461da09fe0d3bd
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -365,7 +367,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1/1b28a9e5d128ef99fb399760368ef0a2
+ RegionName: TRAFODION.T002SCH.T002T1/8bb4f679579199d03d7f610bec389948
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -393,7 +395,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T2/d18351fff7a9f9608630c8cadae4ca59
+ RegionName: TRAFODION.T002SCH.T002T2/57b9567e1e3ade7a22dba5447579dd6f
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -403,7 +405,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 2
- RegionName: TRAFODION.T002SCH.T002T2/046b619bea33e4b9d5b4ffa2f15c3b01
+ RegionName: TRAFODION.T002SCH.T002T2/48d51d2d9395038ad05201c03701330b
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -413,7 +415,7 @@ Stats Details
WriteRequestsCount: 1
RegionNum: 3
- RegionName: TRAFODION.T002SCH.T002T2/e38826a2cde7005f4f67cdb2320ddb76
+ RegionName: TRAFODION.T002SCH.T002T2/bbe7fd3cb6b812f201be57047c266ce9
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -423,7 +425,7 @@ Stats Details
WriteRequestsCount: 0
RegionNum: 4
- RegionName: TRAFODION.T002SCH.T002T2/2c134f9a4f67ef528f1dbe9a4914b96c
+ RegionName: TRAFODION.T002SCH.T002T2/e3fd1521aca16734c6e1afe2a493d5d7
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -447,8 +449,8 @@ Stats Details
(EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR)
-------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------
-T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/978dc9ee33815b6cfcbe6f3ea6760aeb 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
-T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I2/f3031fdb15e35a869d6c8f8232e749b4 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/063997b7b1aa3d335501fc78296708ba 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
+T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I2/e1d921638743bb5988eb7e011dbdd3f3 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1
--- 2 row(s) selected.
>>get region stats for
@@ -474,7 +476,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I1/978dc9ee33815b6cfcbe6f3ea6760aeb
+ RegionName: TRAFODION.T002SCH.T002T1I1/063997b7b1aa3d335501fc78296708ba
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
@@ -502,7 +504,7 @@ Stats Details
=============
RegionNum: 1
- RegionName: TRAFODION.T002SCH.T002T1I2/f3031fdb15e35a869d6c8f8232e749b4
+ RegionName: TRAFODION.T002SCH.T002T1I2/e1d921638743bb5988eb7e011dbdd3f3
NumStores: 2
NumStoreFiles: 0
UncompressedSize: 0 (less than 1MB)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b4b9203b/core/sql/regress/seabase/FILTER002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/FILTER002 b/core/sql/regress/seabase/FILTER002
index d232963..56e5269 100755
--- a/core/sql/regress/seabase/FILTER002
+++ b/core/sql/regress/seabase/FILTER002
@@ -26,6 +26,6 @@
fil=$1
sed "
s/TRAFODION\.T002SCH\.T002[A-Z0-9]*\/[A-Za-z0-9]*/REGION_NAME /g
-s/ReadRequestsCount: [0-9 ]*/READ_REQUESTS_COUNT /g
-s/WriteRequestsCount: [0-9 ]*/WRITE_REQUESTS_COUNT /g
+s/ReadRequestsCount: [ ]*[0-9]*/READ_REQUESTS_COUNT /g
+s/WriteRequestsCount: [ ]*[0-9]*/WRITE_REQUESTS_COUNT /g
" $fil
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b4b9203b/core/sql/regress/seabase/TEST002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST002 b/core/sql/regress/seabase/TEST002
index 900b2d2..60c159e 100644
--- a/core/sql/regress/seabase/TEST002
+++ b/core/sql/regress/seabase/TEST002
@@ -88,7 +88,9 @@ select left(trim(schema_name) || '.' || trim(object_name), 14),
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)
+ sum(store_file_size),
+ 'ReadRequestsCount: ' || cast(sum(read_requests_count) as varchar(10)),
+ 'WriteRequestsCount: ' || cast(sum(write_requests_count) as varchar(10))
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;
[8/9] incubator-trafodion git commit: changed swhbase to regrhbase.ksh
Posted by sa...@apache.org.
changed swhbase to regrhbase.ksh
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/00b28324
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/00b28324
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/00b28324
Branch: refs/heads/master
Commit: 00b28324e67905ec8c7b3373c932f68499772776
Parents: c73e065
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Thu Dec 3 01:08:02 2015 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Thu Dec 3 01:08:02 2015 +0000
----------------------------------------------------------------------
core/sql/regress/seabase/EXPECTED002 | 10 +++++-----
core/sql/regress/seabase/TEST002 | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/00b28324/core/sql/regress/seabase/EXPECTED002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED002 b/core/sql/regress/seabase/EXPECTED002
index 22131c5..f77a008 100644
--- a/core/sql/regress/seabase/EXPECTED002
+++ b/core/sql/regress/seabase/EXPECTED002
@@ -19,9 +19,9 @@
--- 1 row(s) inserted.
>>
->>sh swhbase flush 'TRAFODION.T002SCH.T002T1';
->>sh swhbase flush 'TRAFODION.T002SCH.T002T1I1';
->>sh swhbase flush 'TRAFODION.T002SCH.T002T1I2';
+>>sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T1';
+>>sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T1I1';
+>>sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T1I2';
>>
>>select * from t002t1;
@@ -43,8 +43,8 @@ A B C
--- 1 row(s) inserted.
>>
->>sh swhbase flush 'TRAFODION.T002SCH.T002T2';
->>sh swhbase flush 'TRAFODION.T002SCH.T002T2I1';
+>>sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T2';
+>>sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T2I1';
>>
>>select * from t002t2;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/00b28324/core/sql/regress/seabase/TEST002
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST002 b/core/sql/regress/seabase/TEST002
index 7a97e49..5d9fd9d 100644
--- a/core/sql/regress/seabase/TEST002
+++ b/core/sql/regress/seabase/TEST002
@@ -38,9 +38,9 @@ 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';
+sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T1';
+sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T1I1';
+sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T1I2';
select * from t002t1;
@@ -49,8 +49,8 @@ create table t002t2(a int not null primary key, b int not null)
create index t002t2i1 on t002t2(b);
insert into t002t2 values (1,2);
-sh swhbase flush 'TRAFODION.T002SCH.T002T2';
-sh swhbase flush 'TRAFODION.T002SCH.T002T2I1';
+sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T2';
+sh regrhbase.ksh flush 'TRAFODION.T002SCH.T002T2I1';
select * from t002t2;
[4/9] incubator-trafodion git commit: Merge remote branch
'origin/master' into br_regstats
Posted by sa...@apache.org.
Merge remote branch 'origin/master' into br_regstats
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/9e0a88b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/9e0a88b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/9e0a88b8
Branch: refs/heads/master
Commit: 9e0a88b8efafa9eb67f9a32bb4e88912ad0fe53f
Parents: 0b86934 80d6cff
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Thu Nov 26 16:17:41 2015 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Thu Nov 26 16:17:41 2015 +0000
----------------------------------------------------------------------
core/sqf/sql/scripts/cleanat | 39 ++++++++++++++++++++++++++++++++++++
install/installer/dcs_installer | 3 ++-
2 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[9/9] incubator-trafodion git commit: Merge remote branch
'origin/pr/194/head' into merge_trafodion194
Posted by sa...@apache.org.
Merge remote branch 'origin/pr/194/head' into merge_trafodion194
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/394d007a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/394d007a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/394d007a
Branch: refs/heads/master
Commit: 394d007a3ccd4c7defef5e5f8136f3e20c7b84c8
Parents: ebe876d 00b2832
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Thu Dec 3 19:51:01 2015 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Thu Dec 3 19:51:01 2015 +0000
----------------------------------------------------------------------
core/sqf/tools/sqtools.sh | 4 +-
core/sql/comexe/ComTdb.h | 2 +-
core/sql/comexe/ComTdbExeUtil.cpp | 27 +
core/sql/comexe/ComTdbExeUtil.h | 119 +++
core/sql/executor/ExComTdb.cpp | 7 +
core/sql/executor/ExExeUtil.h | 167 ++++
core/sql/executor/ExExeUtilCommon.cpp | 7 +-
core/sql/executor/ExExeUtilGet.cpp | 824 ++++++++++++++++++-
core/sql/executor/HBaseClient_JNI.cpp | 58 ++
core/sql/executor/HBaseClient_JNI.h | 2 +
core/sql/exp/ExpHbaseInterface.cpp | 16 +
core/sql/exp/ExpHbaseInterface.h | 3 +
core/sql/generator/GenRelExeUtil.cpp | 119 +++
core/sql/optimizer/BindRelExpr.cpp | 5 +
core/sql/optimizer/RelExeUtil.cpp | 128 ++-
core/sql/optimizer/RelExeUtil.h | 60 ++
core/sql/parser/ParKeyWords.cpp | 4 +-
core/sql/parser/sqlparser.y | 112 ++-
core/sql/regress/seabase/EXPECTED002 | 677 +++++++++++++++
core/sql/regress/seabase/FILTER002 | 31 +
core/sql/regress/seabase/TEST002 | 144 ++++
core/sql/sqlcomp/CmpDescribe.cpp | 19 +-
.../java/org/trafodion/sql/HBaseClient.java | 57 +-
.../java/org/trafodion/sql/TrafRegionStats.java | 144 ++++
24 files changed, 2699 insertions(+), 37 deletions(-)
----------------------------------------------------------------------