OmniSciDB  85c2d10cdc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StringTransform.h File Reference
#include <boost/config.hpp>
#include <boost/regex.hpp>
#include <optional>
#include <string_view>
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
+ Include dependency graph for StringTransform.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 anonymous_namespace{StringTransform.h}
 

Functions

void apply_shim (std::string &result, const boost::regex &reg_expr, const std::function< void(std::string &, const boost::smatch &)> &shim_fn)
 
template<typename... Ts>
std::string cat (Ts &&...args)
 
std::vector< std::pair< size_t,
size_t > > 
find_string_literals (const std::string &query)
 
std::string hide_sensitive_data_from_query (std::string const &query_str)
 
std::optional< size_t > inside_string_literal (const size_t start, const size_t length, const std::vector< std::pair< size_t, size_t >> &literal_positions)
 
template<typename T >
std::string join (T const &container, std::string const &delim)
 
template<typename T >
std::string to_string (T &&v)
 
template<>
std::string to_string (char const *&&v)
 
template<>
std::string to_string (std::string &&v)
 
std::string to_upper (const std::string &str)
 
std::string to_lower (const std::string &str)
 
std::string generate_random_string (const size_t len)
 
std::vector< std::string > split (std::string_view str, std::string_view delim={}, std::optional< size_t > maxsplit=std::nullopt)
 split apart a string into a vector of substrings More...
 
std::string strip (std::string_view str)
 trim any whitespace from the left and right ends of a string More...
 
bool remove_unquoted_newlines_linefeeds_and_tabs_from_sql_string (std::string &str) noexcept
 sanitize an SQL string More...
 
std::string simple_sanitize (const std::string &str)
 simple sanitize string (replace control characters with space) More...
 
std::string get_quoted_string (const std::string &filename, char quote= '"', char escape = '\\')
 Quote a string while escaping any existing quotes in the string. More...
 
template<typename T >
decltype(auto) anonymous_namespace{StringTransform.h}::stringlike (T &&parm)
 
template<typename... Types>
std::string concat (Types &&...parms)
 
template<typename... Types>
std::string concat_with (std::string_view with, Types &&...parms)
 

Function Documentation

void apply_shim ( std::string &  result,
const boost::regex &  reg_expr,
const std::function< void(std::string &, const boost::smatch &)> &  shim_fn 
)

Definition at line 29 of file StringTransform.cpp.

References find_string_literals(), and inside_string_literal().

Referenced by QueryRunner::apply_copy_to_shim(), DBHandler::apply_copy_to_shim(), and anonymous_namespace{CalciteAdapter.cpp}::pg_shim_impl().

31  {
32  boost::smatch what;
33  std::vector<std::pair<size_t, size_t>> lit_pos = find_string_literals(result);
34  auto start_it = result.cbegin();
35  auto end_it = result.cend();
36  while (true) {
37  if (!boost::regex_search(start_it, end_it, what, reg_expr)) {
38  break;
39  }
40  const auto next_start =
41  inside_string_literal(what.position(), what.length(), lit_pos);
42  if (next_start) {
43  start_it = result.cbegin() + *next_start;
44  } else {
45  shim_fn(result, what);
46  lit_pos = find_string_literals(result);
47  start_it = result.cbegin();
48  end_it = result.cend();
49  }
50  }
51 }
std::vector< std::pair< size_t, size_t > > find_string_literals(const std::string &query)
std::optional< size_t > inside_string_literal(const size_t start, const size_t length, const std::vector< std::pair< size_t, size_t >> &literal_positions)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename... Ts>
std::string cat ( Ts &&...  args)

Definition at line 40 of file StringTransform.h.

References run_benchmark_import::args.

