Permalink
Browse files

Revision: 16594

  • Loading branch information...
1 parent 67180a8 commit cd773000c9ef025e6a5a0a32e6ac0254f664510e @wangzhonnew wangzhonnew committed Dec 18, 2014
Showing 1,709 changed files with 322,611 additions and 25,430 deletions.
@@ -118,19 +118,16 @@ namespace engine
"malloc failed" );
hasNew = TRUE;
- // 1.parse the input objs and build the opti tree
rc = buildTree( objs, objNum, pOptiTree, pContainer->ptrTable(),
pContainer->paramTable(), pCLName );
PD_RC_CHECK( rc, PDERROR,
"failed to build the opti tree(rc=%d)",
rc );
- // 2.extend
rc = pOptiTree->extend( pExtend );
PD_RC_CHECK( rc, PDERROR,
"extend failed(rc=%d)", rc );
- // 3.optimize
{
qgmOptTree tree( pExtend );
optQgmOptimizer optimizer;
@@ -141,7 +138,6 @@ namespace engine
pExtend = tree.getRoot();
}
- // 4.build physical plan
{
qgmBuilder builder( pContainer->ptrTable(),
pContainer->paramTable() );
@@ -153,11 +149,9 @@ namespace engine
"invalid container type!" );
}
- // 5.execute
rc = pContainer->execute( cb );
PD_RC_CHECK( rc, PDERROR, "execute failed(rc=%d)", rc );
- // 6. create context
SDB_ASSERT( QGM_PLAN_TYPE_RETURN == pContainer->type(),
"invalid container type!" );
rc = createContext( pContainer, cb, contextID );
@@ -198,7 +192,6 @@ namespace engine
{
try
{
- // parse an obj, i.e:{$group:{_id: groupby, total:{$sum: "$num"}}}
BSONObj paraObj ( (const CHAR*)pDataPos );
BSONElement bePara = paraObj.firstElement();
const CHAR *pAggrOp = bePara.fieldName();
@@ -64,7 +64,6 @@ namespace engine
"failed to parse the parameter:%s(type=%d, expectType=%d)",
elem.fieldName(), elem.type(), Object );
- // 1.parse the fields
try
{
obj = elem.embeddedObject();
@@ -79,12 +78,10 @@ namespace engine
const CHAR *pFieldName = beField.fieldName();
if ( 0 == ossStrcmp( pFieldName, FIELD_NAME_GROUPBY_ID ))
{
- // process groupby field(_id)
rc = parseGroupbyField( beField, pSelect->_groupby, pTable, pCLName );
}
else
{
- // process normal field(selector)
rc = parseSelectorField( beField, pCLName, pSelect->_selector,
pTable, hasFunc );
}
@@ -104,7 +101,6 @@ namespace engine
e.what() );
}
- // 2.build the node
pSelect->_limit = -1;
pSelect->_skip = 0;
pSelect->_type = QGM_OPTI_TYPE_SELECT;
@@ -234,11 +230,9 @@ namespace engine
CHAR *pFuncBuf = NULL;
try
{
- // add select fields(note: alias, _id)
PD_CHECK( beField.type() == Object, SDB_INVALIDARG, error, PDERROR,
"failed to parse selector field, field type must be object!" );
- // parse field
const CHAR *pAlias = beField.fieldName();
BSONObj funcObj;
funcObj = beField.embeddedObject();
@@ -248,7 +242,6 @@ namespace engine
hasFunc = TRUE;
- // build selector
qgmField slValAttr;
qgmField slValRelegation;
@@ -337,7 +330,6 @@ namespace engine
paramLen += ossStrlen( &(pParam[1]) );
}
- // funcName + '(' + 'param' + ')' + '\0'
funcSize = nameLen + paramLen + 3;
pFuncBuf = ( CHAR * )SDB_OSS_MALLOC( funcSize );
PD_CHECK( pFuncBuf != NULL, SDB_OOM, error, PDERROR,
@@ -59,7 +59,6 @@ namespace engine
"failed to parse the parameter:%s(type=%d, expectType=%d)",
elem.fieldName(), elem.type(), Object );
- // 1.parse the fields
try
{
obj = elem.embeddedObject();
@@ -93,7 +92,6 @@ namespace engine
e.what() );
}
- // 2.build the node
pSelect->_limit = -1;
pSelect->_skip = 0;
pSelect->_type = QGM_OPTI_TYPE_SELECT;
@@ -191,7 +189,6 @@ namespace engine
CHAR *pFuncBuf = NULL;
try
{
- // parse field
const CHAR *pFuncName = funcObj.firstElementFieldName();
PD_CHECK( AGGR_KEYWORD_PREFIX == pFuncName[0], SDB_INVALIDARG, error, PDERROR,
"failed to parse selector field(%s), function name must begin with \"$\"",
@@ -201,11 +198,9 @@ namespace engine
"failed to parse selector field(%s), parameter must begin with \"$\"",
pFuncParam );
- // build selector
qgmField slValAttr;
qgmField slValRelegation;
- // fun(parameter), i.e:sum(a)
UINT32 nameLen = ossStrlen(&(pFuncName[1]));
UINT32 paramLen = ossStrlen(AGGR_CL_DEFAULT_ALIAS) + 1 + ossStrlen(&(pFuncParam[1]));
UINT32 curPos = 0;
@@ -321,7 +316,6 @@ namespace engine
PD_CHECK( fieldNum > 0, SDB_INVALIDARG, error, PDERROR,
"Can't add empty obj!" );
- // space for comma which between parameters
paramLen += ( fieldNum - 1 );
pFuncBuf = ( CHAR * )SDB_OSS_MALLOC( nameLen + 3 + paramLen );
PD_CHECK( pFuncBuf != NULL, SDB_OOM, error, PDERROR,
@@ -132,7 +132,6 @@ namespace engine
{
obOpField.type = SQL_GRAMMAR::DESC;
}
- //obOpField.type = beField.number() > 0 ? (SQL_GRAMMAR::ASC) : (SQL_GRAMMAR::DESC);
orderBy.push_back( obOpField );
}
}
@@ -100,7 +100,6 @@ namespace engine
}
catch ( std::exception &e )
{
- // if exception happen, let's just continue
PD_LOG ( PDWARNING, "Failed to initialize hint: %s",
e.what() ) ;
}
@@ -269,7 +268,6 @@ namespace engine
goto error ;
}
- // create index
{
BSONObjBuilder builder ;
builder.append( IXM_FIELD_NAME_KEY, BSON( SDB_AUTH_USER << 1) ) ;
Oops, something went wrong.

0 comments on commit cd77300

Please sign in to comment.