@Test public void testSubQueryProjectValidation() { String query = "ApplicationService[@name =~\"srp.*\" " + "and " + "(@services =& ServiceInstance[@_oid=\"4fbb314fc681caf13e283a7c\" " + "and " + "@runsOn =& Compute[@name=\"compute-00002\"]]{@_oid, @name}" + ") " + "]"; try { getTranslator(raptorContext).translate(raptorParser.parse(query)); Assert.fail(); } catch (QueryParseException e) { Assert.assertEquals(QueryErrCodeEnum.IILEGAL_PROJECTION.getErrorCode(), e.getErrorCode()); } }
public QueryExecPlan translate(ParseBaseNode rootNode) { QueryExecPlan execPlan = new QueryExecPlan(); rewriteParseTree(rootNode, null); rewriteProjection(rootNode); nodeIndex = 0; rootAction = translateParseTree(rootNode, execPlan); checkTooManyCollectionsQuery(execPlan); rewriteRootAction(execPlan); if (hasEmbed) { constructEmbedContainer(); } execPlan.setRootAction(rootAction); execPlan.setRootNode(rootNode); if (execPlan.getAggAction() != null) { if (rootAction.getChildrenActions().isEmpty()) { AggregateAction aggAction = (AggregateAction)execPlan.getAggAction(); aggAction.setOneTableAggregation(true); } if (queryContext.isCountOnly()) { throw new QueryParseException(QueryErrCodeEnum.AGG_COUNT_NOT_SUPPORT, "Aggregation query does not support count mode!"); } } return execPlan; }
QueryTranslator { public QueryExecPlan translate(ParseBaseNode rootNode) { QueryExecPlan execPlan = new QueryExecPlan(); rewriteParseTree(rootNode, null); rewriteProjection(rootNode); nodeIndex = 0; rootAction = translateParseTree(rootNode, execPlan); checkTooManyCollectionsQuery(execPlan); rewriteRootAction(execPlan); if (hasEmbed) { constructEmbedContainer(); } execPlan.setRootAction(rootAction); execPlan.setRootNode(rootNode); if (execPlan.getAggAction() != null) { if (rootAction.getChildrenActions().isEmpty()) { AggregateAction aggAction = (AggregateAction)execPlan.getAggAction(); aggAction.setOneTableAggregation(true); } if (queryContext.isCountOnly()) { throw new QueryParseException(QueryErrCodeEnum.AGG_COUNT_NOT_SUPPORT, "Aggregation query does not support count mode!"); } } return execPlan; } }
QueryTranslator { public QueryExecPlan translate(ParseBaseNode rootNode) { QueryExecPlan execPlan = new QueryExecPlan(); rewriteParseTree(rootNode, null); rewriteProjection(rootNode); nodeIndex = 0; rootAction = translateParseTree(rootNode, execPlan); checkTooManyCollectionsQuery(execPlan); rewriteRootAction(execPlan); if (hasEmbed) { constructEmbedContainer(); } execPlan.setRootAction(rootAction); execPlan.setRootNode(rootNode); if (execPlan.getAggAction() != null) { if (rootAction.getChildrenActions().isEmpty()) { AggregateAction aggAction = (AggregateAction)execPlan.getAggAction(); aggAction.setOneTableAggregation(true); } if (queryContext.isCountOnly()) { throw new QueryParseException(QueryErrCodeEnum.AGG_COUNT_NOT_SUPPORT, "Aggregation query does not support count mode!"); } } return execPlan; } QueryTranslator(QueryContext context); }
QueryTranslator { public QueryExecPlan translate(ParseBaseNode rootNode) { QueryExecPlan execPlan = new QueryExecPlan(); rewriteParseTree(rootNode, null); rewriteProjection(rootNode); nodeIndex = 0; rootAction = translateParseTree(rootNode, execPlan); checkTooManyCollectionsQuery(execPlan); rewriteRootAction(execPlan); if (hasEmbed) { constructEmbedContainer(); } execPlan.setRootAction(rootAction); execPlan.setRootNode(rootNode); if (execPlan.getAggAction() != null) { if (rootAction.getChildrenActions().isEmpty()) { AggregateAction aggAction = (AggregateAction)execPlan.getAggAction(); aggAction.setOneTableAggregation(true); } if (queryContext.isCountOnly()) { throw new QueryParseException(QueryErrCodeEnum.AGG_COUNT_NOT_SUPPORT, "Aggregation query does not support count mode!"); } } return execPlan; } QueryTranslator(QueryContext context); QueryExecPlan translate(ParseBaseNode rootNode); }
QueryTranslator { public QueryExecPlan translate(ParseBaseNode rootNode) { QueryExecPlan execPlan = new QueryExecPlan(); rewriteParseTree(rootNode, null); rewriteProjection(rootNode); nodeIndex = 0; rootAction = translateParseTree(rootNode, execPlan); checkTooManyCollectionsQuery(execPlan); rewriteRootAction(execPlan); if (hasEmbed) { constructEmbedContainer(); } execPlan.setRootAction(rootAction); execPlan.setRootNode(rootNode); if (execPlan.getAggAction() != null) { if (rootAction.getChildrenActions().isEmpty()) { AggregateAction aggAction = (AggregateAction)execPlan.getAggAction(); aggAction.setOneTableAggregation(true); } if (queryContext.isCountOnly()) { throw new QueryParseException(QueryErrCodeEnum.AGG_COUNT_NOT_SUPPORT, "Aggregation query does not support count mode!"); } } return execPlan; } QueryTranslator(QueryContext context); QueryExecPlan translate(ParseBaseNode rootNode);  }