Referenced by AlterForeignTableCommand::alterOptions(), AlterForeignServerCommand::changeForeignServerOwner(), DBHandler::check_table_load_privileges(), Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), DBHandler::checkpoint(), DBHandler::clone_session(), anonymous_namespace{InputMetadata.cpp}::collect_table_infos(), QueryCompilationDescriptor::compile(), DBHandler::connect(), Fragmenter_Namespace::copyDataOfShard(), DBHandler::create_dashboard(), DBHandler::create_link(), Catalog_Namespace::SysCatalog::createDatabase(), dateTimeParse(), DBHandler::delete_dashboards(), anonymous_namespace{RelAlgExecutor.cpp}::do_table_reordering(), Catalog_Namespace::SysCatalog::dropDatabase(), RefreshForeignTablesCommand::execute(), DBHandler::execute_rel_alg(), DBHandler::execute_rel_alg_df(), anonymous_namespace{GroupByAndAggregate.cpp}::expr_is_rowid(), Executor::fetchChunks(), Executor::fetchUnionChunks(), DBHandler::get_dashboard(), DBHandler::get_dashboard_grantees(), DBHandler::get_dashboard_impl(), DBHandler::get_dashboards(), DBHandler::get_db_object_privs(), DBHandler::get_link_view(), DBHandler::get_table_details_impl(), DBHandler::get_table_epoch(), DBHandler::get_table_epoch_by_name(), DBHandler::get_table_epochs(), DBHandler::get_tables_meta_impl(), DBHandler::get_valid_groups(), Catalog_Namespace::SysCatalog::getCatalog(), Calcite::getCompletionHints(), QueryRunner::QueryRunner::getLoader(), ColumnFetcher::getOneTableColumnFragment(), QueryRunner::QueryRunner::getParsedQueryHint(), lockmgr::TableLockMgrImpl< TableDataLockMgr >::getReadLockForTable(), InputTableInfoCache::getTableInfo(), lockmgr::TableLockMgrImpl< TableDataLockMgr >::getWriteLockForTable(), DBHandler::has_object_privilege(), DBHandler::hasTableAccessPrivileges(), DBHandler::import_geo_table(), DBHandler::import_table(), QueryRunner::ImportDriver::importGeoTable(), DBHandler::insert_data(), Fragmenter_Namespace::InsertDataLoader::insertData(), DBHandler::internal_connect(), DBHandler::interrupt(), ColumnFetcher::linearizeColumnFragments(), main(), migrations::MigrationMgr::migrateDateInDaysMetadata(), normalize_column_pair(), normalize_column_pairs(), DBHandler::parse_to_ra(), DBHandler::prepare_loader_generic(), Calcite::processImpl(), QueryRunner::QueryRunner::QueryRunner(), AlterForeignTableCommand::renameColumn(), AlterForeignServerCommand::renameForeignServer(), AlterForeignTableCommand::renameTable(), DBHandler::replace_dashboard(), QueryRewriter::rewriteColumnarUpdate(), QueryRunner::anonymous_namespace{QueryRunner.cpp}::run_select_query_with_filter_push_down(), QueryRunner::QueryRunner::runSelectQuery(), QueryRunner::QueryRunner::runSQLWithAllowingInterrupt(), import_export::RenderGroupAnalyzer::seedFromExistingTableContents(), DBHandler::set_table_epoch(), DBHandler::set_table_epoch_by_name(), DBHandler::set_table_epochs(), AlterForeignServerCommand::setForeignServerDataWrapper(), AlterForeignServerCommand::setForeignServerOptions(), DBHandler::sql_execute_impl(), DBHandler::switch_database(), Catalog_Namespace::SysCatalog::switchDatabase(), anonymous_namespace{QueryMemoryDescriptor.cpp}::target_expr_proj_indices(), RexAbstractInput::toString(), RexLiteral::toString(), RexOperator::toString(), RexSubQuery::toString(), RexInput::toString(), RexCase::toString(), RexFunctionOperator::toString(), SortField::toString(), RexWindowFunctionOperator::toString(), RexRef::toString(), RexAgg::toString(), RelScan::toString(), RelProject::toString(), RelAggregate::toString(), RelJoin::toString(), RelFilter::toString(), RelCompound::toString(), RelSort::toString(), RelModify::toString(), RelTableFunction::toString(), RelLogicalUnion::toString(), anonymous_namespace{RelAlgExecutor.cpp}::translate_scalar_sources_for_update(), DateTimeParser::updateDateTimeAndStr(), DBHandler::user_can_access_table(), and DBHandler::validateDashboardIdsForSharing().

40  {
41  std::ostringstream oss;
42  (oss << ... << std::forward<Ts>(args));
43  return oss.str();
44 }
template<typename... Types>
std::string concat ( Types &&...  parms)

Definition at line 168 of file StringTransform.h.

References File_Namespace::append(), generate_TableFunctionsFactory_init::j, and anonymous_namespace{StringTransform.h}::stringlike().

Referenced by SQLTypeInfo::to_string().

