Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/255#discussion_r49254562
--- Diff: core/sql/generator/GenExplain.cpp ---
@@ -660,6 +660,269 @@ FileScan::addSpecificExplainInfo(ExplainTupleMaster
*explainTuple,
return(explainTuple);
}
+static void appendListOfColumns(Queue* listOfColNames,ComTdb *tdb,
NAString& outNAString){
+
+ if (((ComTdbHbaseAccess*)tdb)->sqHbaseTable()){// if trafodion table
+ char buf[1000];
+
+ listOfColNames->position();
+ for (Lng32 j = 0; j < listOfColNames->numEntries(); j++)
+ {
+ char * currPtr = (char*)listOfColNames->getCurr();
+
+ Lng32 currPos = 0;
+ Lng32 jj = 0;
+ short colNameLen = *(short*)currPtr;
+ currPos += sizeof(short);
+ char colFam[100];
+ while (currPtr[currPos] != ':')
+ {
+ colFam[jj] = currPtr[currPos];
+ currPos++;
+ jj++;
+ }
+ colFam[jj] = ':';
+ jj++;
+ currPos++;
+ colFam[jj] = 0;
+ colNameLen -= jj;
+
+ NABoolean withAt = FALSE;
+ char * colName = &currPtr[currPos];
+ if (colName[0] == '@')
+ {
+ colNameLen--;
+ colName++;
+ withAt = TRUE;
+ }
+
+ Int64 v;
+ if (colNameLen == sizeof(char))
+ v = *(char*)colName;
+ else if (colNameLen == sizeof(unsigned short))
+ v = *(UInt16*)colName;
+ else if (colNameLen == sizeof(Lng32))
+ v = *(ULng32*)colName;
+ else
+ v = 0;
+ if (j==0)
+ str_sprintf(buf, "%s%s%Ld",
+ colFam,
+ (withAt ? "@" : ""),
+ v);
+ else
+ str_sprintf(buf, ",%s%s%Ld",
+ colFam,
+ (withAt ? "@" : ""),
+ v);
+
+ outNAString += buf;
+
+ listOfColNames->advance();
+ } // for
+ }// trafodion tables
+ else
+ {// if hbase native tables
+ char buf[1000];
+
+ listOfColNames->position();
+ for (Lng32 j = 0; j < listOfColNames->numEntries(); j++)
+ {
+ char * currPtr = (char*)listOfColNames->getCurr();
+
+ char * colNamePtr = NULL;
+
+ Lng32 currPos = 0;
+ short colNameLen = *(short*)currPtr;
+ currPos += sizeof(short);
+ char colName[500];
+
+ for (Lng32 i = 0; i < colNameLen; i++)
+ {
+ colName[i] = currPtr[currPos];
+ currPos++;
+ }
+
+ colName[colNameLen] = 0;
+
+ colNamePtr = colName;
+
+ if (j==0)
+ str_sprintf(buf, "%s",colNamePtr);
+ else
+ str_sprintf(buf, ",%s",colNamePtr);
+
+
+ outNAString += buf;
+
+ listOfColNames->advance();
+ } // for
+
+ }// hbase native table
+ outNAString +=" ";
+}
+
+static void appendPushedDownExpression(ComTdb *tdb, NAString& outNAString){
+ // in predicate pushdown V2, the hbaseCompareOps list contains a
reverse polish set of operation, were operators are
+ // AND or OR, the rest are operands. this function display the column,
operator and replace any constant with ?. it keeps reverse polish format
+ // this can be improved in the future for better readability.
+ char buf[1000];
+ Queue* reversePolishItems = ((ComTdbHbaseAccess
*)tdb)->listOfHbaseCompareOps();
+ Queue* pushedDownColumns = ((ComTdbHbaseAccess
*)tdb)->listOfHbaseFilterColNames();
+ reversePolishItems->position();
+ pushedDownColumns->position();
+
+ for (Lng32 j = 0; j < reversePolishItems->numEntries(); j++){
+ char * currPtr = (char*)reversePolishItems->getCurr();
+ char buf2[1000];
+ if (strcmp(currPtr,"V2")!=0 && strcmp(currPtr,"AND")!=0 &&
strcmp(currPtr,"OR")!=0){//if an operand (not an operator or V2 marker), get
the column name
--- End diff --
We'll never have a column name of "V2" at this level will we? (That is, V2
is always unambiguous here?)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---