You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2017/05/10 22:49:42 UTC
[4/7] incubator-trafodion git commit: [TRAFODION-2420] RMS
enhancements
[TRAFODION-2420] RMS enhancements
New counters introduced as part of BMO
InterimRowCount - Counter to keep track intermediate rows
produced by hash join and for intermediate
runs in sort
phase - BMO Phase for hash-join and sort
get statistics for statement s1, options 'cs' now works.
Removed attaching BMO stats to Non-root Paritial and leaf partition hash group by operators.
These operators are non-blocking BMOs.
Introduced 3 phases for hash grby operator to be visible in RMS Stats
options 'sl' now works with get statistics for qid.
The relevant new counters are now part of accumulated statistics type.
Extended the support upto 512 opeartors from 256 operators in RMS
Fixed both Type 2 and mxosrvr code to obtain all the externalized counters in accumualted stats correctly.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/e7719015
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/e7719015
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/e7719015
Branch: refs/heads/master
Commit: e7719015286a0217fa5ec81551a783f8bc18fc3b
Parents: f60c1b0
Author: selvaganesang <se...@esgyn.com>
Authored: Mon May 1 23:11:47 2017 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Tue May 9 04:01:43 2017 +0000
----------------------------------------------------------------------
.../native/ResStatisticsStatement.cpp | 72 +-
.../jdbc_type2/native/ResStatisticsStatement.h | 9 +
.../odbc/nsksrvrcore/ResStatisticsStatement.cpp | 88 +-
.../odbc/nsksrvrcore/ResStatisticsStatement.h | 7 +
core/sql/cli/sqlcli.h | 2 +
core/sql/comexe/ComTdbHashGrby.h | 2 +
core/sql/executor/ExExeUtil.h | 8 +-
core/sql/executor/ExExeUtilGetStats.cpp | 444 ++--
core/sql/executor/ExStats.cpp | 302 +--
core/sql/executor/ExStats.h | 26 +-
core/sql/executor/ex_hash_grby.cpp | 21 +-
core/sql/executor/ex_hash_grby.h | 11 +
core/sql/executor/ex_hashj.cpp | 26 +-
core/sql/executor/ex_hashj.h | 18 +-
core/sql/executor/ex_sort.cpp | 17 +-
core/sql/executor/ex_sort.h | 12 +-
core/sql/parser/sqlparser.y | 2 +-
core/sql/regress/core/EXPECTEDRTS | 1903 +++++++++---------
core/sql/regress/core/FILTERRTS | 18 +-
core/sql/sort/Qsort.cpp | 9 +-
core/sql/sort/Qsort.h | 3 +-
core/sql/sort/SortAlgo.cpp | 3 +-
core/sql/sort/SortAlgo.h | 3 +-
core/sql/sort/SortTopN.cpp | 9 +-
core/sql/sort/SortTopN.h | 3 +-
core/sql/sort/SortUtil.cpp | 8 +-
core/sql/sort/TourTree.cpp | 8 +-
core/sql/sort/TourTree.h | 1 +
28 files changed, 1616 insertions(+), 1419 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/conn/jdbc_type2/native/ResStatisticsStatement.cpp
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type2/native/ResStatisticsStatement.cpp b/core/conn/jdbc_type2/native/ResStatisticsStatement.cpp
index 875ef3b..b3b9f54 100644
--- a/core/conn/jdbc_type2/native/ResStatisticsStatement.cpp
+++ b/core/conn/jdbc_type2/native/ResStatisticsStatement.cpp
@@ -134,6 +134,7 @@ ResStatisticsStatement::ResStatisticsStatement(bool useCLI)
SpaceUsed = 0;
HeapTotal = 0;
HeapUsed = 0;
+ HeapWM = 0;
CpuTime = 0;
Dp2SpaceTotal = 0;
Dp2SpaceUsed = 0;
@@ -156,7 +157,12 @@ ResStatisticsStatement::ResStatisticsStatement(bool useCLI)
ScratchOverflowMode = 0;
ScratchBufferReadCount = 0;
ScratchBufferWriteCount = 0;
-
+ bmoSpaceBufferSize = 0;
+ bmoSpaceBufferCount = 0;
+ bmoInterimRowCount = 0;
+ ScratchIOSize = 0;
+ ScratchIOMaxTime = 0;
+ topN = 0;
estimatedCost = 0;
rtsExeCols = NULL;
@@ -1321,7 +1327,7 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
#define MAX_PERTABLE_STATS_DESC 30
#define MAX_MASTERSTATS_ENTRY 31
-#define MAX_MEASSTATS_ENTRY 26
+#define MAX_MEASSTATS_ENTRY 27
#define MAX_PERTABLE_ENTRY 10
int i;
@@ -1545,23 +1551,27 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
measStatsItems_[7].statsItem_id = SQLSTATS_SQL_SPACE_USED;
measStatsItems_[8].statsItem_id = SQLSTATS_SQL_HEAP_ALLOC;
measStatsItems_[9].statsItem_id = SQLSTATS_SQL_HEAP_USED;
- measStatsItems_[10].statsItem_id = SQLSTATS_OPENS;
- measStatsItems_[11].statsItem_id = SQLSTATS_OPEN_TIME;
- measStatsItems_[12].statsItem_id = SQLSTATS_PROCESS_CREATED;
- measStatsItems_[13].statsItem_id = SQLSTATS_PROCESS_CREATE_TIME;
- measStatsItems_[14].statsItem_id = SQLSTATS_REQ_MSG_CNT;
- measStatsItems_[15].statsItem_id = SQLSTATS_REQ_MSG_BYTES;
- measStatsItems_[16].statsItem_id = SQLSTATS_REPLY_MSG_CNT;
- measStatsItems_[17].statsItem_id = SQLSTATS_REPLY_MSG_BYTES;
- measStatsItems_[18].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
- measStatsItems_[19].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE;
- measStatsItems_[20].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ;
- measStatsItems_[21].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN;
- measStatsItems_[22].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
- measStatsItems_[23].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
- measStatsItems_[24].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
- measStatsItems_[25].statsItem_id = SQLSTATS_UDR_CPU_BUSY_TIME;
- // MAX_MEASSTATS_ENTRY is set to 26
+ measStatsItems_[10].statsItem_id = SQLSTATS_SQL_HEAP_WM;
+ measStatsItems_[11].statsItem_id = SQLSTATS_OPENS;
+ measStatsItems_[12].statsItem_id = SQLSTATS_OPEN_TIME;
+ measStatsItems_[13].statsItem_id = SQLSTATS_PROCESS_CREATED;
+ measStatsItems_[14].statsItem_id = SQLSTATS_PROCESS_CREATE_TIME;
+ measStatsItems_[15].statsItem_id = SQLSTATS_REQ_MSG_CNT;
+ measStatsItems_[16].statsItem_id = SQLSTATS_REQ_MSG_BYTES;
+ measStatsItems_[17].statsItem_id = SQLSTATS_REPLY_MSG_CNT;
+ measStatsItems_[18].statsItem_id = SQLSTATS_REPLY_MSG_BYTES;
+ measStatsItems_[19].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
+ measStatsItems_[20].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
+ measStatsItems_[21].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_SIZE;
+ measStatsItems_[22].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_COUNT;
+ measStatsItems_[23].statsItem_id = SQLSTATS_SCRATCH_IO_SIZE;
+ measStatsItems_[24].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
+ measStatsItems_[25].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
+ measStatsItems_[26].statsItem_id = SQLSTATS_SCRATCH_IO_MAX_TIME;
+ measStatsItems_[27].statsItem_id = SQLSTATS_INTERIM_ROW_COUNT;
+ measStatsItems_[28].statsItem_id = SQLSTATS_TOPN;
+ measStatsItems_[29].statsItem_id = SQLSTATS_UDR_CPU_BUSY_TIME;
+ // MAX_MEASSTATS_ENTRY is set to 30
cliRC = SQL_EXEC_GetStatisticsItems(
reqType,
@@ -1826,6 +1836,9 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
case SQLSTATS_SQL_HEAP_USED: //int64
HeapUsed = measStatsItems_[i].int64_value;
break;
+ case SQLSTATS_SQL_HEAP_WM: //int64
+ HeapWM = measStatsItems_[i].int64_value;
+ break;
case SQLSTATS_OPENS: //int64
Opens = measStatsItems_[i].int64_value;
break;
@@ -1853,14 +1866,14 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
case SQLSTATS_SCRATCH_FILE_COUNT:
ScratchFileCount = measStatsItems_[i].int64_value;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE:
- ScratchBufferBlockSize = measStatsItems_[i].int64_value;
+ case SQLSTATS_BMO_SPACE_BUFFER_SIZE:
+ bmoSpaceBufferSize = measStatsItems_[i].int64_value;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ:
- ScratchBufferBlocksRead = measStatsItems_[i].int64_value;
+ case SQLSTATS_BMO_SPACE_BUFFER_COUNT:
+ bmoSpaceBufferCount = measStatsItems_[i].int64_value;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN:
- ScratchBufferBlocksWritten = measStatsItems_[i].int64_value;
+ case SQLSTATS_SCRATCH_IO_SIZE:
+ ScratchIOSize = measStatsItems_[i].int64_value;
break;
case SQLSTATS_SCRATCH_OVERFLOW_MODE:
ScratchOverflowMode = (short)measStatsItems_[i].int64_value;
@@ -1871,6 +1884,15 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
case SQLSTATS_SCRATCH_WRITE_COUNT:
ScratchBufferWriteCount = measStatsItems_[i].int64_value;
break;
+ case SQLSTATS_SCRATCH_IO_MAX_TIME:
+ ScratchIOMaxTime = measStatsItems_[i].int64_value;
+ break;
+ case SQLSTATS_INTERIM_ROW_COUNT:
+ bmoInterimRowCount = measStatsItems_[i].int64_value;
+ break;
+ case SQLSTATS_TOPN:
+ topN = measStatsItems_[i].int64_value;
+ break;
case SQLSTATS_UDR_CPU_BUSY_TIME:
UdrCpuTime = measStatsItems_[i].int64_value;
break;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/conn/jdbc_type2/native/ResStatisticsStatement.h
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type2/native/ResStatisticsStatement.h b/core/conn/jdbc_type2/native/ResStatisticsStatement.h
index eb7bf5f..fe63a88 100644
--- a/core/conn/jdbc_type2/native/ResStatisticsStatement.h
+++ b/core/conn/jdbc_type2/native/ResStatisticsStatement.h
@@ -153,6 +153,12 @@ private:
short ScratchOverflowMode;
int64 ScratchBufferReadCount;
int64 ScratchBufferWriteCount;
+ int64 ScratchIOMaxTime;
+ int32 ScratchIOSize;
+ int32 bmoSpaceBufferSize;
+ int64 bmoSpaceBufferCount;
+ int64 bmoInterimRowCount;
+ int32 topN;
char subQryType[SUB_QRY_TYPE_LEN+1];
char parentSysName[PAR_SYS_NAME_LEN+1];
@@ -176,12 +182,15 @@ private:
Int64 SpaceUsed; //YES
Int64 HeapTotal; //YES
Int64 HeapUsed; //YES
+ Int64 HeapWM;
int64 CpuTime;
Int64 Dp2SpaceTotal; //YES
Int64 Dp2SpaceUsed; //YES
Int64 Dp2HeapTotal; //YES
Int64 Dp2HeapUsed; //YES
+
+
// Currently not in R2.5. To be enabled post R2.5/SQ
int64 UdrCpuTime; //YES
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp
index f71af4b..ebebde8 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp
@@ -119,6 +119,7 @@ ResStatisticsStatement::ResStatisticsStatement(bool useCLI)
SpaceUsed = 0;
HeapTotal = 0;
HeapUsed = 0;
+ HeapWM = 0;
CpuTime = 0;
Dp2SpaceTotal = 0;
Dp2SpaceUsed = 0;
@@ -141,7 +142,12 @@ ResStatisticsStatement::ResStatisticsStatement(bool useCLI)
ScratchOverflowMode = 0;
ScratchBufferReadCount = 0;
ScratchBufferWriteCount = 0;
-
+ bmoSpaceBufferSize = 0;
+ bmoSpaceBufferCount = 0;
+ bmoInterimRowCount = 0;
+ ScratchIOSize = 0;
+ ScratchIOMaxTime = 0;
+ topN = 0;
estimatedCost = 0;
rtsExeCols = NULL;
@@ -252,6 +258,7 @@ void ResStatisticsStatement::init()
SpaceUsed = 0;
HeapTotal = 0;
HeapUsed = 0;
+ HeapWM = 0;
CpuTime = 0;
Dp2SpaceTotal = 0;
Dp2SpaceUsed = 0;
@@ -276,6 +283,12 @@ void ResStatisticsStatement::init()
ScratchOverflowMode = 0;
ScratchBufferReadCount = 0;
ScratchBufferWriteCount = 0;
+ bmoSpaceBufferSize = 0;
+ bmoSpaceBufferCount = 0;
+ bmoInterimRowCount = 0;
+ ScratchIOSize = 0;
+ ScratchIOMaxTime = 0;
+ topN = 0;
}
//
string getSrvrSubstate(NDCS_SUBSTATE mx_substate)
@@ -1202,6 +1215,7 @@ void ResStatisticsStatement::init_rms_counters(bool resetAll)
SpaceUsed = 0;
HeapTotal = 0;
HeapUsed = 0;
+ HeapWM = 0;
CpuTime = 0;
Dp2SpaceTotal = 0;
Dp2SpaceUsed = 0;
@@ -1256,6 +1270,12 @@ void ResStatisticsStatement::init_rms_counters(bool resetAll)
ScratchOverflowMode = 0;
ScratchBufferReadCount = 0;
ScratchBufferWriteCount = 0;
+ bmoSpaceBufferSize = 0;
+ bmoSpaceBufferCount = 0;
+ bmoInterimRowCount = 0;
+ ScratchIOSize = 0;
+ ScratchIOMaxTime = 0;
+ topN = 0;
}
void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TYPE statsType, char *qID, short qIdLen ,int activeQueryNum)//20111208
@@ -1265,8 +1285,8 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
#define MAX_PERTABLE_STATS_DESC 30
#define MAX_MASTERSTATS_ENTRY 31
-#define MAX_MEASSTATS_ENTRY 26
-#define MAX_PERTABLE_ENTRY 10
+#define MAX_MEASSTATS_ENTRY 30
+#define MAX_PERTABLE_ENTRY 10
int i;
Int32 cliRC;
@@ -1489,23 +1509,27 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
measStatsItems_[7].statsItem_id = SQLSTATS_SQL_SPACE_USED;
measStatsItems_[8].statsItem_id = SQLSTATS_SQL_HEAP_ALLOC;
measStatsItems_[9].statsItem_id = SQLSTATS_SQL_HEAP_USED;
- measStatsItems_[10].statsItem_id = SQLSTATS_OPENS;
- measStatsItems_[11].statsItem_id = SQLSTATS_OPEN_TIME;
- measStatsItems_[12].statsItem_id = SQLSTATS_PROCESS_CREATED;
- measStatsItems_[13].statsItem_id = SQLSTATS_PROCESS_CREATE_TIME;
- measStatsItems_[14].statsItem_id = SQLSTATS_REQ_MSG_CNT;
- measStatsItems_[15].statsItem_id = SQLSTATS_REQ_MSG_BYTES;
- measStatsItems_[16].statsItem_id = SQLSTATS_REPLY_MSG_CNT;
- measStatsItems_[17].statsItem_id = SQLSTATS_REPLY_MSG_BYTES;
- measStatsItems_[18].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
- measStatsItems_[19].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE;
- measStatsItems_[20].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ;
- measStatsItems_[21].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN;
- measStatsItems_[22].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
- measStatsItems_[23].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
- measStatsItems_[24].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
- measStatsItems_[25].statsItem_id = SQLSTATS_UDR_CPU_BUSY_TIME;
- // MAX_MEASSTATS_ENTRY is set to 26
+ measStatsItems_[10].statsItem_id = SQLSTATS_SQL_HEAP_WM;
+ measStatsItems_[11].statsItem_id = SQLSTATS_OPENS;
+ measStatsItems_[12].statsItem_id = SQLSTATS_OPEN_TIME;
+ measStatsItems_[13].statsItem_id = SQLSTATS_PROCESS_CREATED;
+ measStatsItems_[14].statsItem_id = SQLSTATS_PROCESS_CREATE_TIME;
+ measStatsItems_[15].statsItem_id = SQLSTATS_REQ_MSG_CNT;
+ measStatsItems_[16].statsItem_id = SQLSTATS_REQ_MSG_BYTES;
+ measStatsItems_[17].statsItem_id = SQLSTATS_REPLY_MSG_CNT;
+ measStatsItems_[18].statsItem_id = SQLSTATS_REPLY_MSG_BYTES;
+ measStatsItems_[19].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
+ measStatsItems_[20].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
+ measStatsItems_[21].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_SIZE;
+ measStatsItems_[22].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_COUNT;
+ measStatsItems_[23].statsItem_id = SQLSTATS_SCRATCH_IO_SIZE;
+ measStatsItems_[24].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
+ measStatsItems_[25].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
+ measStatsItems_[26].statsItem_id = SQLSTATS_SCRATCH_IO_MAX_TIME;
+ measStatsItems_[27].statsItem_id = SQLSTATS_INTERIM_ROW_COUNT;
+ measStatsItems_[28].statsItem_id = SQLSTATS_TOPN;
+ measStatsItems_[29].statsItem_id = SQLSTATS_UDR_CPU_BUSY_TIME;
+ // MAX_MEASSTATS_ENTRY is set to 30
cliRC = SQL_EXEC_GetStatisticsItems(
reqType,
@@ -1770,6 +1794,9 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
case SQLSTATS_SQL_HEAP_USED: //int64
HeapUsed = measStatsItems_[i].int64_value;
break;
+ case SQLSTATS_SQL_HEAP_WM: //int64
+ HeapWM = measStatsItems_[i].int64_value;
+ break;
case SQLSTATS_OPENS: //int64
Opens = measStatsItems_[i].int64_value;
break;
@@ -1797,14 +1824,14 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
case SQLSTATS_SCRATCH_FILE_COUNT:
ScratchFileCount = measStatsItems_[i].int64_value;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE:
- ScratchBufferBlockSize = measStatsItems_[i].int64_value;
+ case SQLSTATS_BMO_SPACE_BUFFER_SIZE:
+ bmoSpaceBufferSize = measStatsItems_[i].int64_value;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ:
- ScratchBufferBlocksRead = measStatsItems_[i].int64_value;
+ case SQLSTATS_BMO_SPACE_BUFFER_COUNT:
+ bmoSpaceBufferCount = measStatsItems_[i].int64_value;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN:
- ScratchBufferBlocksWritten = measStatsItems_[i].int64_value;
+ case SQLSTATS_SCRATCH_IO_SIZE:
+ ScratchIOSize = measStatsItems_[i].int64_value;
break;
case SQLSTATS_SCRATCH_OVERFLOW_MODE:
ScratchOverflowMode = (short)measStatsItems_[i].int64_value;
@@ -1815,6 +1842,15 @@ void ResStatisticsStatement::setStatistics(SRVR_STMT_HDL *pSrvrStmt, SQLSTATS_TY
case SQLSTATS_SCRATCH_WRITE_COUNT:
ScratchBufferWriteCount = measStatsItems_[i].int64_value;
break;
+ case SQLSTATS_SCRATCH_IO_MAX_TIME:
+ ScratchIOMaxTime = measStatsItems_[i].int64_value;
+ break;
+ case SQLSTATS_INTERIM_ROW_COUNT:
+ bmoInterimRowCount = measStatsItems_[i].int64_value;
+ break;
+ case SQLSTATS_TOPN:
+ topN = measStatsItems_[i].int64_value;
+ break;
case SQLSTATS_UDR_CPU_BUSY_TIME:
UdrCpuTime = measStatsItems_[i].int64_value;
break;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.h
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.h b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.h
index 1f966d4..c0d00bd 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.h
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.h
@@ -145,6 +145,12 @@ private:
short ScratchOverflowMode;
int64 ScratchBufferReadCount;
int64 ScratchBufferWriteCount;
+ int32 ScratchIOSize;
+ int32 ScratchIOMaxTime;
+ int32 bmoSpaceBufferSize;
+ int64 bmoSpaceBufferCount;
+ int64 bmoInterimRowCount;
+ int32 topN;
char subQryType[SUB_QRY_TYPE_LEN+1];
char parentSysName[PAR_SYS_NAME_LEN+1];
@@ -168,6 +174,7 @@ private:
Int64 SpaceUsed; //YES
Int64 HeapTotal; //YES
Int64 HeapUsed; //YES
+ Int64 HeapWM;
int64 CpuTime;
Int64 Dp2SpaceTotal; //YES
Int64 Dp2SpaceUsed; //YES
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/sql/cli/sqlcli.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/sqlcli.h b/core/sql/cli/sqlcli.h
index dfe04a3..19d2f1b 100644
--- a/core/sql/cli/sqlcli.h
+++ b/core/sql/cli/sqlcli.h
@@ -1180,6 +1180,8 @@ enum SQLSTATS_ITEM_ID {
SQLSTATS_SCRATCH_READ_COUNT = 162,
SQLSTATS_SCRATCH_WRITE_COUNT = 163,
SQLSTATS_SCRATCH_IO_MAX_TIME = 164,
+ SQLSTATS_BMO_PHASE = 166,
+ SQLSTATS_INTERIM_ROW_COUNT = 167,
/* SQLSTATS_ITEM_ID for UDR_BASE_STATS */
SQLSTATS_UDR_CPU_BUSY_TIME = 170,
SQLSTATS_RECENT_REQ_TS = 171,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/sql/comexe/ComTdbHashGrby.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbHashGrby.h b/core/sql/comexe/ComTdbHashGrby.h
index b787c24..79fb444 100644
--- a/core/sql/comexe/ComTdbHashGrby.h
+++ b/core/sql/comexe/ComTdbHashGrby.h
@@ -361,6 +361,8 @@ NA_EIDPROC
UInt16 getBMOMaxMemThresholdMB()
{ return bmoMaxMemThresholdMB_; }
+ NABoolean isNonBMOPartialGroupBy() { return (isPartialGroup_ == TRUE); }
+
};
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/sql/executor/ExExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtil.h b/core/sql/executor/ExExeUtil.h
index b67e956..6a86996 100755
--- a/core/sql/executor/ExExeUtil.h
+++ b/core/sql/executor/ExExeUtil.h
@@ -69,10 +69,10 @@ class ExpHbaseInterface;
#define TO_FMT3u(u) MINOF(((u)+500)/1000, 999)
#define MAX_ACCUMULATED_STATS_DESC 2
-#define MAX_PERTABLE_STATS_DESC 30
-#define MAX_PROGRESS_STATS_DESC 50
-#define MAX_OPERATOR_STATS_DESC 256
-#define MAX_RMS_STATS_DESC 256
+#define MAX_PERTABLE_STATS_DESC 256
+#define MAX_PROGRESS_STATS_DESC 256
+#define MAX_OPERATOR_STATS_DESC 512
+#define MAX_RMS_STATS_DESC 512
#define BUFFER_SIZE 4000
#define MAX_AUTHIDTYPE_CHAR 11
#define MAX_USERINFO_CHAR 257
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/sql/executor/ExExeUtilGetStats.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilGetStats.cpp b/core/sql/executor/ExExeUtilGetStats.cpp
index 6188ccd..09057df 100644
--- a/core/sql/executor/ExExeUtilGetStats.cpp
+++ b/core/sql/executor/ExExeUtilGetStats.cpp
@@ -64,7 +64,13 @@ ex_tcb * ExExeUtilGetStatisticsTdb::build(ex_globals * glob)
if (getStmtName() == NULL)
exe_util_tcb = new(glob->getSpace()) ExExeUtilGetStatisticsTcb(*this, glob);
else
- exe_util_tcb = new(glob->getSpace()) ExExeUtilGetRTSStatisticsTcb(*this, glob);
+ {
+ if (compilerStats() || executorStats() || otherStats() || detailedStats() ||
+ oldFormat() || shortFormat() || tokenizedFormat())
+ exe_util_tcb = new(glob->getSpace()) ExExeUtilGetStatisticsTcb(*this, glob);
+ else
+ exe_util_tcb = new(glob->getSpace()) ExExeUtilGetRTSStatisticsTcb(*this, glob);
+ }
break;
case SQLCLI_STATS_REQ_QID:
case SQLCLI_STATS_REQ_QID_INTERNAL:
@@ -2317,7 +2323,7 @@ short ExExeUtilGetRTSStatisticsTcb::work()
{
if (measStatsItems_ == NULL)
{
- maxMeasStatsItems_ = 28;
+ maxMeasStatsItems_ = 30;
measStatsItems_ = new (getGlobals()->getDefaultHeap())
SQLSTATS_ITEM[maxMeasStatsItems_];
initSqlStatsItems(measStatsItems_, maxMeasStatsItems_, FALSE);
@@ -2341,15 +2347,17 @@ short ExExeUtilGetRTSStatisticsTcb::work()
measStatsItems_[17].statsItem_id = SQLSTATS_REQ_MSG_BYTES;
measStatsItems_[18].statsItem_id = SQLSTATS_REPLY_MSG_CNT;
measStatsItems_[19].statsItem_id = SQLSTATS_REPLY_MSG_BYTES;
- measStatsItems_[20].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
- measStatsItems_[21].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
- measStatsItems_[22].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE;
- measStatsItems_[23].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ;
- measStatsItems_[24].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN;
- measStatsItems_[25].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
- measStatsItems_[26].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
- measStatsItems_[27].statsItem_id = SQLSTATS_TOPN;
- // maxMeasStatsItems_ is set to 28
+ measStatsItems_[20].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_SIZE;
+ measStatsItems_[21].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_COUNT;
+ measStatsItems_[22].statsItem_id = SQLSTATS_INTERIM_ROW_COUNT;
+ measStatsItems_[23].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
+ measStatsItems_[24].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
+ measStatsItems_[25].statsItem_id = SQLSTATS_SCRATCH_IO_SIZE;
+ measStatsItems_[26].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
+ measStatsItems_[27].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
+ measStatsItems_[28].statsItem_id = SQLSTATS_SCRATCH_IO_MAX_TIME;
+ measStatsItems_[29].statsItem_id = SQLSTATS_TOPN;
+ // maxMeasStatsItems_ is set to 30
}
else
initSqlStatsItems(measStatsItems_, maxMeasStatsItems_, TRUE);
@@ -2511,23 +2519,17 @@ short ExExeUtilGetRTSStatisticsTcb::work()
AddCommas(Int64Val,intSize);
str_sprintf(statsBuf_, "%25s%s", "Scr. File Count", Int64Val);
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE:
- str_sprintf(Int64Val, "%Ld", measStatsItems_[i].int64_value);
- intSize = str_len(Int64Val);
- AddCommas(Int64Val,intSize);
- str_sprintf(statsBuf_, "%25s%s", "Scr. Buffer Blk Size", Int64Val);
- break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ:
+ case SQLSTATS_BMO_SPACE_BUFFER_SIZE:
str_sprintf(Int64Val, "%Ld", measStatsItems_[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(statsBuf_, "%25s%s", "Scr. Buffer Blks Read", Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "BMO Space Buffer Size", Int64Val);
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN:
+ case SQLSTATS_BMO_SPACE_BUFFER_COUNT:
str_sprintf(Int64Val, "%Ld", measStatsItems_[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(statsBuf_, "%25s%s", "Scr. Buffer Blks Written", Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "BMO Space Buffer Count", Int64Val);
break;
case SQLSTATS_SCRATCH_READ_COUNT:
str_sprintf(Int64Val, "%Ld", measStatsItems_[i].int64_value);
@@ -2541,6 +2543,24 @@ short ExExeUtilGetRTSStatisticsTcb::work()
AddCommas(Int64Val,intSize);
str_sprintf(statsBuf_, "%25s%s", "Scr. Write Count", Int64Val);
break;
+ case SQLSTATS_SCRATCH_IO_SIZE:
+ str_sprintf(Int64Val, "%Ld", measStatsItems_[i].int64_value);
+ intSize = str_len(Int64Val);
+ AddCommas(Int64Val,intSize);
+ str_sprintf(statsBuf_, "%25s%s", "Scr. IO Size", Int64Val);
+ break;
+ case SQLSTATS_SCRATCH_IO_MAX_TIME:
+ str_sprintf(Int64Val, "%Ld", measStatsItems_[i].int64_value);
+ intSize = str_len(Int64Val);
+ AddCommas(Int64Val,intSize);
+ str_sprintf(statsBuf_, "%25s%s", "Scr. IO Max Time", Int64Val);
+ break;
+ case SQLSTATS_INTERIM_ROW_COUNT:
+ str_sprintf(Int64Val, "%Ld", measStatsItems_[i].int64_value);
+ intSize = str_len(Int64Val);
+ AddCommas(Int64Val,intSize);
+ str_sprintf(statsBuf_, "%25s%s", "BMO Interim Row Count", Int64Val);
+ break;
default:
statsBuf_[0] = '\0';
break;
@@ -2555,7 +2575,7 @@ short ExExeUtilGetRTSStatisticsTcb::work()
{
if (rootOperStatsItems_ == NULL)
{
- maxRootOperStatsItems_ = 25;
+ maxRootOperStatsItems_ = 27;
rootOperStatsItems_ = new (getGlobals()->getDefaultHeap())
SQLSTATS_ITEM[maxRootOperStatsItems_];
initSqlStatsItems(rootOperStatsItems_, maxRootOperStatsItems_, FALSE);
@@ -2576,15 +2596,17 @@ short ExExeUtilGetRTSStatisticsTcb::work()
rootOperStatsItems_[14].statsItem_id = SQLSTATS_REQ_MSG_BYTES;
rootOperStatsItems_[15].statsItem_id = SQLSTATS_REPLY_MSG_CNT;
rootOperStatsItems_[16].statsItem_id = SQLSTATS_REPLY_MSG_BYTES;
- rootOperStatsItems_[17].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
- rootOperStatsItems_[18].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
- rootOperStatsItems_[19].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE;
- rootOperStatsItems_[20].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ;
- rootOperStatsItems_[21].statsItem_id = SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN;
- rootOperStatsItems_[22].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
- rootOperStatsItems_[23].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
- rootOperStatsItems_[24].statsItem_id = SQLSTATS_TOPN;
- // maxRootOperStatsItems_ is set to 25
+ rootOperStatsItems_[17].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_SIZE;
+ rootOperStatsItems_[18].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_COUNT;
+ rootOperStatsItems_[19].statsItem_id = SQLSTATS_INTERIM_ROW_COUNT;
+ rootOperStatsItems_[20].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
+ rootOperStatsItems_[21].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
+ rootOperStatsItems_[22].statsItem_id = SQLSTATS_SCRATCH_IO_SIZE;
+ rootOperStatsItems_[23].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
+ rootOperStatsItems_[24].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
+ rootOperStatsItems_[25].statsItem_id = SQLSTATS_SCRATCH_IO_MAX_TIME;
+ rootOperStatsItems_[26].statsItem_id = SQLSTATS_TOPN;
+ // maxRootOperStatsItems_ is set to 27
}
else
initSqlStatsItems(rootOperStatsItems_, maxRootOperStatsItems_, TRUE);
@@ -2705,47 +2727,47 @@ short ExExeUtilGetRTSStatisticsTcb::work()
else
continue;
break;
- case SQLSTATS_TOPN:
+ case SQLSTATS_BMO_SPACE_BUFFER_SIZE:
if (statsMergeType != SQLCLI_PROGRESS_STATS)
{
formatWInt64( rootOperStatsItems_[i], Int64Val);
- str_sprintf(statsBuf_, "%25s%s", "Sort TopN", Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "BMO Space Buffer Size", Int64Val);
}
else
continue;
break;
- case SQLSTATS_SCRATCH_FILE_COUNT:
+ case SQLSTATS_BMO_SPACE_BUFFER_COUNT:
if (statsMergeType != SQLCLI_PROGRESS_STATS)
{
formatWInt64( rootOperStatsItems_[i], Int64Val);
- str_sprintf(statsBuf_, "%25s%s", "Scr. File Count", Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "BMO Space Buffer Count", Int64Val);
}
else
continue;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE:
+ case SQLSTATS_TOPN:
if (statsMergeType != SQLCLI_PROGRESS_STATS)
{
formatWInt64( rootOperStatsItems_[i], Int64Val);
- str_sprintf(statsBuf_, "%25s%s", "Scr. Buffer Blk Size", Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "Sort TopN", Int64Val);
}
else
continue;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ:
+ case SQLSTATS_SCRATCH_FILE_COUNT:
if (statsMergeType != SQLCLI_PROGRESS_STATS)
{
formatWInt64( rootOperStatsItems_[i], Int64Val);
- str_sprintf(statsBuf_, "%25s%s", "Scr. Buffer Blks Read", Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "Scr. File Count", Int64Val);
}
else
continue;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN:
+ case SQLSTATS_SCRATCH_IO_SIZE:
if (statsMergeType != SQLCLI_PROGRESS_STATS)
{
formatWInt64( rootOperStatsItems_[i], Int64Val);
- str_sprintf(statsBuf_, "%25s%s", "Scr. Buffer Blks Written", Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "Scr. IO Size", Int64Val);
}
else
continue;
@@ -2768,6 +2790,24 @@ short ExExeUtilGetRTSStatisticsTcb::work()
else
continue;
break;
+ case SQLSTATS_SCRATCH_IO_MAX_TIME:
+ if (statsMergeType != SQLCLI_PROGRESS_STATS)
+ {
+ formatWInt64( rootOperStatsItems_[i], Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "Scr. IO Max Time", Int64Val);
+ }
+ else
+ continue;
+ break;
+ case SQLSTATS_INTERIM_ROW_COUNT:
+ if (statsMergeType != SQLCLI_PROGRESS_STATS)
+ {
+ formatWInt64( rootOperStatsItems_[i], Int64Val);
+ str_sprintf(statsBuf_, "%25s%s", "BMO Interim Row Count", Int64Val);
+ }
+ else
+ continue;
+ break;
default:
statsBuf_[0] = '\0';
break;
@@ -2790,8 +2830,8 @@ short ExExeUtilGetRTSStatisticsTcb::work()
hbaseStatsItems_[1].statsItem_id = SQLSTATS_DOP;
hbaseStatsItems_[2].statsItem_id = SQLSTATS_TABLE_ANSI_NAME;
hbaseStatsItems_[3].statsItem_id = SQLSTATS_EST_ROWS_ACCESSED;
- hbaseStatsItems_[4].statsItem_id = SQLSTATS_EST_ROWS_USED;
- hbaseStatsItems_[5].statsItem_id = SQLSTATS_ACT_ROWS_ACCESSED;
+ hbaseStatsItems_[4].statsItem_id = SQLSTATS_ACT_ROWS_ACCESSED;
+ hbaseStatsItems_[5].statsItem_id = SQLSTATS_EST_ROWS_USED;
hbaseStatsItems_[6].statsItem_id = SQLSTATS_ACT_ROWS_USED;
hbaseStatsItems_[7].statsItem_id = SQLSTATS_HBASE_IOS;
hbaseStatsItems_[8].statsItem_id = SQLSTATS_HBASE_IO_BYTES;
@@ -2824,122 +2864,126 @@ short ExExeUtilGetRTSStatisticsTcb::work()
}
break;
case DISPLAY_HBASE_STATS_HEADING_:
+ case DISPLAY_HIVE_STATS_HEADING_:
{
if ((qparent_.up->getSize() - qparent_.up->getLength()) < 5)
return WORK_CALL_AGAIN;
moveRowToUpQueue(" ");
if (singleLineFormat_) {
- str_sprintf(statsBuf_, "%-9s%-10s%-19s%-19s%-19s%-19s%-13s%-13s%-19s%-19s%-10s",
- "ID", "DOP",
- "EstRowsAccessed", "EstRecordsUsed", "ActRowsAccessed", "ActRowsUsed", "SE_IOs",
+ str_sprintf(statsBuf_, "%-5s%-10s%-15s%-20s%-15s%-20s%-20s%-20s%-20s%-20s%-10s",
+ "Id", "DOP",
+ "EstRowsAccess", "ActRowsAccess", "EstRowUsed", "ActRowsUsed", "SE_IOs",
"SE_IO_Bytes", "SE_IO_SumTime", "SE_IO_MaxTime", "TableName");
moveRowToUpQueue(statsBuf_);
}
else {
- str_sprintf(statsBuf_, "%-9s%-10s%-19s",
- "ID", "DOP","Table Name");
+ str_sprintf(statsBuf_, "%-5s%-10s%-20s",
+ "Id", "DOP","Table Name");
moveRowToUpQueue(statsBuf_);
- str_sprintf(statsBuf_, "%-19s%-19s%-13s%-13s%-19s%-19s",
- "Records Accessed", "Records Used", "HBase/Hive", "HBase/Hive",
- "HBase/Hive IO", "HBase/Hive IO");
- moveRowToUpQueue(statsBuf_);
- str_sprintf(statsBuf_, "%-19s%-19s%-13s%-13s%-19s%-19s",
- "Estimated/Actual", "Estimated/Actual", "IOs", "IO MBytes",
- "Sum Time", "Max Time");
+ str_sprintf(statsBuf_, "%-15s%-20s%-15s%-20s%-20s%-20s%-20s%-20s",
+ "EstRowsAccess", "ActRowsAccess", "EstRowsUsed", "ActRowsUsed", "SE_IOs", "SE_IO_Bytes", "SE_IO_SumTime", "SE_IO_MaxTime");
moveRowToUpQueue(statsBuf_);
}
isHeadingDisplayed_ = TRUE;
- step_ = FORMAT_AND_RETURN_HBASE_STATS_;
+ if (step_ == DISPLAY_HBASE_STATS_HEADING_)
+ step_ = FORMAT_AND_RETURN_HBASE_STATS_;
+ else
+ step_ = FORMAT_AND_RETURN_HIVE_STATS_;
}
break;
case FORMAT_AND_RETURN_HBASE_STATS_:
+ case FORMAT_AND_RETURN_HIVE_STATS_:
{
short tableNameIndex = 2;
- for (; currStatsItemEntry_ < maxHbaseStatsItems_; currStatsItemEntry_++)
+ SQLSTATS_ITEM *statsItems;
+ Lng32 maxStatsItems;
+
+ if (step_ == FORMAT_AND_RETURN_HBASE_STATS_) {
+ statsItems = hbaseStatsItems_;
+ maxStatsItems = maxHbaseStatsItems_;
+ }
+ else {
+ statsItems = hiveStatsItems_;
+ maxStatsItems = maxHiveStatsItems_;
+ }
+ for (; currStatsItemEntry_ < maxStatsItems; currStatsItemEntry_++)
{
i = (short)currStatsItemEntry_;
- if (hbaseStatsItems_[i].error_code != 0)
+ if (statsItems[i].error_code != 0)
continue;
- switch (hbaseStatsItems_[i].statsItem_id)
+ switch (statsItems[i].statsItem_id)
{
case SQLSTATS_TDB_ID:
- str_sprintf(statsBuf_, "%-9Ld", hbaseStatsItems_[i].int64_value);
+ str_sprintf(statsBuf_, "%-5Ld", statsItems[i].int64_value);
break;
case SQLSTATS_DOP:
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-10Ld", hbaseStatsItems_[i].int64_value);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-10Ld", statsItems[i].int64_value);
break;
case SQLSTATS_TABLE_ANSI_NAME:
- hbaseStatsItems_[i].str_value[hbaseStatsItems_[i].str_ret_len] = '\0';
+ statsItems[i].str_value[statsItems[i].str_ret_len] = '\0';
if (singleLineFormat_)
tableNameIndex = i;
else {
- str_sprintf(&statsBuf_[strlen(statsBuf_)], " %s", hbaseStatsItems_[i].str_value);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], " %s", statsItems[i].str_value);
if (moveRowToUpQueue(statsBuf_, strlen(statsBuf_), &rc) == -1)
return rc;
}
break;
case SQLSTATS_EST_ROWS_ACCESSED:
- FormatFloat(formattedFloatVal, intSize, valSize, hbaseStatsItems_[i].double_value,
+ FormatFloat(formattedFloatVal, intSize, valSize, statsItems[i].double_value,
FALSE, TRUE);
if (singleLineFormat_)
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", formattedFloatVal);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-15s", formattedFloatVal);
else
- str_sprintf(statsBuf_, "%-19s", formattedFloatVal);
+ str_sprintf(statsBuf_, "%-15s", formattedFloatVal);
break;
case SQLSTATS_EST_ROWS_USED:
- FormatFloat(formattedFloatVal, intSize, valSize, hbaseStatsItems_[i].double_value,
+ FormatFloat(formattedFloatVal, intSize, valSize, statsItems[i].double_value,
FALSE, TRUE);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", formattedFloatVal);
- if (! singleLineFormat_) {
- if (moveRowToUpQueue(statsBuf_, strlen(statsBuf_), &rc) == -1)
- return rc;
- }
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-15s", formattedFloatVal);
break;
case SQLSTATS_ACT_ROWS_ACCESSED:
- str_sprintf(Int64Val, "%Ld", hbaseStatsItems_[i].int64_value);
+ str_sprintf(Int64Val, "%Ld", statsItems[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- if (singleLineFormat_)
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
- else
- str_sprintf(statsBuf_, "%-19s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_ACT_ROWS_USED:
- str_sprintf(Int64Val, "%Ld", hbaseStatsItems_[i].int64_value);
+ str_sprintf(Int64Val, "%Ld", statsItems[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_HBASE_IOS:
- str_sprintf(Int64Val, "%Ld", hbaseStatsItems_[i].int64_value);
+ str_sprintf(Int64Val, "%Ld", statsItems[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-13s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_HBASE_IO_BYTES:
- str_sprintf(Int64Val, "%Ld", hbaseStatsItems_[i].int64_value/1024/1024);
+ str_sprintf(Int64Val, "%Ld", statsItems[i].int64_value/1024/1024);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-13s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_HBASE_IO_ELAPSED_TIME:
- str_sprintf(Int64Val, "%Ld", hbaseStatsItems_[i].int64_value);
+ str_sprintf(Int64Val, "%Ld", statsItems[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_HBASE_IO_MAX_TIME:
- str_sprintf(Int64Val, "%Ld", hbaseStatsItems_[i].int64_value);
+ str_sprintf(Int64Val, "%Ld", statsItems[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
default:
break;
}
}
if (singleLineFormat_)
- str_sprintf(&statsBuf_[strlen(statsBuf_)], " %s", hbaseStatsItems_[2].str_value);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], " %s", statsItems[2].str_value);
if (moveRowToUpQueue(statsBuf_, strlen(statsBuf_), &rc) == -1)
return rc;
step_ = GET_NEXT_STATS_DESC_ENTRY_;
@@ -2957,8 +3001,8 @@ short ExExeUtilGetRTSStatisticsTcb::work()
hiveStatsItems_[1].statsItem_id = SQLSTATS_DOP;
hiveStatsItems_[2].statsItem_id = SQLSTATS_TABLE_ANSI_NAME;
hiveStatsItems_[3].statsItem_id = SQLSTATS_EST_ROWS_ACCESSED;
- hiveStatsItems_[4].statsItem_id = SQLSTATS_EST_ROWS_USED;
- hiveStatsItems_[5].statsItem_id = SQLSTATS_ACT_ROWS_ACCESSED;
+ hiveStatsItems_[4].statsItem_id = SQLSTATS_ACT_ROWS_ACCESSED;
+ hiveStatsItems_[5].statsItem_id = SQLSTATS_EST_ROWS_USED;
hiveStatsItems_[6].statsItem_id = SQLSTATS_ACT_ROWS_USED;
hiveStatsItems_[7].statsItem_id = SQLSTATS_HIVE_IOS;
hiveStatsItems_[8].statsItem_id = SQLSTATS_HIVE_IO_BYTES;
@@ -2990,132 +3034,11 @@ short ExExeUtilGetRTSStatisticsTcb::work()
}
}
break;
- case DISPLAY_HIVE_STATS_HEADING_:
- {
- if ((qparent_.up->getSize() - qparent_.up->getLength()) < 5)
- return WORK_CALL_AGAIN;
- moveRowToUpQueue(" ");
- if (singleLineFormat_) {
- str_sprintf(statsBuf_, "%-9s%-10s%-19s%-19s%-19s%-19s%-13s%-13s%-19s%-19s%-10s",
- "ID", "DOP",
- "EstRowsAccessed", "EstRecordsUsed", "ActRowsAccessed", "ActRowsUsed", "SE_IOs",
- "SE_IO_Bytes", "SE_IO_SumTime", "SE_IO_MaxTime", "TableName");
- moveRowToUpQueue(statsBuf_);
- }
- else {
- str_sprintf(statsBuf_, "%-9s%-10s%-19s", "ID", "DOP","Table Name");
- moveRowToUpQueue(statsBuf_);
- str_sprintf(statsBuf_, "%-19s%-19s%-13s%-13s%-19s%-19s",
- "Records Accessed", "Records Used", "HBase/Hive", "HBase/Hive",
- "HBase/Hive IO", "HBase/Hive IO");
- moveRowToUpQueue(statsBuf_);
- str_sprintf(statsBuf_, "%-19s%-19s%-13s%-13s%-19s%-19s",
- "Estimated/Actual", "Estimated/Actual", "IOs", "IO MBytes",
- "Sum Time", "Max Time");
- moveRowToUpQueue(statsBuf_);
- }
- isHeadingDisplayed_ = TRUE;
- step_ = FORMAT_AND_RETURN_HIVE_STATS_;
- }
- break;
- case FORMAT_AND_RETURN_HIVE_STATS_:
- {
- short tableNameIndex = 2;
- for (; currStatsItemEntry_ < maxHiveStatsItems_; currStatsItemEntry_++)
- {
- i = (short)currStatsItemEntry_;
- if (hiveStatsItems_[i].error_code != 0)
- continue;
- switch (hiveStatsItems_[i].statsItem_id)
- {
- case SQLSTATS_TDB_ID:
- str_sprintf(statsBuf_, "%-9Ld", hiveStatsItems_[i].int64_value);
- break;
- case SQLSTATS_DOP:
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-10Ld", hiveStatsItems_[i].int64_value);
- break;
- case SQLSTATS_TABLE_ANSI_NAME:
- hiveStatsItems_[i].str_value[hiveStatsItems_[i].str_ret_len] = '\0';
- if (singleLineFormat_)
- tableNameIndex = i;
- else {
- str_sprintf(&statsBuf_[strlen(statsBuf_)], " %s", hiveStatsItems_[i].str_value);
- if (moveRowToUpQueue(statsBuf_, strlen(statsBuf_), &rc) == -1)
- return rc;
- }
- break;
- case SQLSTATS_EST_ROWS_ACCESSED:
- FormatFloat(formattedFloatVal, intSize, valSize, hiveStatsItems_[i].double_value,
- FALSE, TRUE);
- if (singleLineFormat_)
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", formattedFloatVal);
- else
- str_sprintf(statsBuf_, "%-19s", formattedFloatVal);
- break;
- case SQLSTATS_EST_ROWS_USED:
- FormatFloat(formattedFloatVal, intSize, valSize, hiveStatsItems_[i].double_value,
- FALSE, TRUE);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", formattedFloatVal);
- if (! singleLineFormat_) {
- if (moveRowToUpQueue(statsBuf_, strlen(statsBuf_), &rc) == -1)
- return rc;
- }
- break;
- case SQLSTATS_ACT_ROWS_ACCESSED:
- str_sprintf(Int64Val, "%Ld", hiveStatsItems_[i].int64_value);
- intSize = str_len(Int64Val);
- AddCommas(Int64Val,intSize);
- if (singleLineFormat_)
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
- else
- str_sprintf(statsBuf_, "%-19s", Int64Val);
- break;
- case SQLSTATS_ACT_ROWS_USED:
- str_sprintf(Int64Val, "%Ld", hiveStatsItems_[i].int64_value);
- intSize = str_len(Int64Val);
- AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
- break;
- case SQLSTATS_HIVE_IOS:
- str_sprintf(Int64Val, "%Ld", hiveStatsItems_[i].int64_value);
- intSize = str_len(Int64Val);
- AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-13s", Int64Val);
- break;
- case SQLSTATS_HIVE_IO_BYTES:
- str_sprintf(Int64Val, "%Ld", hiveStatsItems_[i].int64_value/1024/1024);
- intSize = str_len(Int64Val);
- AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-13s", Int64Val);
- break;
- case SQLSTATS_HIVE_IO_ELAPSED_TIME:
- str_sprintf(Int64Val, "%Ld", hiveStatsItems_[i].int64_value);
- intSize = str_len(Int64Val);
- AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
- break;
- case SQLSTATS_HIVE_IO_MAX_TIME:
- str_sprintf(Int64Val, "%Ld", hiveStatsItems_[i].int64_value);
- intSize = str_len(Int64Val);
- AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
- break;
- default:
- break;
- }
- }
- if (singleLineFormat_)
- str_sprintf(&statsBuf_[strlen(statsBuf_)], " %s", hiveStatsItems_[2].str_value);
- if (moveRowToUpQueue(statsBuf_, strlen(statsBuf_), &rc) == -1)
- return rc;
- step_ = GET_NEXT_STATS_DESC_ENTRY_;
- }
- break;
case GET_BMO_STATS_ENTRY_:
{
if (bmoStatsItems_ == NULL)
{
- maxBMOStatsItems_ = 17;
+ maxBMOStatsItems_ = 19;
bmoStatsItems_ = new (getGlobals()->getDefaultHeap())
SQLSTATS_ITEM[maxBMOStatsItems_];
initSqlStatsItems(bmoStatsItems_, maxBMOStatsItems_, FALSE);
@@ -3124,20 +3047,22 @@ short ExExeUtilGetRTSStatisticsTcb::work()
bmoStatsItems_[2].statsItem_id = SQLSTATS_SCRATCH_OVERFLOW_MODE;
bmoStatsItems_[3].statsItem_id = SQLSTATS_DOP;
bmoStatsItems_[4].statsItem_id = SQLSTATS_TOPN;
- bmoStatsItems_[5].statsItem_id = SQLSTATS_OPER_CPU_TIME;
- bmoStatsItems_[6].statsItem_id = SQLSTATS_BMO_HEAP_USED;
- bmoStatsItems_[7].statsItem_id = SQLSTATS_BMO_HEAP_ALLOC;
- bmoStatsItems_[8].statsItem_id = SQLSTATS_BMO_HEAP_WM;
- bmoStatsItems_[9].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_SIZE;
- bmoStatsItems_[10].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_COUNT;
- bmoStatsItems_[11].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
- bmoStatsItems_[12].statsItem_id = SQLSTATS_SCRATCH_IO_SIZE;
- bmoStatsItems_[13].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
- bmoStatsItems_[14].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
- bmoStatsItems_[15].statsItem_id = SQLSTATS_SCRATCH_IO_TIME;
- bmoStatsItems_[16].statsItem_id = SQLSTATS_SCRATCH_IO_MAX_TIME;
-
- // maxBMOStatsItems_ is set to 17
+ bmoStatsItems_[5].statsItem_id = SQLSTATS_BMO_PHASE;
+ bmoStatsItems_[6].statsItem_id = SQLSTATS_INTERIM_ROW_COUNT;
+ bmoStatsItems_[7].statsItem_id = SQLSTATS_OPER_CPU_TIME;
+ bmoStatsItems_[8].statsItem_id = SQLSTATS_BMO_HEAP_USED;
+ bmoStatsItems_[9].statsItem_id = SQLSTATS_BMO_HEAP_ALLOC;
+ bmoStatsItems_[10].statsItem_id = SQLSTATS_BMO_HEAP_WM;
+ bmoStatsItems_[11].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_SIZE;
+ bmoStatsItems_[12].statsItem_id = SQLSTATS_BMO_SPACE_BUFFER_COUNT;
+ bmoStatsItems_[13].statsItem_id = SQLSTATS_SCRATCH_FILE_COUNT;
+ bmoStatsItems_[14].statsItem_id = SQLSTATS_SCRATCH_IO_SIZE;
+ bmoStatsItems_[15].statsItem_id = SQLSTATS_SCRATCH_READ_COUNT;
+ bmoStatsItems_[16].statsItem_id = SQLSTATS_SCRATCH_WRITE_COUNT;
+ bmoStatsItems_[17].statsItem_id = SQLSTATS_SCRATCH_IO_TIME;
+ bmoStatsItems_[18].statsItem_id = SQLSTATS_SCRATCH_IO_MAX_TIME;
+
+ // maxBMOStatsItems_ is set to 19
// TDB_NAME
bmoStatsItems_[1].str_value = new (getGlobals()->getDefaultHeap())
char[MAX_TDB_NAME_LEN+1];
@@ -3146,6 +3071,10 @@ short ExExeUtilGetRTSStatisticsTcb::work()
bmoStatsItems_[2].str_value = new (getGlobals()->getDefaultHeap())
char[13];
bmoStatsItems_[2].str_max_len = 12;
+ // BMO_PHASE
+ bmoStatsItems_[5].str_value = new (getGlobals()->getDefaultHeap())
+ char[12];
+ bmoStatsItems_[5].str_max_len = 11;
}
else
initSqlStatsItems(bmoStatsItems_, maxBMOStatsItems_, TRUE);
@@ -3174,24 +3103,24 @@ short ExExeUtilGetRTSStatisticsTcb::work()
return WORK_CALL_AGAIN;
moveRowToUpQueue(" ");
if (singleLineFormat()) {
- str_sprintf(statsBuf_, "%-5s%-19s%-19s%-10s%-9s%-20s%-24s%-19s%-19s%-20s%-20s%-12s%-11s%-19s%-19s%-20s%-20s",
- "Id", "TDBName", "Mode", "DOP", "TopN", "CPUTime",
- "BMOHeapUsed", "BMOHeapAllocated", "BMOHeapWM",
- "BMOSpaceBufSz","BMOSpaceBufCnt", "ScrFileCnt", "ScrIOSize",
+ str_sprintf(statsBuf_, "%-5s%-20s%-5s%-10s%-10s%-12s%-20s%-20s%-20s%-20s%-20s%-20s%-20s%-10s%-10s%-20s%-20s%-20s%-20s",
+ "Id", "TDBName", "Mode", "DOP", "TopN", "BMOPhase", "InterimRowCount", "CPUTime",
+ "BMOHeapUsed", "BMOHeapAllocated", "BMOHeapWM",
+ "BMOSpaceBufSz","BMOSpaceBufCnt", "FileCnt", "ScrIOSize",
"ScrIORead", "ScrIOWritten", "ScrIOTime", "ScrIOMaxTime");
moveRowToUpQueue(statsBuf_);
}
else {
- str_sprintf(statsBuf_, "%-5s%-19s%-19s%-10s%-9s%-20s",
- "Id", "TDBName", "Mode", "DOP", "TopN", "CPUTime");
+ str_sprintf(statsBuf_, "%-5s%-20s%-20s%-10s%-10s%-20s%-20s%-20s",
+ "Id", "TDBName", "Mode", "DOP", "TopN", "BMOPhase", "InterimRowCount", "CPUTime");
moveRowToUpQueue(statsBuf_);
- str_sprintf(statsBuf_, "%-24s%-19s%-19s%-20s%-20s",
+ str_sprintf(statsBuf_, "%-25s%-20s%-20s%-20s%-20s",
"BMOHeapUsed", "BMOHeapAllocated", "BMOHeapWM",
"BMOSpaceBufSz","BMOSpaceBufCnt");
moveRowToUpQueue(statsBuf_);
- str_sprintf(statsBuf_, "%-11s%-13s%-19s%-19s%-20s%-20s",
+ str_sprintf(statsBuf_, "%-25s%-20s%-20s%-20s%-20s%-20s",
"ScrFileCnt", "ScrIOSize", "ScrIORead", "ScrIOWritten", "ScrIOTime", "ScrIOMaxTime");
moveRowToUpQueue(statsBuf_);
}
@@ -3201,6 +3130,7 @@ short ExExeUtilGetRTSStatisticsTcb::work()
break;
case FORMAT_AND_RETURN_BMO_STATS_:
{
+ const char *ofMode;
for (; currStatsItemEntry_ < maxBMOStatsItems_; currStatsItemEntry_++)
{
i = (short)currStatsItemEntry_;
@@ -3213,11 +3143,17 @@ short ExExeUtilGetRTSStatisticsTcb::work()
break;
case SQLSTATS_TDB_NAME:
bmoStatsItems_[i].str_value[bmoStatsItems_[i].str_ret_len] = '\0';
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", bmoStatsItems_[i].str_value);
+ if (singleLineFormat_)
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], " %19s", bmoStatsItems_[i].str_value);
+ else
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", bmoStatsItems_[i].str_value);
break;
case SQLSTATS_SCRATCH_OVERFLOW_MODE:
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s",
- ExBMOStats::getScratchOverflowMode((Int16) bmoStatsItems_[i].int64_value));
+ ofMode = ExBMOStats::getScratchOverflowMode((Int16) bmoStatsItems_[i].int64_value);
+ if (singleLineFormat_)
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-5s", ofMode);
+ else
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", ofMode);
break;
case SQLSTATS_DOP:
str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-10Ld", bmoStatsItems_[i].int64_value);
@@ -3226,7 +3162,20 @@ short ExExeUtilGetRTSStatisticsTcb::work()
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-9s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-10s", Int64Val);
+ break;
+ case SQLSTATS_BMO_PHASE:
+ bmoStatsItems_[i].str_value[bmoStatsItems_[i].str_ret_len] = '\0';
+ if (singleLineFormat_)
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-12s", bmoStatsItems_[i].str_value);
+ else
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", bmoStatsItems_[i].str_value);
+ break;
+ case SQLSTATS_INTERIM_ROW_COUNT:
+ str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
+ intSize = str_len(Int64Val);
+ AddCommas(Int64Val,intSize);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_OPER_CPU_TIME:
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
@@ -3243,16 +3192,16 @@ short ExExeUtilGetRTSStatisticsTcb::work()
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
if (singleLineFormat_)
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-24s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
else
- str_sprintf(statsBuf_, "%-24s", Int64Val);
+ str_sprintf(statsBuf_, "%-25s", Int64Val);
break;
case SQLSTATS_BMO_HEAP_ALLOC:
case SQLSTATS_BMO_HEAP_WM:
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_BMO_SPACE_BUFFER_SIZE:
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
@@ -3273,27 +3222,30 @@ short ExExeUtilGetRTSStatisticsTcb::work()
case SQLSTATS_SCRATCH_FILE_COUNT:
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
if (singleLineFormat_)
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-5s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-10s", Int64Val);
else
- str_sprintf(statsBuf_, "%-5s", Int64Val);
+ str_sprintf(statsBuf_, "%-25s", Int64Val);
break;
case SQLSTATS_SCRATCH_IO_SIZE:
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
+ if (singleLineFormat_)
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-10s", Int64Val);
+ else
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_SCRATCH_READ_COUNT:
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_SCRATCH_WRITE_COUNT:
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
intSize = str_len(Int64Val);
AddCommas(Int64Val,intSize);
- str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-19s", Int64Val);
+ str_sprintf(&statsBuf_[strlen(statsBuf_)], "%-20s", Int64Val);
break;
case SQLSTATS_SCRATCH_IO_TIME:
str_sprintf(Int64Val, "%Ld", bmoStatsItems_[i].int64_value);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/sql/executor/ExStats.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExStats.cpp b/core/sql/executor/ExStats.cpp
index 02ba58a..56a0a9d 100644
--- a/core/sql/executor/ExStats.cpp
+++ b/core/sql/executor/ExStats.cpp
@@ -75,6 +75,9 @@
#include "Statement.h"
#include "ComTdbRoot.h"
#include "ComDistribution.h"
+#include "ex_hashj.h"
+#include "ex_sort.h"
+#include "ex_hash_grby.h"
#include <unistd.h>
#include <errno.h>
@@ -1543,11 +1546,13 @@ void ExFragRootOperStats::init(NABoolean resetDop)
localCpuTime_ = 0;
scratchOverflowMode_ = -1;
scratchFileCount_ = 0;
- scratchBufferBlockSize_ = 0;
- scratchBufferBlockRead_ = 0;
- scratchBufferBlockWritten_ = 0;
+ scratchIOSize_ = 0;
+ spaceBufferSize_ = 0;
+ spaceBufferCount_ = 0;
scratchWriteCount_ = 0;
scratchReadCount_ = 0;
+ scratchIOMaxTime_ = 0;
+ interimRowCount_ = 0;
udrCpuTime_ = 0;
topN_ = -1;
waitTime_ = 0;
@@ -1716,18 +1721,26 @@ void ExFragRootOperStats::merge(ExFragRootOperStats* other)
if (scratchOverflowMode_ == -1)
scratchOverflowMode_ = other->scratchOverflowMode_;
scratchFileCount_ += other->scratchFileCount_;
-
- if (scratchBufferBlockSize_ == 0 &&
- other->scratchBufferBlockSize_ > 0)
- scratchBufferBlockSize_ = other->scratchBufferBlockSize_;
Float32 mFactor = 1;
- if(scratchBufferBlockSize_ > 0)
- mFactor = (Float32)other->scratchBufferBlockSize_ / scratchBufferBlockSize_;
- scratchBufferBlockRead_ += Int32 (other->scratchBufferBlockRead_ * mFactor);
- scratchBufferBlockWritten_ += Int32 (other->scratchBufferBlockWritten_ * mFactor);
-
- scratchReadCount_ += other->scratchReadCount_;
- scratchWriteCount_ += other->scratchWriteCount_;
+ if (spaceBufferSize_ == 0 &&
+ other->spaceBufferSize_ > 0)
+ spaceBufferSize_ = other->spaceBufferSize_;
+ mFactor = 1;
+ if(spaceBufferSize_ > 0)
+ mFactor = (Float32)other->spaceBufferSize_ / spaceBufferSize_;
+ spaceBufferCount_ += Int32(other->spaceBufferCount_ * mFactor);
+ if (scratchIOSize_ == 0 &&
+ other->scratchIOSize_ > 0)
+ scratchIOSize_ = other->scratchIOSize_;
+ mFactor = 1;
+ if(scratchIOSize_ > 0)
+ mFactor = (Float32)other->scratchIOSize_ / scratchIOSize_;
+
+ scratchReadCount_ += Int32(other->scratchReadCount_ * mFactor);
+ scratchWriteCount_ += Int32(other->scratchWriteCount_ * mFactor);
+ if (other->scratchIOMaxTime_ > scratchIOMaxTime_)
+ scratchIOMaxTime_ = other->scratchIOMaxTime_;
+ interimRowCount_ += other->interimRowCount_;
udrCpuTime_ += other->udrCpuTime_;
if(topN_ == -1 && other->topN_ > 0)
topN_ = other->topN_;
@@ -1751,18 +1764,24 @@ void ExFragRootOperStats::merge(ExBMOStats *other)
{
scratchFileCount_ += other->scratchFileCount_;
scratchOverflowMode_ = other->scratchOverflowMode_;
-
- if (scratchBufferBlockSize_ == 0 &&
- other->scratchBufferBlockSize_ > 0)
- scratchBufferBlockSize_ = other->scratchBufferBlockSize_;
Float32 mFactor = 1;
- if(scratchBufferBlockSize_ > 0)
- mFactor = (Float32)other->scratchBufferBlockSize_ / scratchBufferBlockSize_;
- scratchBufferBlockRead_ += Int32 (other->scratchBufferBlockRead_ * mFactor);
- scratchBufferBlockWritten_ += Int32 (other->scratchBufferBlockWritten_ * mFactor);
-
- scratchReadCount_ += other->scratchReadCount_;
- scratchWriteCount_ += other->scratchWriteCount_;
+ if (spaceBufferSize_ == 0 &&
+ other->spaceBufferSize_ > 0)
+ spaceBufferSize_ = other->spaceBufferSize_;
+ mFactor = 1;
+ if(spaceBufferSize_ > 0)
+ mFactor = (Float32)other->spaceBufferSize_ / spaceBufferSize_;
+ spaceBufferCount_ += Int32(other->spaceBufferCount_ * mFactor);
+ if (scratchIOSize_ == 0 &&
+ other->scratchIOSize_ > 0)
+ scratchIOSize_ = other->scratchIOSize_;
+ mFactor = 1;
+ if(scratchIOSize_ > 0)
+ mFactor = (Float32)other->scratchIOSize_ / scratchIOSize_;
+ scratchReadCount_ += Int32 (other->scratchReadCount_ * mFactor);
+ scratchWriteCount_ += Int32 (other->scratchWriteCount_ * mFactor);
+ scratchIOMaxTime_ += other->scratchIOMaxTime_;
+ interimRowCount_ += other->interimRowCount_;
if(topN_ == -1 && other->topN_ > 0)
topN_ = other->topN_;
}
@@ -1895,8 +1914,8 @@ void ExFragRootOperStats::getVariableStatsInfo(char * dataBuffer,
"Newprocess: %u NewprocessTime: %Ld reqMsgCnt: %Ld "
"regMsgBytes: %Ld replyMsgCnt: %Ld replyMsgBytes: %Ld "
"PMemUsed: %Ld scrOverFlowMode: %d sortTopN: %Ld"
- "scrFileCount: %d scrBufferBlockSize: %d scrBuffferRead: %Ld scrBufferWritten: %Ld "
- "scrWriteCount:%Ld scrReadCount: %Ld udrCpuTime: %Ld "
+ "scrFileCount: %d bmoSpaceBufferSize: %d bmoSpaceBufferCount: %Ld scrIOSize: %d "
+ "scrWriteCount:%Ld scrReadCount: %Ld scrIOMaxTime: %Ld bmoInterimRowCount: %Ld udrCpuTime: %Ld "
"maxWaitTime: %Ld avgWaitTime: %Ld "
"hdfsAccess: %Ld ",
cpuTime_,
@@ -1918,11 +1937,13 @@ void ExFragRootOperStats::getVariableStatsInfo(char * dataBuffer,
scratchOverflowMode_,
topN_,
scratchFileCount_,
- scratchBufferBlockSize_,
- scratchBufferBlockRead_,
- scratchBufferBlockWritten_,
+ spaceBufferSize_,
+ spaceBufferCount_,
+ scratchIOSize_,
scratchWriteCount_,
scratchReadCount_,
+ scratchIOMaxTime_,
+ interimRowCount_,
udrCpuTime_,
maxWaitTime_,
getAvgWaitTime(),
@@ -2008,14 +2029,14 @@ Lng32 ExFragRootOperStats::getStatsItem(SQLSTATS_ITEM* sqlStats_item)
case SQLSTATS_TOPN:
sqlStats_item->int64_value = topN_;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE:
- sqlStats_item->int64_value = scratchBufferBlockSize_;
+ case SQLSTATS_BMO_SPACE_BUFFER_SIZE:
+ sqlStats_item->int64_value = spaceBufferSize_;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ:
- sqlStats_item->int64_value = scratchBufferBlockRead_;
+ case SQLSTATS_BMO_SPACE_BUFFER_COUNT:
+ sqlStats_item->int64_value = spaceBufferCount_;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN:
- sqlStats_item->int64_value = scratchBufferBlockWritten_;
+ case SQLSTATS_SCRATCH_IO_SIZE:
+ sqlStats_item->int64_value = scratchIOSize_;
break;
case SQLSTATS_SCRATCH_READ_COUNT:
sqlStats_item->int64_value = scratchReadCount_;
@@ -2023,6 +2044,12 @@ Lng32 ExFragRootOperStats::getStatsItem(SQLSTATS_ITEM* sqlStats_item)
case SQLSTATS_SCRATCH_WRITE_COUNT:
sqlStats_item->int64_value = scratchWriteCount_;
break;
+ case SQLSTATS_SCRATCH_IO_MAX_TIME:
+ sqlStats_item->int64_value = scratchIOMaxTime_;
+ break;
+ case SQLSTATS_INTERIM_ROW_COUNT:
+ sqlStats_item->int64_value = interimRowCount_;
+ break;
case SQLSTATS_UDR_CPU_BUSY_TIME:
sqlStats_item->int64_value = udrCpuTime_;
break;
@@ -4585,19 +4612,8 @@ UInt32 ExMeasStats::packedLength()
else
{
size = ExMeasBaseStats::packedLength();
- if (NOT statsInDp2())
- {
- alignSizeForNextObj(size);
- size += sizeof(ExMeasStats)-sizeof(ExMeasBaseStats);
- }
- else
- {
- size += sizeof(spaceUsage_);
- size += sizeof(spaceAlloc_);
- size += sizeof(heapUsage_);
- size += sizeof(heapAlloc_);
- size += sizeof(heapWM_);
- }
+ alignSizeForNextObj(size);
+ size += sizeof(ExMeasStats)-sizeof(ExMeasBaseStats);
}
return size;
}
@@ -4648,27 +4664,12 @@ UInt32 ExMeasStats::pack(char * buffer)
else
{
size = ExMeasBaseStats::pack(buffer);
- if (NOT statsInDp2())
- {
- alignSizeForNextObj(size);
- buffer += size;
- srcLen = sizeof(ExMeasStats)-sizeof(ExMeasBaseStats);
- char * srcPtr = (char *)this+sizeof(ExMeasBaseStats);
- memcpy(buffer, (void *)srcPtr, srcLen);
- size += srcLen;
- }
- else
- {
- buffer += size;
- if (getVersion() >= _STATS_RTS_VERSION_R22)
- {
- size += packIntoBuffer(buffer, spaceUsage_);
- size += packIntoBuffer(buffer, spaceAlloc_);
- size += packIntoBuffer(buffer, heapUsage_);
- size += packIntoBuffer(buffer, heapAlloc_);
- size += packIntoBuffer(buffer, heapWM_);
- }
- }
+ alignSizeForNextObj(size);
+ buffer += size;
+ srcLen = sizeof(ExMeasStats)-sizeof(ExMeasBaseStats);
+ char * srcPtr = (char *)this+sizeof(ExMeasBaseStats);
+ memcpy(buffer, (void *)srcPtr, srcLen);
+ size += srcLen;
}
return size;
}
@@ -4714,15 +4715,13 @@ void ExMeasStats::unpack(const char* &buffer)
}
else
{
- if (NOT statsInDp2())
- {
- alignBufferForNextObj(buffer);
- UInt32 srcLen = sizeof(ExMeasStats)-sizeof(ExMeasBaseStats);
- char * srcPtr = (char *)this+sizeof(ExMeasBaseStats);
- memcpy((void *)srcPtr, buffer, srcLen);
- buffer += srcLen;
- if (statsInEsp())
- {
+ alignBufferForNextObj(buffer);
+ UInt32 srcLen = sizeof(ExMeasStats)-sizeof(ExMeasBaseStats);
+ char * srcPtr = (char *)this+sizeof(ExMeasBaseStats);
+ memcpy((void *)srcPtr, buffer, srcLen);
+ buffer += srcLen;
+ if (statsInEsp())
+ {
espSpaceUsage_ += spaceUsage_;
espSpaceAlloc_ += spaceAlloc_;
espHeapUsage_ += heapUsage_;
@@ -4735,7 +4734,6 @@ void ExMeasStats::unpack(const char* &buffer)
heapAlloc_ = 0;
heapWM_ = 0;
cpuTime_ = 0;
- }
}
}
}
@@ -4771,9 +4769,11 @@ void ExMeasStats::init(NABoolean resetDop)
localCpuTime_ = 0;
scratchOverflowMode_ = -1;
scratchFileCount_ = 0;
- scratchBufferBlockSize_ = 0;
- scratchBufferBlockRead_ = 0;
- scratchBufferBlockWritten_ = 0;
+ spaceBufferSize_ = 0;
+ spaceBufferCount_ = 0;
+ scratchIOSize_ = 0;
+ interimRowCount_ = 0;
+ scratchIOMaxTime_ = 0;
scratchWriteCount_ = 0;
scratchReadCount_ = 0;
udrCpuTime_ = 0;
@@ -4818,17 +4818,20 @@ void ExMeasStats::merge(ExBMOStats *other)
{
scratchFileCount_ += other->scratchFileCount_;
scratchOverflowMode_ = other->scratchOverflowMode_;
- if (scratchBufferBlockSize_ == 0 &&
- other->scratchBufferBlockSize_ > 0)
- scratchBufferBlockSize_ = other->scratchBufferBlockSize_;
+ if (spaceBufferSize_ == 0 &&
+ other->spaceBufferSize_ > 0)
+ spaceBufferSize_ = other->spaceBufferSize_;
Float32 mFactor = 1;
- if(scratchBufferBlockSize_ > 0)
- mFactor = (Float32)other->scratchBufferBlockSize_ / scratchBufferBlockSize_;
- scratchBufferBlockRead_ += Int32 (other->scratchBufferBlockRead_ * mFactor);
- scratchBufferBlockWritten_ += Int32 (other->scratchBufferBlockWritten_ * mFactor);
-
- scratchReadCount_ += other->scratchReadCount_;
- scratchWriteCount_ += other->scratchWriteCount_;
+ if(spaceBufferSize_ > 0)
+ mFactor = (Float32)other->spaceBufferSize_ / spaceBufferSize_;
+ spaceBufferCount_ += Int32 (other->spaceBufferCount_ * mFactor);
+ mFactor = 1;
+ if(scratchIOSize_ > 0)
+ mFactor = (Float32)other->scratchIOSize_ / scratchIOSize_;
+ scratchReadCount_ += (other->scratchReadCount_ * mFactor);
+ scratchWriteCount_ += (other->scratchWriteCount_ * mFactor);
+ scratchIOMaxTime_ += other->scratchIOMaxTime_;
+ interimRowCount_ += other->interimRowCount_;
if (topN_ == -1 && other->topN_ > 0)
topN_ = other->topN_;
}
@@ -4879,17 +4882,21 @@ void ExMeasStats::merge(ExMeasStats* other)
replyMsgBytes_ += other -> replyMsgBytes_;
scratchFileCount_ += other->scratchFileCount_;
- if (scratchBufferBlockSize_ == 0 &&
- other->scratchBufferBlockSize_ > 0)
- scratchBufferBlockSize_ = other->scratchBufferBlockSize_;
+ if (spaceBufferSize_ == 0 &&
+ other->spaceBufferSize_ > 0)
+ spaceBufferSize_ = other->spaceBufferSize_;
Float32 mFactor = 1;
- if(scratchBufferBlockSize_ > 0)
- mFactor = (Float32)other->scratchBufferBlockSize_ / scratchBufferBlockSize_;
- scratchBufferBlockRead_ += Int32 (other->scratchBufferBlockRead_ * mFactor);
- scratchBufferBlockWritten_ += Int32 (other->scratchBufferBlockWritten_ * mFactor);
-
- scratchReadCount_ += other->scratchReadCount_;
- scratchWriteCount_ += other->scratchWriteCount_;
+ if(spaceBufferSize_ > 0)
+ mFactor = (Float32)other->spaceBufferSize_ / spaceBufferSize_;
+ spaceBufferCount_ += Int32 (other->spaceBufferCount_ * mFactor);
+ mFactor = 1;
+ if(scratchIOSize_ > 0)
+ mFactor = (Float32)other->scratchIOSize_ / scratchIOSize_;
+ scratchReadCount_ += (other->scratchReadCount_ * mFactor);
+ scratchWriteCount_ += (other->scratchWriteCount_ * mFactor);
+ if (other->scratchIOMaxTime_ > scratchIOMaxTime_)
+ scratchIOMaxTime_ = other->scratchIOMaxTime_;
+ interimRowCount_ += other->interimRowCount_;
udrCpuTime_ += other->udrCpuTime_;
if (topN_ == -1 && other->topN_ > 0)
topN_ = other->topN_;
@@ -4995,11 +5002,13 @@ void ExMeasStats::copyContents(ExMeasStats *other)
replyMsgCnt_ = other->replyMsgCnt_;
replyMsgBytes_ = other->replyMsgBytes_;
scratchFileCount_ = other->scratchFileCount_;
- scratchBufferBlockSize_ = other->scratchBufferBlockSize_;
- scratchBufferBlockRead_ = other->scratchBufferBlockRead_;
- scratchBufferBlockWritten_ = other->scratchBufferBlockWritten_;
+ spaceBufferSize_ = other->spaceBufferSize_;
+ spaceBufferCount_ = other->spaceBufferCount_;
+ scratchIOSize_ = other->scratchIOSize_;
scratchReadCount_ = other->scratchReadCount_;
scratchWriteCount_ = other->scratchWriteCount_;
+ scratchIOMaxTime_ = other->scratchIOMaxTime_;
+ interimRowCount_ = interimRowCount_;
udrCpuTime_ = other->udrCpuTime_;
topN_ = other->topN_;
}
@@ -5064,8 +5073,8 @@ void ExMeasStats::getVariableStatsInfo(char * dataBuffer, char * datalen,
"SpaceTotal: %d SpaceUsed: %d HeapTotal: %d HeapUsed: %d HeapWM: %u CpuTime: %Ld "
"reqMsgCnt: %Ld reqMsgBytes: %Ld replyMsgCnt: %Ld "
"replyMsgBytes: %Ld scrOverflowMode: %d sortTopN: %Ld"
- "scrFileCount: %d scrBufferBlockSize: %d scrBufferRead: %Ld scrBufferWritten: %Ld "
- "scrWriteCount: %Ld scrReadCount: %Ld udrCpuTime: %Ld",
+ "scrFileCount: %d bmoSpaceBufferSize: %d bmoSpaceBufferCount: %Ld scrIoSize: %d "
+ "scrWriteCount: %Ld scrReadCount: %Ld scrIOMaxTime: %Ld interimRowCount: %Ld udrCpuTime: %Ld ",
statType(),
getNewprocess(),
getNewprocessTime(),
@@ -5085,11 +5094,13 @@ void ExMeasStats::getVariableStatsInfo(char * dataBuffer, char * datalen,
scratchOverflowMode_,
topN_,
scratchFileCount_,
- scratchBufferBlockSize_,
- scratchBufferBlockRead_,
- scratchBufferBlockWritten_,
+ spaceBufferSize_,
+ spaceBufferCount_,
+ scratchIOSize_,
scratchWriteCount_,
scratchReadCount_,
+ scratchIOMaxTime_,
+ interimRowCount_,
udrCpuTime_
);
}
@@ -5178,14 +5189,11 @@ Lng32 ExMeasStats::getStatsItem(SQLSTATS_ITEM* sqlStats_item)
case SQLSTATS_SCRATCH_OVERFLOW_MODE:
sqlStats_item->int64_value = scratchOverflowMode_;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCK_SIZE:
- sqlStats_item->int64_value = scratchBufferBlockSize_;
- break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_READ:
- sqlStats_item->int64_value = scratchBufferBlockRead_;
+ case SQLSTATS_BMO_SPACE_BUFFER_SIZE:
+ sqlStats_item->int64_value = spaceBufferSize_;
break;
- case SQLSTATS_SCRATCH_BUFFER_BLOCKS_WRITTEN:
- sqlStats_item->int64_value = scratchBufferBlockWritten_;
+ case SQLSTATS_BMO_SPACE_BUFFER_COUNT:
+ sqlStats_item->int64_value = spaceBufferCount_;
break;
case SQLSTATS_SCRATCH_READ_COUNT:
sqlStats_item->int64_value = scratchReadCount_;
@@ -5193,6 +5201,18 @@ Lng32 ExMeasStats::getStatsItem(SQLSTATS_ITEM* sqlStats_item)
case SQLSTATS_SCRATCH_WRITE_COUNT:
sqlStats_item->int64_value = scratchWriteCount_;
break;
+ case SQLSTATS_SCRATCH_IO_SIZE:
+ sqlStats_item->int64_value = scratchIOSize_;
+ break;
+ case SQLSTATS_SCRATCH_IO_MAX_TIME:
+ sqlStats_item->int64_value = scratchIOMaxTime_;
+ break;
+ case SQLSTATS_INTERIM_ROW_COUNT:
+ sqlStats_item->int64_value = interimRowCount_;
+ break;
+ case SQLSTATS_TOPN:
+ sqlStats_item->int64_value = topN_;
+ break;
case SQLSTATS_UDR_CPU_BUSY_TIME:
sqlStats_item->int64_value = udrCpuTime_;
break;
@@ -6961,7 +6981,7 @@ const char *ExStatisticsArea::getStatsTypeText(short statsType)
case SQLCLI_PROGRESS_STATS:
return "PROGRESS_STATS";
default:
- return "UNKNOW";
+ return "UNKNOWN";
}
}
@@ -10475,6 +10495,8 @@ void ExBMOStats::init(NABoolean resetDop)
topN_ = -1;
timer_.reset();
scratchIOMaxTime_ = 0;
+ phase_ = 0;
+ interimRowCount_ = 0;
}
UInt32 ExBMOStats::packedLength()
@@ -10566,12 +10588,14 @@ void ExBMOStats::getVariableStatsInfo(char * dataBuffer,
char *buf = dataBuffer;
str_sprintf (
buf,
- "statsRowType: %d explainTdbId: %d bmoHeapUsed: %d bmoHeapTotal: %d bmoHeapWM: %d "
+ "statsRowType: %d explainTdbId: %d bmoPhase: %s bmoIntCount: %Ld estMemory: %0.2f bmoHeapUsed: %d bmoHeapTotal: %d bmoHeapWM: %d "
"bmoSpaceBufferSize: %d bmoSpaceBufferCount: %d "
"scrOverFlowMode: %d scrFileCount: %d scrBufferBlockSize: %d scrBuffferRead: %d scrBufferWritten: %d "
"scrWriteCount: %Ld scrReadCount: %Ld topN: %Ld scrIOSize: %d scrIOTime: %Ld scrIOMaxTime: %Ld ",
statType(),
getExplainNodeId(),
+ getBmoPhaseStr(),
+ interimRowCount_,
bmoHeapUsage_,
bmoHeapAlloc_,
bmoHeapWM_,
@@ -10613,17 +10637,34 @@ void ExBMOStats::merge(ExBMOStats* other)
if (other->scratchIOSize_ != -1)
scratchIOSize_ = other->scratchIOSize_;
if (other->topN_ != -1)
- topN_ = other->topN_;
+ topN_ = other->topN_;
+ if (other->phase_ > phase_)
+ phase_ = other->phase_;
scratchOverflowMode_ = other->scratchOverflowMode_;
scratchFileCount_ += other->scratchFileCount_;
scratchBufferBlockRead_ += other->scratchBufferBlockRead_;
scratchBufferBlockWritten_ += other->scratchBufferBlockWritten_;
scratchReadCount_ += other->scratchReadCount_;
scratchWriteCount_ += other->scratchWriteCount_;
+ interimRowCount_ += other->interimRowCount_;
if (other->scratchIOMaxTime_ > scratchIOMaxTime_)
scratchIOMaxTime_ = other->scratchIOMaxTime_;
}
+const char *ExBMOStats::getBmoPhaseStr()
+{
+ ComTdb::ex_node_type tdbType = getTdbType();
+
+ if (tdbType == ComTdb::ex_HASHJ)
+ return ex_hashj_tcb::HashJoinPhaseStr[phase_];
+ else if (tdbType == ComTdb::ex_SORT)
+ return ExSortTcb::SortPhaseStr[phase_];
+ else if (tdbType == ComTdb::ex_HASH_GRBY)
+ return ex_hash_grby_tcb::HashGrbyPhaseStr[phase_];
+ else
+ return "UNKNOWN";
+}
+
Lng32 ExBMOStats::getStatsItem(SQLSTATS_ITEM* sqlStats_item)
{
sqlStats_item->error_code = 0;
@@ -10680,6 +10721,23 @@ Lng32 ExBMOStats::getStatsItem(SQLSTATS_ITEM* sqlStats_item)
case SQLSTATS_SCRATCH_IO_MAX_TIME:
sqlStats_item->int64_value = scratchIOMaxTime_;
break;
+ case SQLSTATS_INTERIM_ROW_COUNT:
+ sqlStats_item->int64_value = interimRowCount_;
+ break;
+ case SQLSTATS_BMO_PHASE:
+ if (sqlStats_item->str_value != NULL)
+ {
+ const char *bmoPhase = getBmoPhaseStr();
+ len = strlen(bmoPhase);
+ if (len > sqlStats_item->str_max_len)
+ sqlStats_item->error_code = EXE_ERROR_IN_STAT_ITEM;
+ else
+ str_cpy(sqlStats_item->str_value, bmoPhase, len);
+ sqlStats_item->str_ret_len = len;
+ }
+ else
+ sqlStats_item->error_code = EXE_ERROR_IN_STAT_ITEM;
+ break;
case SQLSTATS_DETAIL:
if (sqlStats_item->str_value != NULL)
{
@@ -10694,6 +10752,8 @@ Lng32 ExBMOStats::getStatsItem(SQLSTATS_ITEM* sqlStats_item)
str_cpy(sqlStats_item->str_value, tmpBuf, len);
sqlStats_item->str_ret_len = len;
}
+ else
+ sqlStats_item->error_code = EXE_ERROR_IN_STAT_ITEM;
break;
default:
ExOperStats::getStatsItem(sqlStats_item);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/sql/executor/ExStats.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExStats.h b/core/sql/executor/ExStats.h
index a3fbe15..280e924 100644
--- a/core/sql/executor/ExStats.h
+++ b/core/sql/executor/ExStats.h
@@ -1207,7 +1207,11 @@ public:
static const char *getScratchOverflowMode(Int16 overflowMode);
ExTimeStats &getScratchIOTimer() { return timer_; }
inline void setScratchIOSize(Int64 size) { scratchIOSize_ = size; }
-
+ const char *getBmoPhaseStr();
+ inline void setBmoPhase(Int16 phase) { phase_ = phase; }
+ inline Int16 getBmoPhase() { return phase_; }
+ void resetInterimRowCount() { interimRowCount_ = 0;}
+ void incInterimRowCount() { interimRowCount_++; }
private:
ExTimeStats timer_;
Int32 bmoHeapAlloc_;
@@ -1225,6 +1229,8 @@ private:
Int64 scratchIOMaxTime_;
Int16 scratchOverflowMode_; // 0 - disk 1 - SSD
Int32 topN_; // TOPN value
+ Int64 interimRowCount_;
+ Int16 phase_;
};
@@ -1453,11 +1459,13 @@ private:
char *queryId_;
Lng32 queryIdLen_;
Int32 scratchFileCount_;
- Int32 scratchBufferBlockSize_;
- Int64 scratchBufferBlockRead_;
- Int64 scratchBufferBlockWritten_;
+ Int32 spaceBufferSize_;
+ Int64 spaceBufferCount_;
+ Int32 scratchIOSize_;
Int64 scratchReadCount_;
Int64 scratchWriteCount_;
+ Int64 interimRowCount_;
+ Int64 scratchIOMaxTime_;
Int64 udrCpuTime_;
Int64 topN_;
// process id of this fragment instance (to correlate it with MEASURE data)
@@ -2831,13 +2839,15 @@ private:
Int64 localCpuTime_;
Int16 scratchOverflowMode_;
Int32 scratchFileCount_;
- Int32 scratchBufferBlockSize_;
- Int64 scratchBufferBlockRead_;
- Int64 scratchBufferBlockWritten_;
+ Int32 spaceBufferSize_;
+ Int64 spaceBufferCount_;
Int64 scratchReadCount_;
Int64 scratchWriteCount_;
Int64 udrCpuTime_;
- Int64 topN_;
+ Int32 topN_;
+ Int32 scratchIOSize_;
+ Int64 interimRowCount_;
+ Int64 scratchIOMaxTime_;
};
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/sql/executor/ex_hash_grby.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_hash_grby.cpp b/core/sql/executor/ex_hash_grby.cpp
index 139e411..325c169 100644
--- a/core/sql/executor/ex_hash_grby.cpp
+++ b/core/sql/executor/ex_hash_grby.cpp
@@ -63,6 +63,15 @@
//
//////////////////////////////////////////////////////////////////////////////
+// In the reverse order of ex_hash_grbytcb::HashGrbyPhase
+// Limit to 11 characters
+const char *ex_hash_grby_tcb::HashGrbyPhaseStr[] = {
+ "PHASE_END",
+ "READ_SPILL",
+ "RETURN_ROWS",
+ "READ_ROWS"
+};
+
NABoolean ex_hash_grby_tcb::needStatsEntry()
{
ComTdb::CollectStatsType statsType = getGlobals()->getStatsArea()->getCollectStatsType();
@@ -77,7 +86,9 @@ ExOperStats * ex_hash_grby_tcb::doAllocateStatsEntry(CollHeap *heap,
ComTdb *tdb)
{
ExBMOStats *stat;
-
+ ComTdbHashGrby *comTdbHashGrby = (ComTdbHashGrby *)tdb;
+ if (comTdbHashGrby->isNonBMOPartialGroupBy())
+ return ex_tcb::doAllocateStatsEntry(heap, tdb);
ComTdb::CollectStatsType statsType = getGlobals()->getStatsArea()->getCollectStatsType();
if (statsType == ComTdb::OPERATOR_STATS)
stat = new (heap) ExBMOStats(heap, this, tdb);
@@ -452,6 +463,8 @@ short ex_hash_grby_tcb::work() {
hasFreeTupp_ = TRUE;
};
};
+ if (bmoStats_)
+ bmoStats_->setBmoPhase(PHASE_END-HGB_READ_PHASE);
// now read the next row from the child queue
workReadChild();
@@ -488,6 +501,9 @@ short ex_hash_grby_tcb::work() {
} break;
case HASH_GRBY_READ_BUFFER: {
+ if (bmoStats_ && (bmoStats_->getBmoPhase() == (PHASE_END-HGB_READ_PHASE)))
+ bmoStats_->setBmoPhase(PHASE_END-HGB_READ_SPILL_PHASE);
+
workReadBuffer();
if (state_ == HASH_GRBY_READ_BUFFER)
// I/O is not done yet
@@ -537,6 +553,9 @@ short ex_hash_grby_tcb::work() {
else
hasFreeTupp_ = TRUE;
};
+
+ if (bmoStats_ && (bmoStats_->getBmoPhase() == (PHASE_END-HGB_READ_PHASE)))
+ bmoStats_->setBmoPhase(PHASE_END-HGB_RETURN_PHASE);
// now we are ready to return a row
ULng32 retCode = workReturnRows(tryToDefrag);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e7719015/core/sql/executor/ex_hash_grby.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_hash_grby.h b/core/sql/executor/ex_hash_grby.h
index 6d80463..5c06566 100644
--- a/core/sql/executor/ex_hash_grby.h
+++ b/core/sql/executor/ex_hash_grby.h
@@ -140,6 +140,16 @@ class ex_hash_grby_tcb : public ex_tcb {
HASH_GRBY_CANCELED
};
+ // the phase of the hash groupby algorithm
+ // Change ex_hash_grby_tcb::HashGrbyPhaseStr when you add new value to this enum
+ // New phase enum value should be added before PHASE_END
+ enum HashGrbyPhase {
+ HGB_READ_PHASE,
+ HGB_RETURN_PHASE,
+ HGB_READ_SPILL_PHASE,
+ PHASE_END
+ };
+
Space * space_;
CollHeap * heap_;
#ifndef __EID
@@ -302,6 +312,7 @@ NA_EIDPROC
void resetClusterAndReadFromChild(); // Tmobile.
public:
+ static const char *HashGrbyPhaseStr[];
NA_EIDPROC
ex_hash_grby_tcb(const ex_hash_grby_tdb & hash_grby_tdb,