168  {
169  struct Joiner {
170  Joiner() {}
171 
172  std::string txt;
173 
174  void append(std::string_view moretxt) { txt += moretxt; }
175  }; // struct Joiner
176  Joiner j{};
177  (j.append(stringlike(std::forward<Types>(parms))), ...);
178  return std::move(j.txt);
179 }
size_t append(FILE *f, const size_t size, int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename... Types>
std::string concat_with ( std::string_view  with,
Types &&...  parms 
)

Definition at line 182 of file StringTransform.h.

References File_Namespace::append(), generate_TableFunctionsFactory_init::j, join(), and anonymous_namespace{StringTransform.h}::stringlike().

182  {
183  struct JoinerWith {
184  JoinerWith(std::string_view join) : join(join), first(true) {}
185 
186  std::string_view join;
187  bool first;
188  std::string txt;
189 
190  void append(std::string_view moretxt) {
191  if (!first) {
192  txt += join;
193  } else {
194  first = false;
195  }
196  txt += moretxt;
197  }
198  }; // struct JoinerWith
199  JoinerWith j{with};
200  (j.append(stringlike(std::forward<Types>(parms))), ...);
201  return std::move(j.txt);
202 }
std::string join(T const &container, std::string const &delim)
size_t append(FILE *f, const size_t size, int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:159
bool g_enable_smem_group_by true

+ Here is the call graph for this function:

std::vector<std::pair<size_t, size_t> > find_string_literals ( const std::string &  query)

Definition at line 53 of file StringTransform.cpp.

References CHECK_GT.

Referenced by apply_shim().

53  {
54  boost::regex literal_string_regex{R"(([^']+)('(?:[^']+|'')+'))", boost::regex::perl};
55  boost::smatch what;
56  auto it = query.begin();
57  auto prev_it = it;
58  std::vector<std::pair<size_t, size_t>> positions;
59  while (true) {
60  if (!boost::regex_search(it, query.end(), what, literal_string_regex)) {
61  break;
62  }
63  CHECK_GT(what[1].length(), 0);
64  prev_it = it;
65  it += what.length();
66  positions.emplace_back(prev_it + what[1].length() - query.begin(),
67  it - query.begin());
68  }
69  return positions;
70 }
#define CHECK_GT(x, y)
Definition: Logger.h:209

+ Here is the caller graph for this function:

std::string generate_random_string ( const size_t  len)

Definition at line 95 of file StringTransform.cpp.

References i.

Referenced by DBHandler::create_new_session(), DBHandler::createInMemoryCalciteSession(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), and Catalog_Namespace::SysCatalog::updateBlankPasswordsToRandom().

95  {
96  static char charset[] =
97  "0123456789"
98  "abcdefghijklmnopqrstuvwxyz"
99  "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
100 
101  static std::mt19937 prng{std::random_device{}()};
102  static std::uniform_int_distribution<size_t> dist(0, strlen(charset) - 1);
103 
104  std::string str;
105  str.reserve(len);
106  for (size_t i = 0; i < len; i++) {
107  str += charset[dist(prng)];
108  }
109  return str;
110 }

+ Here is the caller graph for this function:

std::string get_quoted_string ( const std::string &  filename,
char  quote = '"',
char  escape = '\\' 
)

Quote a string while escaping any existing quotes in the string.

Definition at line 229 of file StringTransform.cpp.

Referenced by TableArchiver::dumpTable(), Catalog_Namespace::Catalog::quoteIfRequired(), TableArchiver::restoreTable(), and anonymous_namespace{TableArchiver.cpp}::simple_file_cat().

229  {
230  std::stringstream ss;
231  ss << std::quoted(filename, quote, escape); // TODO: prevents string_view Jun 2020
232  return ss.str();
233 }
std::string filename(char const *path)
Definition: Logger.cpp:62

+ Here is the caller graph for this function:

std::string hide_sensitive_data_from_query ( std::string const query_str)

Definition at line 72 of file StringTransform.cpp.

References gpu_enabled::accumulate().

Referenced by query_state::StdLog::log().

72  {
73  constexpr std::regex::flag_type flags =
74  std::regex::ECMAScript | std::regex::icase | std::regex::optimize;
75  static const std::initializer_list<std::pair<std::regex, std::string>> rules{
76  {std::regex(R"(\b((?:password|s3_access_key|s3_secret_key)\s*=\s*)'.+?')", flags),
77  "$1'XXXXXXXX'"},
78  {std::regex(R"((\\set_license\s+)\S+)", flags), "$1XXXXXXXX"}};
79  return std::accumulate(
80  rules.begin(), rules.end(), query_str, [](auto& str, auto& rule) {
81  return std::regex_replace(str, rule.first, rule.second);
82  });
83 }
DEVICE auto accumulate(ARGS &&...args)
Definition: gpu_enabled.h:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::optional<size_t> inside_string_literal ( const size_t  start,
const size_t  length,
const std::vector< std::pair< size_t, size_t >> &  literal_positions 
)

Definition at line 174 of file StringTransform.cpp.

Referenced by apply_shim().

177  {
178  const auto end = start + length;
179  for (const auto& literal_position : literal_positions) {
180  if (literal_position.first <= start && end <= literal_position.second) {
181  return literal_position.second;
182  }
183  }
184  return std::nullopt;
185 }

+ Here is the caller graph for this function:

template<typename T >
std::string join ( T const container,
std::string const delim 
)

Definition at line 60 of file StringTransform.h.

Referenced by omnisci.thrift.ttypes.TOmniSciException::__repr__(), ResultSetReductionJIT::cacheKey(), anonymous_namespace{Execute.cpp}::checkWorkUnitWatchdog(), concat_with(), DBHandler::connect_impl(), org.apache.calcite.sql2rel.SqlToRelConverter::convertFrom(), org.apache.calcite.sql2rel.SqlToRelConverter::convertMerge(), anonymous_namespace{RelLeftDeepInnerJoin.cpp}::create_left_deep_join(), DBHandler::create_table(), datum_to_string(), Catalog_Namespace::Catalog::dumpCreateTable(), Catalog_Namespace::Catalog::dumpSchema(), TableArchiver::dumpTable(), RelAlgExecutor::executeRelAlgQueryNoRetry(), ProxyTHttpClient::flush(), anonymous_namespace{SerializeToSql.cpp}::from_to_string(), tests.conftest::gen_string(), generate_loop_ref::generate(), create_table.SyntheticTable::generateData(), anonymous_namespace{RelAlgExecutor.cpp}::get_data_sink(), anonymous_namespace{RelAlgOptimizer.cpp}::get_field_name(), anonymous_namespace{RelAlgExecutor.cpp}::get_join_source_used_inputs(), anonymous_namespace{RelAlgExecutor.cpp}::get_join_type(), get_left_deep_join_root(), anonymous_namespace{RelAlgOptimizer.cpp}::get_live_ins(), run_benchmark::get_machine_info(), get_qualified_column_hints(), anonymous_namespace{RelAlgOptimizer.cpp}::get_visible_projects(), ExtensionFunctionsWhitelist::getLLVMDeclarations(), anonymous_namespace{SerializeToSql.cpp}::group_by_to_string(), hoist_filter_cond_to_cross_join(), QueryRunner::ImportDriver::importGeoTable(), anonymous_namespace{RelAlgDagBuilder.cpp}::isRenamedInput(), anonymous_namespace{SerializeToSql.cpp}::join_condition_to_string(), make-m2-proxy::make_settings(), org.apache.calcite.rel.rules.DynamicFilterJoinRule::onMatch(), org.apache.calcite.rel.rules.OuterJoinOptViaNullRejectionRule::onMatch(), operator<<(), org.apache.calcite.rel.rules.DynamicFilterJoinRule::performSelectivePushDown(), anonymous_namespace{RelAlgOptimizer.cpp}::pick_always_live_col_idx(), anonymous_namespace{RelAlgOptimizer.cpp}::propagate_input_renumbering(), anonymous_namespace{RelAlgOptimizer.cpp}::redirect_inputs_of(), QueryMemoryDescriptor::reductionKey(), org.apache.calcite.sql2rel.SqlToRelConverter.Blackboard::register(), TableArchiver::restoreTable(), com.mapd.calcite.parser.MapDParser::rewriteSimpleUpdateAsSelect(), make-m2-proxy::simple_xml(), sink_projected_boolean_expr_to_join(), start_calcite_server_as_daemon(), org.apache.calcite.sql2rel.SqlToRelConverter::substituteSubQuery(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), anonymous_namespace{SerializeToSql.cpp}::targets_to_string(), org.apache.calcite.sql2rel.SqlToRelConverter::translateIn(), DBHandler::validateDashboardIdsForSharing(), foreign_storage::ForeignDataWrapperFactory::validateDataWrapperType(), foreign_storage::AbstractFileStorageDataWrapper::validateServerOptions(), RelAlgVisitor< std::unordered_set< int > >::visit(), ScalarExprToSql::visitFunctionOper(), anonymous_namespace{RelAlgOptimizer.cpp}::RexProjectInputRedirector::visitInput(), anonymous_namespace{RelAlgOptimizer.cpp}::RexInputCollector::visitInput(), anonymous_namespace{RelAlgOptimizer.cpp}::RexInputRedirector::visitInput(), ScalarExprToSql::visitInValues(), anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor::visitNode(), ScalarExprToSql::visitWindowFunction(), anonymous_namespace{ExternalExecutor.cpp}::vt_create(), and anonymous_namespace{SerializeToSql.cpp}::where_to_string().

60  {
61  std::stringstream ss;
62  if (!container.empty()) {
63  ss << *container.cbegin();
64  for (auto itr = std::next(container.cbegin()); itr != container.cend(); ++itr) {
65  ss << delim << *itr;
66  }
67  }
68  return ss.str();
69 }
bool remove_unquoted_newlines_linefeeds_and_tabs_from_sql_string ( std::string &  str)
noexcept

sanitize an SQL string

Definition at line 189 of file StringTransform.cpp.

190  {
191  char inside_quote = 0;
192  bool previous_c_was_backslash = false;
193  for (auto& c : str) {
194  // if this character is a quote of either type
195  if (c == '\'' || c == '\"') {
196  // ignore if previous character was a backslash
197  if (!previous_c_was_backslash) {
198  // start or end of a quoted region
199  if (inside_quote == c) {
200  // end region
201  inside_quote = 0;
202  } else if (inside_quote == 0) {
203  // start region
204  inside_quote = c;
205  }
206  }
207  } else if (inside_quote == 0) {
208  // outside quoted region
209  if (c == '\n' || c == '\t' || c == '\r') {
210  // replace these with space
211  c = ' ';
212  }
213  // otherwise leave alone, including quotes of a different type
214  }
215  // handle backslashes, except for double backslashes
216  if (c == '\\') {
217  previous_c_was_backslash = !previous_c_was_backslash;
218  } else {
219  previous_c_was_backslash = false;
220  }
221  }
222  // if we didn't end a region, there were unclosed or mixed-nested quotes
223  // accounting for backslashes should mean that this should only be the
224  // case with truly malformed strings which Calcite will barf on anyway
225  return (inside_quote == 0);
226 }
std::string simple_sanitize ( const std::string &  str)

simple sanitize string (replace control characters with space)

Definition at line 237 of file StringTransform.cpp.

237  {
238  auto sanitized_str{str};
239  for (auto& c : sanitized_str) {
240  c = (c < 32) ? ' ' : c;
241  }
242  return sanitized_str;
243 }
std::vector<std::string> split ( std::string_view  str,
std::string_view  delim = {},
std::optional< size_t >  maxsplit = std::nullopt 
)

split apart a string into a vector of substrings

Definition at line 116 of file StringTransform.cpp.

References i, generate_TableFunctionsFactory_init::j, and run_benchmark_import::result.

Referenced by anonymous_namespace{TableArchiver.cpp}::adjust_altered_table_files(), create_table.SyntheticTable::createDataAndImportTable(), com.omnisci.jdbc.OmniSciStatement::executeQuery(), anonymous_namespace{DBHandler.cpp}::extract_projection_tokens_for_completion(), get_qualified_column_hints(), AutomaticIRMetadataGuard::makeBaseFilename(), AutomaticIRMetadataGuard::makeQueryEngineFilename(), TrackingProcessor::process(), Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), run_benchmark::read_query_files(), TableArchiver::restoreTable(), QueryRunner::QueryRunner::runMultipleStatements(), Parser::splitObjectHierName(), com.mapd.parser.server.ExtensionFunctionSignatureParser::toSignature(), and generate_TableFunctionsFactory_init::type_parse().

118  {
119  std::vector<std::string> result;
120 
121  // Use an explicit delimiter.
122  if (!delim.empty()) {
123  std::string::size_type i = 0, j = 0;
124  while ((i = str.find(delim, i)) != std::string::npos &&
125  (!maxsplit || result.size() < maxsplit.value())) {
126  result.emplace_back(str, j, i - j);
127  i += delim.size();
128  j = i;
129  }
130  result.emplace_back(str, j, std::string::npos);
131  return result;
132 
133  // Treat any number of consecutive whitespace characters as a delimiter.
134  } else {
135  bool prev_ws = true;
136  std::string::size_type i = 0, j = 0;
137  for (; i < str.size(); ++i) {
138  if (prev_ws) {
139  if (!isspace(str[i])) {
140  // start of word
141  prev_ws = false;
142  j = i;
143  }
144  } else {
145  if (isspace(str[i])) {
146  // start of space
147  result.emplace_back(str, j, i - j);
148  prev_ws = true;
149  j = i;
150  if ((maxsplit && result.size() == maxsplit.value())) {
151  // stop early if maxsplit was reached
152  result.emplace_back(str, j, std::string::npos);
153  return result;
154  }
155  }
156  }
157  }
158  if (!prev_ws) {
159  result.emplace_back(str, j, std::string::npos);
160  }
161  return result;
162  }
163 }

+ Here is the caller graph for this function:

std::string strip ( std::string_view  str)

trim any whitespace from the left and right ends of a string

Definition at line 165 of file StringTransform.cpp.

References i, and generate_TableFunctionsFactory_init::j.

Referenced by Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), QueryRunner::QueryRunner::runMultipleStatements(), and DBHandler::sql_execute_impl().

