OmniSciDB  04ee39c94c
SpeculativeTopN.h File Reference

Speculative top N algorithm. More...

#include <cstddef>
#include <cstdint>
#include <memory>
#include <stdexcept>
#include <unordered_map>
#include <vector>
+ Include dependency graph for SpeculativeTopN.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SpeculativeTopNVal
 
struct  SpeculativeTopNEntry
 
class  SpeculativeTopNMap
 
class  SpeculativeTopNFailed
 
class  SpeculativeTopNBlacklist
 

Namespaces

 Analyzer
 

Functions

bool use_speculative_top_n (const RelAlgExecutionUnit &, const QueryMemoryDescriptor &)
 

Detailed Description

Speculative top N algorithm.

Author
Alex Suhan alex@.nosp@m.mapd.nosp@m..com Copyright (c) 2016 MapD Technologies, Inc. All rights reserved.

Definition in file SpeculativeTopN.h.

Function Documentation

◆ use_speculative_top_n()

bool use_speculative_top_n ( const RelAlgExecutionUnit ,
const QueryMemoryDescriptor  
)

Definition at line 164 of file SpeculativeTopN.cpp.

References SortInfo::algorithm, g_cluster, kCOUNT, SortInfo::limit, RelAlgExecutionUnit::sort_info, QueryMemoryDescriptor::sortOnGpu(), SpeculativeTopN, and RelAlgExecutionUnit::target_exprs.

Referenced by Executor::collectAllDeviceResults(), RelAlgExecutor::executeSort(), and QueryExecutionContext::launchGpuCode().

165  {
166  if (g_cluster) {
167  return false;
168  }
169  if (ra_exe_unit.target_exprs.size() != 2) {
170  return false;
171  }
172  for (const auto target_expr : ra_exe_unit.target_exprs) {
173  const auto agg_expr = dynamic_cast<const Analyzer::AggExpr*>(target_expr);
174  if (agg_expr && agg_expr->get_aggtype() != kCOUNT) {
175  return false;
176  }
177  }
178  return query_mem_desc.sortOnGpu() && ra_exe_unit.sort_info.limit &&
179  ra_exe_unit.sort_info.algorithm == SortAlgorithm::SpeculativeTopN;
180 }
Definition: sqldefs.h:71
bool g_cluster
+ Here is the call graph for this function:
+ Here is the caller graph for this function: