OmniSciDB  a667adc9c8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{SerializeToSql.cpp} Namespace Reference

Functions

std::string agg_to_string (const Analyzer::AggExpr *agg_expr, const RelAlgExecutionUnit *ra_exe_unit, const Catalog_Namespace::Catalog *catalog)
 
std::string where_to_string (const RelAlgExecutionUnit *ra_exe_unit, const Catalog_Namespace::Catalog *catalog)
 
std::string join_condition_to_string (const RelAlgExecutionUnit *ra_exe_unit, const Catalog_Namespace::Catalog *catalog)
 
std::string targets_to_string (const RelAlgExecutionUnit *ra_exe_unit, const Catalog_Namespace::Catalog *catalog)
 
std::string group_by_to_string (const RelAlgExecutionUnit *ra_exe_unit, const Catalog_Namespace::Catalog *catalog)
 
std::string from_to_string (const RelAlgExecutionUnit *ra_exe_unit, const Catalog_Namespace::Catalog *catalog)
 
std::string maybe (const std::string &prefix, const std::string &clause)
 

Function Documentation

std::string anonymous_namespace{SerializeToSql.cpp}::agg_to_string ( const Analyzer::AggExpr agg_expr,
const RelAlgExecutionUnit ra_exe_unit,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 119 of file SerializeToSql.cpp.

References Analyzer::AggExpr::get_aggtype(), Analyzer::AggExpr::get_arg(), Analyzer::AggExpr::get_is_distinct(), toString(), and ScalarExprVisitor< T >::visit().

Referenced by ScalarExprToSql::visitAggExpr().

121  {
122  ScalarExprToSql scalar_expr_to_sql(ra_exe_unit, catalog);
123  const auto agg_type = ::toString(agg_expr->get_aggtype());
124  const auto arg =
125  agg_expr->get_arg() ? scalar_expr_to_sql.visit(agg_expr->get_arg()) : "*";
126  const auto distinct = agg_expr->get_is_distinct() ? "DISTINCT " : "";
127  return agg_type + "(" + distinct + arg + ")";
128 }
std::string toString(const ExtArgumentType &sig_type)
Expr * get_arg() const
Definition: Analyzer.h:1096
bool get_is_distinct() const
Definition: Analyzer.h:1098
SQLAgg get_aggtype() const
Definition: Analyzer.h:1095

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string anonymous_namespace{SerializeToSql.cpp}::from_to_string ( const RelAlgExecutionUnit ra_exe_unit,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 278 of file SerializeToSql.cpp.

References RelAlgExecutionUnit::input_descs, join(), and serialize_table_ref().

Referenced by serialize_to_sql().

279  {
280  std::vector<std::string> from_strings;
281  for (const auto& input_desc : ra_exe_unit->input_descs) {
282  const auto table_ref = serialize_table_ref(input_desc.getTableId(), catalog);
283  from_strings.push_back(table_ref);
284  }
285  return boost::algorithm::join(from_strings, ", ");
286 }
std::string join(T const &container, std::string const &delim)
std::vector< InputDescriptor > input_descs
std::string serialize_table_ref(const int table_id, const Catalog_Namespace::Catalog *catalog)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string anonymous_namespace{SerializeToSql.cpp}::group_by_to_string ( const RelAlgExecutionUnit ra_exe_unit,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 268 of file SerializeToSql.cpp.

References RelAlgExecutionUnit::groupby_exprs, join(), and ScalarExprToSql::visitList().

Referenced by serialize_to_sql().

269  {
270  if (ra_exe_unit->groupby_exprs.size() == 1 || !ra_exe_unit->groupby_exprs.front()) {
271  return "";
272  }
273  ScalarExprToSql scalar_expr_to_sql(ra_exe_unit, catalog);
274  const auto group_by_strings = scalar_expr_to_sql.visitList(ra_exe_unit->groupby_exprs);
275  return boost::algorithm::join(group_by_strings, ", ");
276 }
std::string join(T const &container, std::string const &delim)
const std::list< std::shared_ptr< Analyzer::Expr > > groupby_exprs

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string anonymous_namespace{SerializeToSql.cpp}::join_condition_to_string ( const RelAlgExecutionUnit ra_exe_unit,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 246 of file SerializeToSql.cpp.

References join(), RelAlgExecutionUnit::join_quals, and ScalarExprToSql::visitList().

Referenced by serialize_to_sql().

247  {
248  ScalarExprToSql scalar_expr_to_sql(ra_exe_unit, catalog);
249  std::vector<std::string> qual_strings;
250  for (const auto& join_level_quals : ra_exe_unit->join_quals) {
251  const auto level_qual_strings = scalar_expr_to_sql.visitList(join_level_quals.quals);
252  qual_strings.insert(
253  qual_strings.end(), level_qual_strings.begin(), level_qual_strings.end());
254  }
255  return boost::algorithm::join(qual_strings, " AND ");
256 }
std::string join(T const &container, std::string const &delim)
const JoinQualsPerNestingLevel join_quals

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string anonymous_namespace{SerializeToSql.cpp}::maybe ( const std::string &  prefix,
const std::string &  clause 
)

Definition at line 288 of file SerializeToSql.cpp.

Referenced by serialize_to_sql().

288  {
289  return clause.empty() ? "" : " " + prefix + " " + clause;
290 }

+ Here is the caller graph for this function:

std::string anonymous_namespace{SerializeToSql.cpp}::targets_to_string ( const RelAlgExecutionUnit ra_exe_unit,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 258 of file SerializeToSql.cpp.

References join(), RelAlgExecutionUnit::target_exprs, and ScalarExprVisitor< T >::visit().

Referenced by serialize_to_sql().

259  {
260  ScalarExprToSql scalar_expr_to_sql(ra_exe_unit, catalog);
261  std::vector<std::string> target_strings;
262  for (const auto target : ra_exe_unit->target_exprs) {
263  target_strings.push_back(scalar_expr_to_sql.visit(target));
264  }
265  return boost::algorithm::join(target_strings, ", ");
266 }
std::vector< Analyzer::Expr * > target_exprs
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string anonymous_namespace{SerializeToSql.cpp}::where_to_string ( const RelAlgExecutionUnit ra_exe_unit,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 235 of file SerializeToSql.cpp.

References join(), RelAlgExecutionUnit::quals, RelAlgExecutionUnit::simple_quals, and ScalarExprToSql::visitList().

Referenced by serialize_to_sql().

236  {
237  ScalarExprToSql scalar_expr_to_sql(ra_exe_unit, catalog);
238  auto qual_strings = scalar_expr_to_sql.visitList(ra_exe_unit->quals);
239  const auto simple_qual_strings =
240  scalar_expr_to_sql.visitList(ra_exe_unit->simple_quals);
241  qual_strings.insert(
242  qual_strings.end(), simple_qual_strings.begin(), simple_qual_strings.end());
243  return boost::algorithm::join(qual_strings, " AND ");
244 }
std::string join(T const &container, std::string const &delim)
std::list< std::shared_ptr< Analyzer::Expr > > quals
std::list< std::shared_ptr< Analyzer::Expr > > simple_quals

+ Here is the call graph for this function:

+ Here is the caller graph for this function: