You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by selvaganesang <gi...@git.apache.org> on 2017/10/02 18:05:41 UTC
[GitHub] incubator-trafodion pull request #1250: [TRAFODION-2758] Sort operator that ...
Github user selvaganesang commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/1250#discussion_r142212229
--- Diff: core/sql/optimizer/RelExpr.cpp ---
@@ -1078,7 +1078,33 @@ void RelExpr::pushDownGenericUpdateRootOutputs( const ValueIdSet &outputs)
//QSTUFF
void RelExpr::needSortedNRows(NABoolean val)
-{
+{
+ // The operators listed below can create OR propogate a GET_N
+ // request. Other operatots will turn a GET_N request into GET_ALL
+ // There are a few exceptions like right side of NJ for semi join etc.
+ // but these are not relevant for FirstN sort
+ // This method should only in the generator since we are using
+ // physical node types.
+ OperatorTypeEnum operatorType = getOperatorType();
+ if ((operatorType != REL_FIRST_N) &&
+ (operatorType != REL_EXCHANGE) &&
+ (operatorType != REL_MERGE_UNION) &&
+ (operatorType != REL_PROBE_CACHE) &&
+ (operatorType != REL_ROOT) &&
+ (operatorType != REL_LEFT_NESTED_JOIN) &&
+ (operatorType != REL_LEFT_TSJ) &&
+ (operatorType != REL_MAP_VALUEIDS))
+ return ;
+
--- End diff --
This code looks ok. Do you think it will be easy to understand if this condition is changed to use the operators that turns GET_N request to GET_ALL? First there should be only handful operators that would turn GET_N request to GET_ALL and there is less probable to add an operator that would turn GET_N to GET_ALL
---