trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zellerh <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #1228: [TRAFODION-2733] Provide an improved...
Date Tue, 12 Sep 2017 19:13:31 GMT
Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1228#discussion_r138435157
  
    --- Diff: core/sql/generator/GenRelMisc.cpp ---
    @@ -3921,52 +3926,42 @@ double Sort::getEstimatedRunTimeOverflowSize(double memoryQuotaMB)
       return 0;
     }
     
    -CostScalar Sort::getEstimatedRunTimeMemoryUsage(NABoolean perCPU)
    +CostScalar Sort::getEstimatedRunTimeMemoryUsage(NABoolean perNode, Lng32 *numStreams)
     {
       GroupAttributes * childGroupAttr = child(0).getGroupAttr();
       Lng32 childRecordSize = 
           childGroupAttr->getCharacteristicOutputs().getRowLength();
    -  CostScalar totalMemory = getEstRowsUsed() * childRecordSize;
    +  CostScalar rowsUsed;
    +  if (sortNRows() && (topNRows_ > 0)
    +            && (topNRows_ <= getDefault(GEN_SORT_TOPN_THRESHOLD)))
    +     rowsUsed = topNRows_; 
    +  else
    +     rowsUsed = getEstRowsUsed();
    +  CostScalar totalMemory = rowsUsed * childRecordSize;
     
    -  if ( perCPU == TRUE ) {
    -    const PhysicalProperty* const phyProp = getPhysicalProperty();
    -    if (phyProp != NULL)
    -    {
    -      PartitioningFunction * partFunc = phyProp -> getPartitioningFunction() ;
    -      totalMemory /= partFunc->getCountOfPartitions();
    -    }
    +  Lng32 numOfStreams = 1;
    +  const PhysicalProperty* const phyProp = getPhysicalProperty();
    +  if (phyProp != NULL)
    +  {
    +     PartitioningFunction * partFunc = phyProp -> getPartitioningFunction() ;
    +     numOfStreams = partFunc->getCountOfPartitions();
    +     if (numOfStreams <= 0)
    +        numOfStreams = 1;
       }
    -
    +  if (numStreams != NULL)
    +     *numStreams = numOfStreams;
    +  if ( perNode == TRUE ) 
    +      totalMemory /= MINOF(MAXOF(((NAClusterInfoLinux*)gpClusterInfo)->getTotalNumberOfCPUs(),
1), numOfStreams);
    --- End diff --
    
    Same two comments again.


---

Mime
View raw message