165  {
166  std::string::size_type i, j;
167  for (i = 0; i < str.size() && std::isspace(str[i]); ++i) {
168  }
169  for (j = str.size(); j > i && std::isspace(str[j - 1]); --j) {
170  }
171  return std::string(str.substr(i, j - i));
172 }

+ Here is the caller graph for this function:

std::string to_lower ( const std::string &  str)
inline

Definition at line 96 of file StringTransform.h.

Referenced by anonymous_namespace{DBHandler.cpp}::check_valid_column_names(), anonymous_namespace{DBHandler.cpp}::column_ids_by_names(), Parser::AlterTableParamStmt::execute(), TableFunctionCompilationContext::generateEntryPoint(), table_functions::TableFunctionsFactory::get_table_funcs(), lower_encoded(), Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitLower().

96  {
97  auto str_lc = str;
98  std::transform(str_lc.begin(), str_lc.end(), str_lc.begin(), ::tolower);
99  return str_lc;
100 }

+ Here is the caller graph for this function:

template<typename T >
std::string to_string ( T &&  v)

Definition at line 72 of file StringTransform.h.

72  {
73  std::ostringstream oss;
74  oss << v;
75  return oss.str();
76 }
template<>
std::string to_string ( char const *&&  v)

Definition at line 86 of file StringTransform.cpp.

