void ComTdbHbaseAccess::displayContents(Space * space,ULng32 flag) { ComTdb::displayContents(space,flag & 0xFFFFFFFE); if(flag & 0x00000008) { char buf[1000]; str_sprintf(buf, "\nFor ComTdbHbaseAccess :"); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "accessType_ = %s", (char*)getAccessTypeStr(accessType_)); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "accessDetail_ = %s", getNodeName()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); if (samplingRate_ > 0) { // str_printf does not handle %f correctly, format as string first. char sbuf[20]; snprintf(sbuf, sizeof(sbuf), "%f", samplingRate_); str_sprintf(buf, "samplingRate_ = %s", sbuf); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); } if (tableName_) { str_sprintf(buf, "tableName_ = %s", (char*)tableName_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); } str_sprintf(buf, "asciiTI_ = %d, convertTI_ = %d, rowIdTI_ = %d, returnedTI_ = %d", asciiTuppIndex_, convertTuppIndex_, rowIdTuppIndex_, returnedTuppIndex_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "rowIdAsciiTI_ = %d, updateTI_ = %d, mergeInsertTI_ = %d", rowIdAsciiTuppIndex_, updateTuppIndex_, mergeInsertTuppIndex_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "returnedFetchedTI_ = %d, returnedUpdatedTI_ = %d, mergeInsertRowIdTI_ = %d", returnedFetchedTuppIndex_, returnedUpdatedTuppIndex_, mergeInsertRowIdTuppIndex_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "hbaseTimestampTI_ = %d, hbaseVersionTI_ = %d", hbaseTimestampTuppIndex_, hbaseVersionTuppIndex_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "asciiRowLen_ = %d, convertRowLen_ = %d, rowIdLen_ = %d, outputRowLen_ = %d", asciiRowLen_, convertRowLen_, rowIdLen_, outputRowLen_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "updateRowLen_ = %d, returnFetchedRowLen_ = %d, returnUpdateedRowLen_ = %d", updateRowLen_, returnFetchedRowLen_, returnUpdatedRowLen_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "mergeInsertRowLen_ = %d, keyLen_ = %d", mergeInsertRowLen_, keyLen_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "Flag = %b",flags_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, "server_ = %s, zkPort_ = %s", server(), zkPort()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); if ((getHbaseAccessOptions()) && (getHbaseAccessOptions()->multiVersions())) { str_sprintf(buf, "numVersions = %d", getHbaseAccessOptions()->getNumVersions()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); } if (listOfFetchedColNames()) { str_sprintf(buf, "\nlistOfFetchedColNames_(numEntries = %d):\n", listOfFetchedColNames()->numEntries()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); if (sqHbaseTable()) showColNames(listOfFetchedColNames(), space); else showStrColNames(listOfFetchedColNames(), space); } if (listOfUpDeldColNames()) { str_sprintf(buf, "\nlistOfUpDeldColNames_(numEntries = %d):\n", listOfUpDeldColNames()->numEntries()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); if (sqHbaseTable()) showColNames(listOfUpDeldColNames(), space); else showStrColNames(listOfUpDeldColNames(), space); /* if (updelColnameIsStr()) showStrColNames(listOfUpDeldColNames(), space); else showColNames(listOfUpDeldColNames(), space); */ } if (0)//listOfMergedColNames()) { str_sprintf(buf, "\nlistOfMergedColNames_(numEntries = %d):\n", listOfMergedColNames()->numEntries()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); showColNames(listOfMergedColNames(), space); } if (listOfScanRows()) { str_sprintf(buf, "\nlistOfScanRows_(numEntries = %d):", listOfScanRows()->numEntries()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); listOfScanRows()->position(); for (Lng32 i = 0; i < listOfScanRows()->numEntries(); i++) { HbaseScanRows * hsr = (HbaseScanRows*)listOfScanRows()->getNext(); str_sprintf(buf, "\n Entry #%d:", i+1); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); str_sprintf(buf, " beginRowId_%s = ", (hsr->beginKeyExclusive_ ? "(excl)" : "(incl)")); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); displayRowId(space, hsr->beginRowId()); str_sprintf(buf, " endRowId_%s = ", (hsr->endKeyExclusive_ ? "(excl)" : "(incl)")); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); displayRowId(space, hsr->endRowId()); if (0) //hsr->colNames()) { str_sprintf(buf, "\n colNames_(numEntries = %d):", hsr->colNames()->numEntries()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); hsr->colNames()->position(); for (Lng32 j = 0; j < hsr->colNames()->numEntries(); j++) { str_sprintf(buf, "\n Entry #%d:", j+1); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); char * colName = (char*)hsr->colNames()->getNext(); str_sprintf(buf, " colName='%s'", colName); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); } // for } // if colNames str_sprintf(buf, "\n colTS_=%Ld", hsr->colTS_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); } // for } // if if (listOfGetRows()) { str_sprintf(buf, "\nlistOfGetRows_(numEntries = %d):", listOfGetRows()->numEntries()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); listOfGetRows()->position(); for (Lng32 i = 0; i < listOfGetRows()->numEntries(); i++) { HbaseGetRows * hgr = (HbaseGetRows*)listOfGetRows()->getNext(); str_sprintf(buf, "\n Entry #%d:", i+1); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); if (hgr->rowIds()) { str_sprintf(buf, "\n rowIds_(numEntries = %d):", hgr->rowIds()->numEntries()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); hgr->rowIds()->position(); for (Lng32 j = 0; j < hgr->rowIds()->numEntries(); j++) { str_sprintf(buf, " Entry #%d:", j+1); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); char * rowId = (char*)hgr->rowIds()->getNext(); ExpTupleDesc * asciiSourceTD = workCriDesc_->getTupleDescriptor(rowIdAsciiTuppIndex_); str_sprintf(buf, " rowId_= "); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); displayRowId(space, rowId); } // for } // if if (0) //hgr->colNames()) { str_sprintf(buf, "\n colNames_(numEntries = %d):", hgr->colNames()->numEntries()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); hgr->colNames()->position(); for (Lng32 j = 0; j < hgr->colNames()->numEntries(); j++) { str_sprintf(buf, " Entry #%d:", j+1); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); char * colName = (char*)hgr->colNames()->getNext(); str_sprintf(buf, " colName='%s'", colName); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); } // for } // if str_sprintf(buf, "\n colTS_=%Ld", hgr->colTS_); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); } // for } // if if (getHbaseSnapshotScanAttributes() && getHbaseSnapshotScanAttributes()->getUseSnapshotScan()) { str_sprintf(buf, "use_snapshot_scan = %s, snapshot_name = %s, snapshot_temp_location = %s", "TRUE", getHbaseSnapshotScanAttributes()->getSnapshotName(), getHbaseSnapshotScanAttributes()->getSnapScanTmpLocation()); space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short)); } } if(flag & 0x00000001) { displayExpression(space,flag); displayChildren(space,flag); } }
// append an ascii-version of Scan into cachewa.qryText_ void Scan::generateCacheKey(CacheWA &cwa) const { RelExpr::generateCacheKey(cwa); // Fix to 10-010618-3505, 10-010619-3515: include this Scan table's // RedefTime into cwa.qryText_ to make sure we get a cache hit only on // query that reference table(s) that have not changed since the query's // addition to the cache. The queries that reference altered table(s) // will never be hit again and will eventually age out of the cache. const NATable *tbl; if (cwa.getPhase() >= CmpMain::BIND && getTableDesc() && (tbl=getTableDesc()->getNATable()) != NULL) { char redefTime[40]; convertInt64ToAscii(tbl->getRedefTime(), redefTime); cwa += " redef:"; cwa += redefTime; if (tbl->isHiveTable()) { char lastModTime[40]; Int64 mTime = tbl->getClusteringIndex()->getHHDFSTableStats()->getModificationTS(); convertInt64ToAscii(mTime, lastModTime); cwa += " lastMod:"; cwa += lastModTime; cwa += " numFiles:"; char numFiles[20]; Int64 numberOfFiles = tbl->getClusteringIndex()->getHHDFSTableStats()->getNumFiles(); sprintf(numFiles, " %ld", numberOfFiles); cwa += numFiles ; } // save pointer to this table. later, QueryCache::addEntry will use // this pointer to get to this table's histograms's timestamp cwa.addTable( (NATable*)tbl ); // If PARTITION clause has been used we must reflect that in the key. if (tbl->isPartitionNameSpecified()) { cwa += " partition:"; cwa += tbl->getClusteringIndex()->getFileSetName().getQualifiedNameAsString().data(); } // If PARTITION range has been used we must reflect that in the key. else if (tbl->isPartitionRangeSpecified()) { cwa += " partition:"; char str[100]; sprintf(str, " from %d to %d", tbl->getExtendedQualName().getPartnClause().getBeginPartitionNumber() , tbl->getExtendedQualName().getPartnClause().getEndPartitionNumber()); cwa += str; } } // We must reflect userTableName_.location into cache key. // Otherwise, two queries which differ only in location such as // table table (table T058a, location $system.zsd12345.x1234500); // table table (table T058a, location $data .zsd12345.x1234500); // can confuse our query caching code to return a false hit and // cause fullstack/test058 to fail. cwa += userTableName_.getLocationName().data(); // Same with stream_ because queries like // "select * from t" and "select * from stream(t)" can // confuse query caching into a false hit causing test079 to fail. if (stream_) { cwa += " stream "; } // mark mpalias queries so they can be decached upon user request if (getTableDesc()->getNATable()->isAnMPTableWithAnsiName()) { cwa += AM_AN_MPALIAS_QUERY; } if (getHbaseAccessOptions()) { cwa += " hbaseVersions: "; char numVersions[20]; sprintf(numVersions, " %d", getHbaseAccessOptions()->getHbaseVersions()); cwa += numVersions ; } }