Referenced by lockmgr::TableSchemaLockContainer< ReadLock >::acquireTableDescriptor(), lockmgr::TableSchemaLockContainer< WriteLock >::acquireTableDescriptor(), import_export::TypedImportBuffer::add_value(), Catalog_Namespace::Catalog::addColumn(), Catalog_Namespace::Catalog::addFrontendViewToMapNoLock(), Catalog_Namespace::Catalog::addLinkToMap(), Catalog_Namespace::Catalog::addReferenceToForeignDict(), CgenState::addStringConstant(), anonymous_namespace{TableArchiver.cpp}::adjust_altered_table_files(), anonymous_namespace{TargetExprBuilder.cpp}::agg_fn_base_names(), Catalog_Namespace::Catalog::alterPhysicalTableMetadata(), Catalog_Namespace::SysCatalog::alterUser(), query_state::StdLog::appendNameValuePairs(), foreign_storage::LazyParquetChunkLoader::appendRowGroups(), Archive::archive_error(), import_export::QueryExporterGDAL::beginExport(), Catalog_Namespace::Catalog::buildMaps(), Catalog_Namespace::SysCatalog::buildObjectDescriptorMap(), ResultSetReductionJIT::cacheKey(), Catalog_Namespace::Catalog::changeForeignServerOwner(), anonymous_namespace{DBETypes.cpp}::checkColumnRange(), foreign_storage::SingleFileReader::checkForMoreRows(), anonymous_namespace{Execute.cpp}::checkWorkUnitWatchdog(), anonymous_namespace{GpuSharedMemoryUtils.cpp}::codegen_smem_dest_slot_ptr(), GroupByAndAggregate::codegenAggColumnPtr(), TargetExprCodegen::codegenAggregate(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenHoistedConstantsLoads(), CodeGenerator::codegenHoistedConstantsPlaceholders(), BaselineJoinHashTable::codegenMatchingSet(), OverlapsJoinHashTable::codegenMatchingSet(), GroupByAndAggregate::codegenOutputSlot(), BaselineJoinHashTable::codegenSlot(), CodeGenerator::codgenAdjustFixedEncNull(), CodeGenerator::colByteStream(), BloscCompressor::compress(), Geospatial::compress_coords(), anonymous_namespace{OverlapsJoinHashTable.cpp}::compute_bucket_sizes(), DBHandler::convertRows(), File_Namespace::FileMgr::coreInit(), DBHandler::create_dashboard(), create_dev_group_by_buffers(), DBHandler::create_table(), Catalog_Namespace::Catalog::createDashboard(), Catalog_Namespace::Catalog::createDashboardSystemRoles(), Catalog_Namespace::SysCatalog::createDatabase(), Catalog_Namespace::Catalog::createForeignServerNoLocks(), Catalog_Namespace::Catalog::createLink(), Catalog_Namespace::Catalog::createTable(), RelAlgExecutor::createTableFunctionWorkUnit(), Catalog_Namespace::SysCatalog::createUser(), anonymous_namespace{ArrowImporter.h}::data_conversion_error(), datum_to_string(), DatumToString(), ArrowResultSet::deallocateArrowResultBuffer(), BloscCompressor::decompress(), Catalog_Namespace::Catalog::delDictionary(), Catalog_Namespace::Catalog::deleteMetadataForDashboards(), Catalog_Namespace::SysCatalog::deleteObjectDescriptorMap(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::deleteObjectPrivileges(), DecimalOverflowValidator::do_validate(), Catalog_Namespace::Catalog::dropColumn(), Catalog_Namespace::SysCatalog::dropDatabase(), Catalog_Namespace::Catalog::dropForeignServer(), Catalog_Namespace::Catalog::dropTable(), Catalog_Namespace::SysCatalog::dropUser(), ChunkMetadata::dump(), Catalog_Namespace::Catalog::dumpCreateTable(), Catalog_Namespace::Catalog::dumpSchema(), TableArchiver::dumpTable(), anonymous_namespace{ResultSetReductionJIT.cpp}::emit_write_projection(), FixedLengthEncoder< T, V >::encodeDataAndUpdateStats(), anonymous_namespace{ArrowImporter.h}::error_context(), CudaMgr_Namespace::errorMessage(), Parser::CopyTableStmt::execute(), Catalog_Namespace::Catalog::executeDropTableSqliteQueries(), RelAlgExecutor::executeRelAlgQueryNoRetry(), RelAlgExecutor::executeSimpleInsert(), File_Namespace::FileMgr::FileMgr(), import_export::delimited_parser::find_end(), ProxyTHttpClient::flush(), Geospatial::anonymous_namespace{GDAL.cpp}::gdal_error_handler(), anonymous_namespace{JoinLoopTest.cpp}::generate_descriptors(), TableFunctionCompilationContext::generateEntryPoint(), Catalog_Namespace::Catalog::generatePhysicalTableName(), Parser::anonymous_namespace{ParserNode.cpp}::generateUniqueTableName(), Geospatial::GeoPoint::GeoPoint(), anonymous_namespace{ArrowResultSetConverter.cpp}::get_arrow_type(), DBHandler::get_dashboard(), DBHandler::get_dashboard_grantees(), File_Namespace::get_data_file_path(), DateTimeUtils::get_dateadd_high_precision_adjusted_scale(), DateTimeUtils::get_dateadd_timestamp_precision_scale(), DBHandler::get_db_object_privs(), DateTimeUtils::get_extract_timestamp_precision_scale(), import_export::Detector::get_headers(), DBHandler::get_link_view(), get_nvidia_compute_capability(), ThriftClientConnection::get_protocol(), HitTestTypes::get_rowid_regex(), anonymous_namespace{Execute.cpp}::get_table_name(), DateTimeUtils::get_timestamp_precision_scale(), SQLTypeInfo::get_type_name(), DBHandler::get_valid_groups(), getArrowImportType(), Fragmenter_Namespace::InsertOrderFragmenter::getChunkMetadata(), Parser::LocalConnector::getColumnDescriptors(), getCurrentStackTrace(), CudaMgr_Namespace::CudaMgr::getDeviceProperties(), RelAlgExecutor::getErrorMessageFromCode(), Catalog_Namespace::Catalog::getForeignServersForUser(), Catalog_Namespace::Catalog::getForeignTableFromStorage(), Catalog_Namespace::SysCatalog::getGranteesOfSharedDashboards(), Catalog_Namespace::Catalog::getMetadataForDashboard(), Catalog_Namespace::SysCatalog::getMetadataForDBById(), Catalog_Namespace::SysCatalog::getMetadataForObject(), Catalog_Namespace::SysCatalog::getMetadataForUserById(), Catalog_Namespace::SysCatalog::getMetadataWithDefaultDB(), foreign_storage::IntegralFixedLengthBoundsValidator< T >::getMinMaxBoundsAsStrings(), foreign_storage::FloatPointValidator< T >::getMinMaxBoundsAsStrings(), Catalog_Namespace::SysCatalog::getRoles(), DBHandler::has_object_privilege(), DBHandler::import_geo_table(), import_export::import_thread_delimited(), import_export::import_thread_shapefile(), OverlapsJoinHashTable::initHashTableOnCpu(), anonymous_namespace{HashTable.cpp}::inner_to_string(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), Executor::interrupt(), ResultSet::isGeoColOnGpu(), TableFunctionExecutionContext::launchCpuCode(), TableFunctionExecutionContext::launchGpuCode(), QueryExecutionContext::launchGpuCode(), DBObject::loadKey(), main(), anonymous_namespace{ExtensionFunctionsBinding.cpp}::match_arguments(), migrations::MigrationMgr::migrateDateInDaysMetadata(), Catalog_Namespace::SysCatalog::migrateDBAccessPrivileges(), numeric_type_name(), import_export::ogr_to_type(), Geospatial::GeoTypesError::OGRErrorToStr(), File_Namespace::open(), anonymous_namespace{ArrowImporter.h}::ArrowValue< float >::operator DATA_TYPE(), anonymous_namespace{ArrowImporter.h}::ArrowValue< double >::operator DATA_TYPE(), anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >::operator DATA_TYPE(), ColumnList< T >::operator()(), logger::JsonEncoder::operator()(), operator<<(), JSON::operator[](), OutOfMemory::parse_error_str(), parse_numeric(), import_export::delimited_parser::parse_string_array(), DBHandler::prepare_loader_generic(), foreign_storage::csv_file_buffer_parser::process_geo_column(), anonymous_namespace{Types.cpp}::process_poly_ring(), DictionaryValueConverter< TARGET_TYPE >::processBuffer(), query_template_impl(), ra_exec_unit_desc_for_caching(), foreign_storage::SingleFileReader::readRegion(), Catalog_Namespace::Catalog::recordOwnershipOfObjectsInObjectPermissions(), Executor::redeclareFilterFunction(), ResultSetReductionJIT::reduceOneEntryBaseline(), ResultSetReductionJIT::reduceOneEntryTargetsNoCollisions(), QueryMemoryDescriptor::reductionKey(), Executor::registerActiveModule(), PerfectJoinHashTable::reifyForDevice(), BaselineJoinHashTable::reifyForDevice(), AutomaticIRMetadataGuard::rememberOurInstructions(), Catalog_Namespace::Catalog::renameColumn(), Catalog_Namespace::SysCatalog::renameDatabase(), File_Namespace::renameForDelete(), Catalog_Namespace::SysCatalog::renameObjectsInDescriptorMap(), Catalog_Namespace::Catalog::renamePhysicalTable(), Catalog_Namespace::Catalog::replaceDashboard(), TableArchiver::restoreTable(), ArrowResultSet::resultSetArrowLoopback(), Catalog_Namespace::SysCatalog::revokeAllOnDatabase_unsafe(), QueryRewriter::rewriteColumnarUpdate(), anonymous_namespace{TableArchiver.cpp}::run(), ExecutionKernel::runImpl(), import_export::QueryExporter::safeColumnName(), import_export::RenderGroupAnalyzer::seedFromExistingTableContents(), serialize_column_ref(), serialize_table_ref(), anonymous_namespace{DdlCommandExecutor.cpp}::set_headers_with_type(), Catalog_Namespace::Catalog::setColumnDictionary(), Catalog_Namespace::Catalog::setColumnSharedDictionary(), Catalog_Namespace::Catalog::setForeignServerProperty(), Catalog_Namespace::Catalog::setForeignTableProperty(), Executor::skipFragment(), start_calcite_server_as_daemon(), query_state::StdLogData::StdLogData(), anonymous_namespace{StringTransform.h}::stringlike(), switch(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::table_epochs_to_string(), anonymous_namespace{ResultSetReductionJIT.cpp}::target_info_key(), ThriftSerializers::target_meta_info_to_thrift(), DBHandler::thrift_to_copyparams(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::throw_missing_metadata_error(), foreign_storage::throw_number_of_columns_mismatch_error(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::throw_row_group_larger_than_fragment_size_error(), foreign_storage::ParquetGeospatialEncoder::throwMalformedGeoElement(), foreign_storage::ParquetFixedLengthArrayEncoder::throwWrongSizeArray(), logger::JsonEncoder::timer(), Parser::InSubquery::to_string(), Parser::InValues::to_string(), InputDescriptor::toString(), RexAbstractInput::toString(), HashTable::toString(), InputColDescriptor::toString(), table_functions::TableFunctionOutputRowSizer::toString(), ColSlotContext::toString(), toString(), anonymous_namespace{Datum.cpp}::toString(), Analyzer::ColumnVar::toString(), DBObject::toString(), RexOperator::toString(), Analyzer::Var::toString(), QueryMemoryDescriptor::toString(), RexInput::toString(), Analyzer::UOper::toString(), SortField::toString(), RexRef::toString(), RexAgg::toString(), Analyzer::InIntegerSet::toString(), Analyzer::LikelihoodExpr::toString(), RelAggregate::toString(), RelJoin::toString(), Analyzer::ExtractExpr::toString(), Analyzer::DateaddExpr::toString(), RelLeftDeepInnerJoin::toString(), Analyzer::DatediffExpr::toString(), Analyzer::DatetruncExpr::toString(), RelCompound::toString(), Analyzer::OrderEntry::toString(), RelSort::toString(), RelModify::toString(), anonymous_namespace{HashJoin.cpp}::toStringFlat(), RelAlgTranslator::translateArrayFunction(), RelAlgTranslator::translateGeoFunctionArg(), RelAlgTranslator::translateHPTLiteral(), Executor::unregisterActiveModule(), Catalog_Namespace::SysCatalog::updateBlankPasswordsToRandom(), Fragmenter_Namespace::InsertOrderFragmenter::updateColumn(), Catalog_Namespace::Catalog::updateDeletedColumnIndicator(), Catalog_Namespace::Catalog::updateDictionaryNames(), Catalog_Namespace::Catalog::updateFixlenArrayColumns(), Catalog_Namespace::Catalog::updateForeignTableRefreshTimes(), Catalog_Namespace::Catalog::updateGeoColumns(), Catalog_Namespace::Catalog::updateLogicalToPhysicalTableMap(), Catalog_Namespace::SysCatalog::updateObjectDescriptorMap(), Catalog_Namespace::Catalog::updatePageSize(), Catalog_Namespace::SysCatalog::updateSupportUserDeactivation(), Catalog_Namespace::Catalog::updateTableDescriptorSchema(), Catalog_Namespace::UserMetadata::userLoggable(), DateDaysOverflowValidator::validate(), CommandLineOptions::validate(), foreign_storage::Csv::anonymous_namespace{CsvShared.cpp}::validate_and_get_string_with_length(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::validate_equal_schema(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::validate_max_repetition_and_definition_level(), system_validator::validate_table_epochs(), foreign_storage::IntegralFixedLengthBoundsValidator< T >::validateValue(), foreign_storage::FloatPointValidator< T >::validateValue(), and ScalarExprToSql::visitUOper().

86  {
87  return std::string(v);
88 }
template<>
std::string to_string ( std::string &&  v)

Definition at line 91 of file StringTransform.cpp.

91  {
92  return std::move(v);
93 }
std::string to_upper ( const std::string &  str)
inline

Definition at line 90 of file StringTransform.h.

Referenced by Catalog_Namespace::Catalog::addColumn(), ExtensionFunctionsWhitelist::addCommon(), Catalog_Namespace::Catalog::addTableToMap(), Catalog_Namespace::Catalog::buildMaps(), Catalog_Namespace::SysCatalog::buildRoleMap(), Catalog_Namespace::SysCatalog::createDatabase(), Catalog_Namespace::SysCatalog::createRole_unsafe(), system_validator::DistributedValidate::DistributedValidate(), Catalog_Namespace::Catalog::dropColumn(), Catalog_Namespace::SysCatalog::dropRole_unsafe(), CreateForeignServerCommand::execute(), anonymous_namespace{DBHandler.cpp}::extract_projection_tokens_for_completion(), ExtensionFunctionsWhitelist::get(), DBHandler::get_completion_hints(), ExtensionFunctionsWhitelist::get_ext_funcs(), DBHandler::get_uc_compatible_table_names_by_column(), ExtensionFunctionsWhitelist::get_udf(), Catalog_Namespace::Catalog::getDictionary(), ShowTableDetailsCommand::getFilteredTableNames(), Catalog_Namespace::Catalog::getForeignTableUnlocked(), Catalog_Namespace::SysCatalog::getGrantee(), Catalog_Namespace::is_reserved_sql_keyword(), just_whitelisted_keyword_hints(), parseStorageType(), foreign_storage::OptionsContainer::populateOptionsMap(), Catalog_Namespace::Catalog::removeTableFromMap(), Catalog_Namespace::Catalog::renameColumn(), Catalog_Namespace::SysCatalog::renameDatabase(), Catalog_Namespace::Catalog::renamePhysicalTable(), Catalog_Namespace::Catalog::roll(), Catalog_Namespace::Catalog::setForeignServerDataWrapper(), Catalog_Namespace::Catalog::setUncappedTableEpoch(), should_suggest_column_hints(), StringToDatum(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), and Catalog_Namespace::SysCatalog::updateUserRoleName().

90  {
91  auto str_uc = str;
92  std::transform(str_uc.begin(), str_uc.end(), str_uc.begin(), ::toupper);
93  return str_uc;
94 }

+ Here is the caller graph for this function: