OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StringTransform.h File Reference
#include <boost/config.hpp>
#include <optional>
#include <string_view>
#include "Shared/clean_boost_regex.hpp"
#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::string format_num_bytes (const size_t bytes)
 
std::optional< size_t > inside_string_literal (const size_t start, const size_t length, std::vector< std::pair< size_t, size_t >> const &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_view sv_strip (std::string_view str)
 return trimmed string_view More...
 
std::string strip (std::string_view str)
 trim any whitespace from the left and right ends of a string More...
 
std::pair< std::string_view,
const char * > 
substring (const std::string &str, size_t substr_length)
 return substring of str with postfix if str.size() > substr_length 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 31 of file StringTransform.cpp.

References find_string_literals(), and inside_string_literal().

Referenced by pg_shim().

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

+ 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 41 of file StringTransform.h.

References run_benchmark_import::args.

Referenced by CachedSessionStore::add(), AlterForeignTableCommand::alterOptions(), Catalog_Namespace::SysCatalog::changeDatabaseOwner(), AlterForeignServerCommand::changeForeignServerOwner(), DBHandler::check_table_load_privileges(), Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), DBHandler::checkpoint(), DBHandler::clone_session(), DBHandler::connect(), Fragmenter_Namespace::copyDataOfShard(), DBHandler::create_dashboard(), DBHandler::create_link(), Parser::create_stmt_for_query(), Catalog_Namespace::SysCatalog::createDatabase(), QueryRunner::QueryRunner::createStatement(), dateTimeParse(), DBHandler::delete_dashboards(), details::RelAlgDispatcher::dispatchModify(), details::RelAlgDispatcher::dispatchTableScan(), Catalog_Namespace::SysCatalog::dropDatabase(), migrations::MigrationMgr::dropRenderGroupColumns(), ShowUserDetailsCommand::execute(), RefreshForeignTablesCommand::execute(), 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(), QueryRunner::QueryRunner::getCalcitePlan(), Catalog_Namespace::SysCatalog::getCatalog(), anonymous_namespace{RelAlgDag.cpp}::getCatalogAndTableFromScanNode(), lockmgr::TableLockMgrImpl< T >::getClusterTableMutex(), Calcite::getCompletionHints(), QueryRunner::QueryRunner::getLoader(), QueryRunner::QueryRunner::getParsedGlobalQueryHints(), QueryRunner::QueryRunner::getParsedQueryHint(), QueryRunner::QueryRunner::getParsedQueryHints(), QueryRunner::QueryRunner::getQueryInfoForDataRecyclerTest(), QueryRunner::QueryRunner::getRaExecutionSequence(), QueryRunner::QueryRunner::getRelAlgDag(), QueryRunner::QueryRunner::getRelAlgTranslator(), QueryRunner::QueryRunner::getRootNodeFromParsedQuery(), InputTableInfoCache::getTableInfo(), DBHandler::has_object_privilege(), DBHandler::hasTableAccessPrivileges(), DBHandler::import_table(), QueryRunner::ImportDriver::importGeoTable(), DBHandler::importGeoTableSingle(), DBHandler::insert_chunks(), DBHandler::insert_data(), Fragmenter_Namespace::InsertDataLoader::insertChunks(), Fragmenter_Namespace::InsertDataLoader::insertData(), DBHandler::internal_connect(), DBHandler::interrupt(), boost::serialization::load_construct_data(), migrations::MigrationMgr::migrateDateInDaysMetadata(), DBHandler::parse_to_ra(), DBHandler::prepare_loader_generic(), process_detections(), Calcite::processImpl(), QueryRunner::QueryRunner::QueryRunner(), AlterForeignTableCommand::renameColumn(), AlterForeignServerCommand::renameForeignServer(), AlterForeignTableCommand::renameTable(), DBHandler::replace_dashboard(), QueryRunner::anonymous_namespace{QueryRunner.cpp}::run_select_query_with_filter_push_down(), QueryRunner::QueryRunner::runDDLStatement(), QueryRunner::QueryRunner::runSelectQuery(), QueryRunner::QueryRunner::runSQLWithAllowingInterrupt(), 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(), RexAbstractInput::toString(), RexOperator::toString(), RexCase::toString(), RexFunctionOperator::toString(), SortField::toString(), RexWindowFunctionOperator::toString(), RexRef::toString(), RexAgg::toString(), RexSubQuery::toString(), RexInput::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(), Parser::anonymous_namespace{ParserNode.cpp}::user_can_access_table(), DBHandler::validateDashboardIdsForSharing(), QueryRunner::QueryRunner::validateDDLStatement(), and DBHandler::validateRelAlg().

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

Definition at line 182 of file StringTransform.h.

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

182  {
183  struct Joiner {
184  Joiner() {}
185 
186  std::string txt;
187 
188  void append(std::string_view moretxt) { txt += moretxt; }
189  }; // struct Joiner
190  Joiner j{};
191  (j.append(stringlike(std::forward<Types>(parms))), ...);
192  return std::move(j.txt);
193 }
size_t append(FILE *f, const size_t size, const int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:158

+ Here is the call graph for this function:

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

Definition at line 196 of file StringTransform.h.

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

196  {
197  struct JoinerWith {
198  JoinerWith(std::string_view join) : join(join), first(true) {}
199 
200  std::string_view join;
201  bool first;
202  std::string txt;
203 
204  void append(std::string_view moretxt) {
205  if (!first) {
206  txt += join;
207  } else {
208  first = false;
209  }
210  txt += moretxt;
211  }
212  }; // struct JoinerWith
213  JoinerWith j{with};
214  (j.append(stringlike(std::forward<Types>(parms))), ...);
215  return std::move(j.txt);
216 }
size_t append(FILE *f, const size_t size, const int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:158
std::string join(T const &container, std::string const &delim)
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 57 of file StringTransform.cpp.

References CHECK_GT.

Referenced by apply_shim().

57  {
58  boost::regex literal_string_regex{R"(([^']+)('(?:[^']+|'')*'))", boost::regex::perl};
59  boost::smatch what;
60  auto it = query.begin();
61  auto prev_it = it;
62  std::vector<std::pair<size_t, size_t>> positions;
63  while (true) {
64  try {
65  if (!boost::regex_search(it, query.end(), what, literal_string_regex)) {
66  break;
67  }
68  } catch (const std::exception& e) {
69  // boost::regex throws an exception about the complexity of matching when
70  // the wrong type of quotes are used or they're mismatched. Let the query
71  // through unmodified, the parser will throw a much more informative error.
72  // This can also throw on very long queries
73  std::ostringstream oss;
74  oss << "Detecting an error while processing string literal regex search: "
75  << e.what();
76  throw std::runtime_error(oss.str());
77  }
78  CHECK_GT(what[1].length(), 0);
79  prev_it = it;
80  it += what.length();
81  positions.emplace_back(prev_it + what[1].length() - query.begin(),
82  it - query.begin());
83  }
84  return positions;
85 }
#define CHECK_GT(x, y)
Definition: Logger.h:305

+ Here is the caller graph for this function:

std::string format_num_bytes ( const size_t  bytes)

Definition at line 102 of file StringTransform.cpp.

References CHECK_GE, CHECK_LE, and to_string().

Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::add_chunk_requests_to_allocated_pool(), ExecutorResourceMgr_Namespace::ExecutorResourcePool::allocate_resources(), ExecutorResourceMgr_Namespace::ExecutorResourcePool::can_currently_satisfy_chunk_request(), ExecutorResourceMgr_Namespace::ExecutorResourcePool::deallocate_resources(), DBHandler::init_executor_resource_mgr(), ExecutorResourceMgr_Namespace::ResourceGrant::print(), ExecutorResourceMgr_Namespace::ExecutorResourcePool::remove_chunk_requests_from_allocated_pool(), and ExecutorResourceMgr_Namespace::ResourceGrant::to_string().

102  {
103  const size_t units_per_k_unit{1024};
104  const std::vector<std::string> byte_units = {" bytes", "KB", "MB", "GB", "TB", "PB"};
105  const std::vector<size_t> bytes_per_scale_unit = {size_t(1),
106  size_t(1) << 10,
107  size_t(1) << 20,
108  size_t(1) << 30,
109  size_t(1) << 40,
110  size_t(1) << 50,
111  size_t(1) << 60};
112  if (bytes < units_per_k_unit) {
113  return std::to_string(bytes) + " bytes";
114  }
115  CHECK_GE(bytes, units_per_k_unit);
116  const size_t byte_scale = log(bytes) / log(units_per_k_unit);
117  CHECK_GE(byte_scale, size_t(1));
118  CHECK_LE(byte_scale, size_t(5));
119  const size_t scaled_bytes_left_of_decimal = bytes / bytes_per_scale_unit[byte_scale];
120  const size_t scaled_bytes_right_of_decimal = bytes % bytes_per_scale_unit[byte_scale];
121  const size_t fractional_digits = static_cast<double>(scaled_bytes_right_of_decimal) /
122  bytes_per_scale_unit[byte_scale] * 100.;
123  return std::to_string(scaled_bytes_left_of_decimal) + "." +
124  std::to_string(fractional_digits) + " " + byte_units[byte_scale];
125 }
#define CHECK_GE(x, y)
Definition: Logger.h:306
std::string to_string(char const *&&v)
#define CHECK_LE(x, y)
Definition: Logger.h:304

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string generate_random_string ( const size_t  len)

Definition at line 150 of file StringTransform.cpp.

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

150  {
151  static char charset[] =
152  "0123456789"
153  "abcdefghijklmnopqrstuvwxyz"
154  "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
155 
156  static std::mt19937 prng{std::random_device{}()};
157  static std::uniform_int_distribution<size_t> dist(0, strlen(charset) - 1);
158 
159  std::string str;
160  str.reserve(len);
161  for (size_t i = 0; i < len; i++) {
162  str += charset[dist(prng)];
163  }
164  return str;
165 }

+ 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 288 of file StringTransform.cpp.

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

288  {
289  std::stringstream ss;
290  ss << std::quoted(filename, quote, escape); // TODO: prevents string_view Jun 2020
291  return ss.str();
292 }

+ Here is the caller graph for this function:

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

Definition at line 87 of file StringTransform.cpp.

References gpu_enabled::accumulate().

Referenced by query_state::StdLog::log(), and Calcite::processImpl().

87  {
88  constexpr std::regex::flag_type flags =
89  std::regex::ECMAScript | std::regex::icase | std::regex::optimize;
90  static const std::initializer_list<std::pair<std::regex, std::string>> rules{
91  {std::regex(
92  R"(\b((?:password|s3_access_key|s3_secret_key|s3_session_token|username|credential_string)\s*=\s*)'.+?')",
93  flags),
94  "$1'XXXXXXXX'"},
95  {std::regex(R"((\\set_license\s+)\S+)", flags), "$1XXXXXXXX"}};
96  return std::accumulate(
97  rules.begin(), rules.end(), query_str, [](auto& str, auto& rule) {
98  return std::regex_replace(str, rule.first, rule.second);
99  });
100 }
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,
std::vector< std::pair< size_t, size_t >> const &  literal_positions 
)

Definition at line 233 of file StringTransform.cpp.

Referenced by apply_shim().

236  {
237  const auto end = start + length;
238  for (const auto& literal_position : literal_positions) {
239  if (literal_position.first <= start && end <= literal_position.second) {
240  return literal_position.second;
241  }
242  }
243  return std::nullopt;
244 }

+ Here is the caller graph for this function:

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

Definition at line 63 of file StringTransform.h.

Referenced by heavydb.thrift.ttypes.TDBException::__repr__(), TableFunctionsFactory_declbracket.Declaration::__str__(), TableFunctionsFactory_declbracket.Bracket::__str__(), TableFunctionsFactory_linker.GenerateTemplateFiles::_generate_cpp_content(), TableFunctionsFactory_linker.GenerateAddTableFunctionsFiles::_generate_cpp_content(), TableFunctionsFactory_linker.GenerateTemplateFiles::_generate_hpp_content(), foreign_storage::ParquetArrayDetectEncoder::appendToDetectBuffer(), 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(), Catalog_Namespace::Catalog::deleteCustomExpressions(), Catalog_Namespace::Catalog::dumpCreateServer(), Catalog_Namespace::Catalog::dumpCreateTableUnlocked(), Catalog_Namespace::Catalog::dumpSchema(), TableArchiver::dumpTable(), RefreshForeignTablesCommand::execute(), generate_TableFunctionsFactory_init::find_signatures(), generate_TableFunctionsFactory_init::format_annotations(), generate_TableFunctionsFactory_init::format_function_args(), 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(), TableFunctionsFactory_linker::get_existing_file_content(), 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(), table_functions::TableFunction::getArgNames(), table_functions::TableFunction::getArgTypes(), table_functions::TableFunction::getInputArgsDefaultValues(), ExtensionFunctionsWhitelist::getLLVMDeclarations(), table_functions::TableFunction::getSignature(), anonymous_namespace{SerializeToSql.cpp}::group_by_to_string(), hoist_filter_cond_to_cross_join(), QueryRunner::ImportDriver::importGeoTable(), anonymous_namespace{RelAlgDag.cpp}::isRenamedInput(), anonymous_namespace{SerializeToSql.cpp}::join_condition_to_string(), org.apache.calcite.sql.validate.SqlValidatorImpl::lookupJoinHints(), make-m2-proxy::make_settings(), TableFunctionsFactory_declbracket.Bracket::normalize(), org.apache.calcite.rel.rules.DynamicFilterJoinRule::onMatch(), org.apache.calcite.rel.rules.OuterJoinOptViaNullRejectionRule::onMatch(), operator<<(), import_export::parse_add_metadata_columns(), generate_TableFunctionsFactory_init::parse_annotations(), org.apache.calcite.rel.rules.DynamicFilterJoinRule::performSelectivePushDown(), org.apache.calcite.sql.validate.SqlValidatorImpl.Permute::Permute(), 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(), org.apache.calcite.sql.validate.SqlValidatorImpl::registerFrom(), TableArchiver::restoreTable(), com.mapd.calcite.parser.HeavyDBParser::rewriteSimpleUpdateAsSelect(), make-m2-proxy::simple_xml(), sink_projected_boolean_expr_to_join(), start_calcite_server_as_daemon(), org.apache.calcite.sql2rel.SqlToRelConverter::substituteSubQuery(), report::summary_body_rows(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), import_export::anonymous_namespace{QueryExporterCSV.cpp}::target_value_to_string(), anonymous_namespace{SerializeToSql.cpp}::targets_to_string(), TableFunctionsFactory_declbracket.Bracket::tostring(), report.Row::tr(), org.apache.calcite.sql2rel.SqlToRelConverter::translateIn(), shared::validate_sort_options(), DBHandler::validateDashboardIdsForSharing(), foreign_storage::ForeignDataWrapperFactory::validateDataWrapperType(), org.apache.calcite.sql.validate.SqlValidatorImpl::validateJoin(), org.apache.calcite.sql.validate.SqlValidatorImpl::validateQualifiedCommonColumn(), foreign_storage::AbstractFileStorageDataWrapper::validateServerOptions(), RelAlgVisitor< std::vector< unsigned > >::visit(), TableFunctionsFactory_transformers.AstPrinter::visit_annotation_node(), TableFunctionsFactory_transformers.AstPrinter::visit_arg_node(), TableFunctionsFactory_transformers.AstPrinter::visit_composed_node(), TableFunctionsFactory_transformers.AstPrinter::visit_template_node(), TableFunctionsFactory_transformers.AstPrinter::visit_udtf_node(), 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().

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

sanitize an SQL string

Definition at line 248 of file StringTransform.cpp.

249  {
250  char inside_quote = 0;
251  bool previous_c_was_backslash = false;
252  for (auto& c : str) {
253  // if this character is a quote of either type
254  if (c == '\'' || c == '\"') {
255  // ignore if previous character was a backslash
256  if (!previous_c_was_backslash) {
257  // start or end of a quoted region
258  if (inside_quote == c) {
259  // end region
260  inside_quote = 0;
261  } else if (inside_quote == 0) {
262  // start region
263  inside_quote = c;
264  }
265  }
266  } else if (inside_quote == 0) {
267  // outside quoted region
268  if (c == '\n' || c == '\t' || c == '\r') {
269  // replace these with space
270  c = ' ';
271  }
272  // otherwise leave alone, including quotes of a different type
273  }
274  // handle backslashes, except for double backslashes
275  if (c == '\\') {
276  previous_c_was_backslash = !previous_c_was_backslash;
277  } else {
278  previous_c_was_backslash = false;
279  }
280  }
281  // if we didn't end a region, there were unclosed or mixed-nested quotes
282  // accounting for backslashes should mean that this should only be the
283  // case with truly malformed strings which Calcite will barf on anyway
284  return (inside_quote == 0);
285 }
std::string simple_sanitize ( const std::string &  str)

simple sanitize string (replace control characters with space)

Definition at line 296 of file StringTransform.cpp.

296  {
297  auto sanitized_str{str};
298  for (auto& c : sanitized_str) {
299  c = (c < 32) ? ' ' : c;
300  }
301  return sanitized_str;
302 }
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 171 of file StringTransform.cpp.

References run_benchmark_import::result.

Referenced by foreign_storage::anonymous_namespace{LogFileBufferParser.cpp}::add_nonce_values(), run_benchmark::benchmark(), create_table.SyntheticTable::createDataAndImportTable(), AlterTableCommand::execute(), ai.heavy.jdbc.HeavyAIStatement::executeQuery(), anonymous_namespace{DBHandler.cpp}::extract_projection_tokens_for_completion(), anonymous_namespace{TableArchiver.cpp}::find_render_group_columns(), generate_TableFunctionsFactory_init::find_signatures(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_data_sources(), get_qualified_column_hints(), table_functions::TableFunction::getCursorFields(), ColumnDescriptor::getDefaultValueLiteral(), com.mapd.parser.server.ExtensionFunction::getPrettyArgNames(), import_export::RasterImporter::getRawBandNamesForFormat(), QueryPlanDagExtractor::handleTranslatedJoin(), import_export::RasterImporter::initializeFiltering(), AutomaticIRMetadataGuard::makeBaseFilename(), AutomaticIRMetadataGuard::makeQueryEngineFilename(), import_export::parse_add_metadata_columns(), TrackingProcessor::process(), Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), run_benchmark::read_query_files(), TableArchiver::restoreTable(), QueryRunner::QueryRunner::runMultipleStatements(), Parser::splitObjectHierName(), tf_geo_multi_rasterize__cpu_template(), com.mapd.parser.server.ExtensionFunctionSignatureParser::toSignature(), anonymous_namespace{TableArchiver.cpp}::update_or_drop_column_ids_in_page_headers(), and ddl_utils::anonymous_namespace{DdlUtils.cpp}::validate_literal().

173  {
174  std::vector<std::string> result;
175 
176  // Use an explicit delimiter.
177  if (!delim.empty()) {
178  std::string::size_type i = 0, j = 0;
179  while ((i = str.find(delim, i)) != std::string::npos &&
180  (!maxsplit || result.size() < maxsplit.value())) {
181  result.emplace_back(str, j, i - j);
182  i += delim.size();
183  j = i;
184  }
185  result.emplace_back(str, j, std::string::npos);
186  return result;
187 
188  // Treat any number of consecutive whitespace characters as a delimiter.
189  } else {
190  bool prev_ws = true;
191  std::string::size_type i = 0, j = 0;
192  for (; i < str.size(); ++i) {
193  if (prev_ws) {
194  if (!isspace(str[i])) {
195  // start of word
196  prev_ws = false;
197  j = i;
198  }
199  } else {
200  if (isspace(str[i])) {
201  // start of space
202  result.emplace_back(str, j, i - j);
203  prev_ws = true;
204  j = i;
205  if ((maxsplit && result.size() == maxsplit.value())) {
206  // stop early if maxsplit was reached
207  result.emplace_back(str, j, std::string::npos);
208  return result;
209  }
210  }
211  }
212  }
213  if (!prev_ws) {
214  result.emplace_back(str, j, std::string::npos);
215  }
216  return result;
217  }
218 }

+ 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 229 of file StringTransform.cpp.

References sv_strip().

Referenced by import_export::anonymous_namespace{ExpressionParser.cpp}::Function_bool::Eval(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_data_sources(), getCurrentStackTrace(), import_export::RasterImporter::initializeFiltering(), TableFunctionsFactory_declbracket.Bracket::parse(), import_export::parse_add_metadata_columns(), Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), QueryRunner::QueryRunner::runMultipleStatements(), and DBHandler::sql_execute_impl().

229  {
230  return std::string(sv_strip(str));
231 }
std::string_view sv_strip(std::string_view str)
return trimmed string_view

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::pair<std::string_view, const char*> substring ( const std::string &  str,
size_t  substr_length 
)

return substring of str with postfix if str.size() > substr_length

Definition at line 137 of file StringTransform.cpp.

Referenced by anonymous_namespace{RelAlgOptimizer.cpp}::add_new_indices_for(), anonymous_namespace{RelAlgOptimizer.cpp}::cleanup_dead_nodes(), ai.heavy.jdbc.HeavyAIEscapeFunctions::createFunctionMap(), ct_substr__cpu_(), fold_filters(), com.mapd.utility.db_vendors.PostGis_types::get_wkt(), and DBHandler::sql_execute_impl().

138  {
139  // return substring with a post_fix
140  // assume input str is valid and we perform substring starting from str's initial pos
141  // (=0)
142  const auto str_size = str.size();
143  if (substr_length >= str_size) {
144  return {str, ""};
145  }
146  std::string_view substr(str.c_str(), substr_length);
147  return {substr, "..."};
148 }

+ Here is the caller graph for this function:

std::string_view sv_strip ( std::string_view  str)

return trimmed string_view

Definition at line 220 of file StringTransform.cpp.

Referenced by import_export::import_thread_delimited(), foreign_storage::CsvFileBufferParser::parseBuffer(), and strip().

220  {
221  std::string::size_type i, j;
222  for (i = 0; i < str.size() && std::isspace(str[i]); ++i) {
223  }
224  for (j = str.size(); j > i && std::isspace(str[j - 1]); --j) {
225  }
226  return str.substr(i, j - i);
227 }

+ Here is the caller graph for this function:

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

Definition at line 99 of file StringTransform.h.

References shared::transform().

Referenced by anonymous_namespace{DBHandler.cpp}::check_valid_column_names(), StringDictionaryTranslationMgr::codegen(), CodeGenerator::codegenCastNonStringToString(), CodeGenerator::codegenPerRowStringOper(), anonymous_namespace{DBHandler.cpp}::column_ids_by_names(), anonymous_namespace{ResultSetReductionJIT.cpp}::emit_aggregate_one_nullable_value(), import_export::anonymous_namespace{ExpressionParser.cpp}::Function_bool::Eval(), Parser::AlterTableParamStmt::execute(), anonymous_namespace{RowFunctionManager.h}::find_function_oper(), table_functions::TableFunctionsFactory::get_table_funcs(), table_functions::TableFunction::getName(), import_export::parse_add_metadata_columns(), pg_shim(), Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), and anonymous_namespace{TableArchiver.cpp}::run().

99  {
100  auto str_lc = str;
101  std::transform(str_lc.begin(), str_lc.end(), str_lc.begin(), ::tolower);
102  return str_lc;
103 }
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:329

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 75 of file StringTransform.h.

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

Definition at line 128 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::addColumnNontransactional(), import_export::TypedImportBuffer::addDefaultValues(), Catalog_Namespace::Catalog::addFrontendViewToMapNoLock(), Catalog_Namespace::Catalog::addLinkToMap(), Catalog_Namespace::Catalog::addReferenceToForeignDict(), CgenState::addStringConstant(), TableFunctionManager::allocate_output_buffers(), Catalog_Namespace::Catalog::alterColumnTypeTransactional(), Catalog_Namespace::Catalog::alterPhysicalTableMetadata(), Catalog_Namespace::SysCatalog::alterUser(), Parser::InsertValuesStmt::analyze(), data_conversion::StringViewToArrayEncoder< ScalarEncoderType >::appendArrayDatums(), query_state::StdLog::appendNameValuePairs(), foreign_storage::LazyParquetChunkLoader::appendRowGroups(), Archive::archive_error(), import_export::QueryExporterGDAL::beginExport(), run_benchmark::benchmark(), bind_function(), Catalog_Namespace::Catalog::buildDashboardsMapUnlocked(), Catalog_Namespace::Catalog::buildDictionaryMapUnlocked(), Catalog_Namespace::Catalog::buildLinksMapUnlocked(), Catalog_Namespace::SysCatalog::buildObjectDescriptorMapUnlocked(), ResultSetReductionJIT::cacheKey(), GeoRaster< T, Z >::calculate_bins_and_scales(), CardinalityCacheKey::CardinalityCacheKey(), Catalog_Namespace::SysCatalog::changeDatabaseOwner(), Catalog_Namespace::Catalog::changeForeignServerOwner(), ddl_utils::SqlType::check_type(), anonymous_namespace{DBETypes.cpp}::checkColumnRange(), foreign_storage::SingleTextFileReader::checkForMoreRows(), anonymous_namespace{Execute.cpp}::checkWorkUnitWatchdog(), spatial_type::Transform::codegen(), anonymous_namespace{GpuSharedMemoryUtils.cpp}::codegen_smem_dest_slot_ptr(), GroupByAndAggregate::codegenAggColumnPtr(), TargetExprCodegen::codegenAggregate(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenHoistedConstantsLoads(), CodeGenerator::codegenHoistedConstantsPlaceholders(), BaselineJoinHashTable::codegenMatchingSet(), BoundingBoxIntersectJoinHashTable::codegenMatchingSet(), RangeJoinHashTable::codegenMatchingSetWithOffset(), GroupByAndAggregate::codegenOutputSlot(), BaselineJoinHashTable::codegenSlot(), CodeGenerator::codgenAdjustFixedEncNull(), CodeGenerator::colByteStream(), TableFunctionCompilationContext::compile(), UdfCompiler::compileToLLVMIR(), BloscCompressor::compress(), Geospatial::compress_coords(), anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::compute_bucket_sizes(), DBHandler::convertRows(), File_Namespace::FileMgr::coreInit(), create_dev_group_by_buffers(), DBHandler::create_table(), Catalog_Namespace::Catalog::createCustomExpression(), Catalog_Namespace::Catalog::createDashboard(), Catalog_Namespace::Catalog::createDashboardSystemRoles(), Catalog_Namespace::SysCatalog::createDatabase(), Catalog_Namespace::Catalog::createForeignServerNoLocks(), foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), Catalog_Namespace::Catalog::createLink(), Catalog_Namespace::Catalog::createTable(), Catalog_Namespace::Catalog::createTableFromDiskUnlocked(), RelAlgExecutor::createTableFunctionWorkUnit(), Catalog_Namespace::SysCatalog::createUser(), ct_synthesize_new_dict__cpu_(), anonymous_namespace{DBHandler.cpp}::dashboard_exists(), anonymous_namespace{ArrowImporter.h}::data_conversion_error(), DatumToString(), ArrowResultSet::deallocateArrowResultBuffer(), BloscCompressor::decompress(), Geo::decompress_x_coord(), Geo::decompress_y_coord(), Catalog_Namespace::Catalog::delDictionaryNontransactional(), Catalog_Namespace::Catalog::deleteCustomExpressions(), Catalog_Namespace::Catalog::deleteMetadataForDashboards(), Catalog_Namespace::SysCatalog::deleteObjectDescriptorMap(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::deleteObjectPrivileges(), Catalog_Namespace::Catalog::deleteTableCatalogMetadata(), import_export::RasterImporter::detect(), DecimalOverflowValidator::do_validate(), Catalog_Namespace::Catalog::dropColumn(), Catalog_Namespace::Catalog::dropColumnNontransactional(), Catalog_Namespace::SysCatalog::dropDatabase(), Catalog_Namespace::Catalog::dropForeignServer(), migrations::MigrationMgr::dropRenderGroupColumns(), Catalog_Namespace::SysCatalog::dropUserUnchecked(), Catalog_Namespace::Catalog::dumpCreateTableUnlocked(), Catalog_Namespace::Catalog::dumpSchema(), TableArchiver::dumpTable(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::elementToString(), anonymous_namespace{ResultSetReductionJIT.cpp}::emit_write_projection(), data_conversion::StringViewToStringNoneEncoder::encodeAndAppendData(), data_conversion::StringViewToStringDictEncoder< IdType >::encodeAndAppendData(), FixedLengthEncoder< T, V >::encodeDataAndUpdateStats(), anonymous_namespace{ArrowImporter.h}::error_context(), CudaMgr_Namespace::errorMessage(), ShowUserDetailsCommand::execute(), Parser::CreateTableAsSelectStmt::execute(), Parser::CopyTableStmt::execute(), Catalog_Namespace::Catalog::executeDropTableSqliteQueries(), RelAlgExecutor::executeSimpleInsert(), File_Namespace::FileMgr::FileMgr(), import_export::delimited_parser::find_end(), foreign_storage::anonymous_namespace{RegexFileBufferParser.cpp}::find_last_end_of_line(), format_num_bytes(), import_export::anonymous_namespace{RasterImporter.cpp}::gdal_data_type_to_sql_type(), Geospatial::anonymous_namespace{GDAL.cpp}::gdal_error_handler(), anonymous_namespace{JoinLoopTest.cpp}::generate_descriptors(), UdfCompiler::generateAST(), TableFunctionCompilationContext::generateEntryPoint(), Catalog_Namespace::Catalog::generatePhysicalTableName(), Parser::anonymous_namespace{ParserNode.cpp}::generateUniqueTableName(), Geospatial::GeoPoint::GeoPoint(), anonymous_namespace{ArrowResultSetConverter.cpp}::get_arrow_type(), get_column_stats(), 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(), get_device_string(), DateTimeUtils::get_extract_timestamp_precision_scale(), Parser::anonymous_namespace{ParserNode.cpp}::get_frag_size_def(), import_export::Detector::get_headers(), DBHandler::get_link_view(), foreign_storage::anonymous_namespace{LogFileBufferParser.cpp}::get_node_name(), get_nvidia_compute_capability(), Parser::anonymous_namespace{ParserNode.cpp}::get_page_size_def(), 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(), import_export::RasterImporter::getBandName(), Fragmenter_Namespace::InsertOrderFragmenter::getChunkMetadata(), lockmgr::TableLockMgrImpl< T >::getClusterTableMutex(), Parser::LocalQueryConnector::getColumnDescriptors(), getCurrentStackTrace(), Catalog_Namespace::Catalog::getCustomExpressionFromStorage(), DataRecyclerUtil::getDeviceIdentifierString(), CudaMgr_Namespace::CudaMgr::getDeviceProperties(), anonymous_namespace{RelAlgExecutor.cpp}::getErrorDescription(), RelAlgExecutor::getErrorMessageFromCode(), ColSlotContext::getFlatBufferSize(), 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::Catalog::getNextAddedColumnId(), import_export::RasterImporter::getRawPixels(), Catalog_Namespace::SysCatalog::getRoles(), flatbuffer::NestedArray< char >::getValue(), DBHandler::has_object_privilege(), import_export::RasterImporter::import(), import_export::import_thread_delimited(), import_export::import_thread_shapefile(), import_export::Importer::importGDALRaster(), import_export::ForeignDataImporter::importGeneralS3(), DBHandler::importGeoTableSingle(), RangeJoinHashTable::initHashTableOnCpu(), BoundingBoxIntersectJoinHashTable::initHashTableOnCpu(), anonymous_namespace{HashTable.cpp}::inner_to_string(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), Executor::interrupt(), ResultSet::isGeoColOnGpu(), TableFunctionExecutionContext::launchCpuCode(), QueryExecutionContext::launchGpuCode(), TableFunctionExecutionContext::launchGpuCode(), TableFunctionExecutionContext::launchPreCodeOnCpu(), DBObject::loadKey(), main(), anonymous_namespace{ExtensionFunctionsBinding.cpp}::match_arguments(), migrations::MigrationMgr::migrateDateInDaysMetadata(), Catalog_Namespace::SysCatalog::migrateDBAccessPrivileges(), Catalog_Namespace::Catalog::NoTableFoundException::NoTableFoundException(), numeric_type_name(), import_export::anonymous_namespace{Importer.cpp}::ogr_to_type(), Geospatial::GeoTypesError::OGRErrorToStr(), TableFunctions_Namespace::OneHotEncoder_Namespace::one_hot_encode(), File_Namespace::open(), import_export::Importer::openGDALDataSource(), 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(), TargetExprCodegenBuilder::operator()(), logger::JsonEncoder::operator()(), operator<<(), heavyai::JSON::operator[](), Executor::optimizeAndCodegenCPU(), import_export::parse_add_metadata_columns(), Parser::anonymous_namespace{ParserNode.cpp}::parse_copy_params(), OutOfMemory::parse_error_str(), parse_stats_requests_json(), import_export::delimited_parser::parse_string_array(), pg_shim(), foreign_storage::ParquetDataWrapper::populateChunkBuffers(), DBHandler::prepare_loader_generic(), AlterTableAlterColumnCommand::prepareGeoColumns(), anonymous_namespace{Types.cpp}::process_poly_ring(), DictionaryValueConverter< TARGET_TYPE >::processBuffer(), foreign_storage::TextFileBufferParser::processGeoColumn(), query_template(), foreign_storage::SingleTextFileReader::readRegion(), Catalog_Namespace::SysCatalog::reassignObjectOwners(), Catalog_Namespace::Catalog::reassignOwners(), Catalog_Namespace::SysCatalog::recordExecutedMigration(), Catalog_Namespace::Catalog::recordOwnershipOfObjectsInObjectPermissions(), Executor::redeclareFilterFunction(), ResultSetReductionJIT::reduceOneEntryBaseline(), ResultSetReductionJIT::reduceOneEntryTargetsNoCollisions(), QueryMemoryDescriptor::reductionKey(), Executor::registerActiveModule(), PerfectJoinHashTable::reifyForDevice(), BaselineJoinHashTable::reifyForDevice(), Catalog_Namespace::Catalog::reloadDictionariesFromDiskUnlocked(), Catalog_Namespace::Catalog::reloadForeignTableUnlocked(), AutomaticIRMetadataGuard::rememberOurInstructions(), Catalog_Namespace::Catalog::renameColumn(), Catalog_Namespace::SysCatalog::renameDatabase(), File_Namespace::renameForDelete(), Catalog_Namespace::Catalog::renameLegacyDataWrappers(), Catalog_Namespace::SysCatalog::renameObjectsInDescriptorMap(), Catalog_Namespace::Catalog::renamePhysicalTable(), Catalog_Namespace::Catalog::renamePhysicalTables(), DBHandler::replace_dashboard(), Catalog_Namespace::Catalog::replaceDashboard(), Catalog_Namespace::Catalog::restoreOldOwners(), Catalog_Namespace::Catalog::restoreOldOwnersInMemory(), TableArchiver::restoreTable(), ArrowResultSet::resultSetArrowLoopback(), Catalog_Namespace::SysCatalog::revokeAllOnDatabase_unsafe(), QueryRewriter::rewriteColumnarUpdate(), anonymous_namespace{TableArchiver.cpp}::run(), ExecutionKernel::runImpl(), Catalog_Namespace::SysCatalog::runUpdateQueriesAndChangeOwnership(), import_export::QueryExporter::safeColumnName(), serialize_column_ref(), serialize_table_ref(), ddl_utils::set_default_encoding(), anonymous_namespace{DdlCommandExecutor.cpp}::set_headers_with_type(), foreign_storage::set_node_name(), Catalog_Namespace::Catalog::setColumnDictionary(), Catalog_Namespace::Catalog::setColumnSharedDictionary(), Catalog_Namespace::Catalog::setForeignServerProperty(), Catalog_Namespace::Catalog::setForeignTableProperty(), Executor::skipFragment(), import_export::anonymous_namespace{RasterImporter.cpp}::sql_type_to_gdal_data_type(), Catalog_Namespace::Catalog::sqliteGetColumnsForTableUnlocked(), start_calcite_server_as_daemon(), query_state::StdLogData::StdLogData(), anonymous_namespace{StringTransform.h}::stringlike(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::suggest_decimal_mapping(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::table_epochs_to_string(), anonymous_namespace{ResultSetReductionJIT.cpp}::target_info_key(), ThriftSerializers::target_meta_info_to_thrift(), import_export::anonymous_namespace{QueryExporterCSV.cpp}::target_value_to_string(), DBHandler::thrift_to_copyparams(), foreign_storage::anonymous_namespace{AbstractTextFileDataWrapper.cpp}::throw_fragment_id_out_of_bounds_error(), 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::throw_unexpected_number_of_items(), foreign_storage::ParquetFixedLengthArrayEncoder::throwEmptyArrayException(), foreign_storage::ParquetFixedLengthArrayEncoder::throwWrongSizeArray(), logger::JsonEncoder::timer(), StatsRequestPredicate::to_string(), Parser::InSubquery::to_string(), Parser::InValues::to_string(), dict_ref_t::toString(), InputDescriptor::toString(), QueryExecutionError::toString(), InputColDescriptor::toString(), HashTable::toString(), table_functions::TableFunctionOutputRowSizer::toString(), ColSlotContext::toString(), ExpressionRange::toString(), RexAbstractInput::toString(), anonymous_namespace{Datum.cpp}::toString(), toString(), Analyzer::ColumnVar::toString(), DBObject::toString(), Analyzer::Var::toString(), QueryMemoryDescriptor::toString(), RexOperator::toString(), Analyzer::UOper::toString(), SortField::toString(), Array< T >::toString(), Analyzer::InValues::toString(), Analyzer::InIntegerSet::toString(), RexRef::toString(), RexAgg::toString(), RexInput::toString(), Column< T >::toString(), Analyzer::LikelihoodExpr::toString(), flatbuffer::Column< Geo::MultiLineString, GeoMultiLineString >::toString(), Analyzer::ExtractExpr::toString(), Analyzer::DateaddExpr::toString(), RelAggregate::toString(), Analyzer::DatediffExpr::toString(), Analyzer::DatetruncExpr::toString(), flatbuffer::NestedArray< char >::toString(), RelJoin::toString(), Geo::Point2D::toString(), RelFilter::toString(), RelLeftDeepInnerJoin::toString(), RelCompound::toString(), RelSort::toString(), Column< GeoPoint >::toString(), RelModify::toString(), Column< TextEncodingDict >::toString(), ColumnList< T >::toString(), ColumnList< Array< T > >::toString(), RelTableFunction::toString(), ColumnList< TextEncodingDict >::toString(), Analyzer::OrderEntry::toString(), Analyzer::GeoTransformOperator::toString(), anonymous_namespace{HashJoin.cpp}::toStringFlat(), transform_point(), RelAlgTranslator::translateArrayFunction(), RelAlgTranslator::translateGeoFunctionArg(), RelAlgTranslator::translateHPTLiteral(), Executor::unregisterActiveModule(), anonymous_namespace{TableArchiver.cpp}::update_or_drop_column_ids_in_page_headers(), Catalog_Namespace::SysCatalog::updateBlankPasswordsToRandom(), Fragmenter_Namespace::InsertOrderFragmenter::updateColumn(), Catalog_Namespace::Catalog::updateCustomExpression(), 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::Catalog::updateViewUnlocked(), Catalog_Namespace::UserMetadata::userLoggable(), DateDaysOverflowValidator::validate(), CommandLineOptions::validate(), Parser::validate_and_get_fragment_size(), foreign_storage::Csv::anonymous_namespace{CsvShared.cpp}::validate_and_get_string_with_length(), foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_and_get_string_with_length(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::validate_equal_schema(), ddl_utils::anonymous_namespace{DdlUtils.cpp}::validate_literal(), 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(), ColSlotContext::varlenOutputElementSize(), and ScalarExprToSql::visitUOper().

128  {
129  return std::string(v);
130 }
template<>
std::string to_string ( std::string &&  v)

Definition at line 133 of file StringTransform.cpp.

133  {
134  return std::move(v);
135 }
std::string to_upper ( const std::string &  str)
inline

Definition at line 93 of file StringTransform.h.

References shared::transform().

Referenced by ExtensionFunctionsWhitelist::addCommon(), MLModelMap::addModel(), Catalog_Namespace::Catalog::addTableToMap(), Catalog_Namespace::Catalog::addToColumnMap(), Catalog_Namespace::Catalog::alterColumnTypeTransactional(), DBHandler::alterSession(), DBHandler::alterSystemClear(), Catalog_Namespace::SysCatalog::buildMapsUnlocked(), Catalog_Namespace::SysCatalog::buildRoleMapUnlocked(), Catalog_Namespace::Catalog::buildTablesMapUnlocked(), Catalog_Namespace::SysCatalog::createDatabase(), Catalog_Namespace::SysCatalog::createRole_unsafe(), MLModelMap::deleteModel(), system_validator::DistributedValidate::DistributedValidate(), Catalog_Namespace::Catalog::dropColumn(), Catalog_Namespace::Catalog::dropColumnNontransactional(), Catalog_Namespace::SysCatalog::dropRole_unsafe(), CreateForeignServerCommand::execute(), anonymous_namespace{DBHandler.cpp}::extract_projection_tokens_for_completion(), ExtensionFunctionsWhitelist::get(), Analyzer::TrimStringOper::get_and_validate_trim_op_kind(), DBHandler::get_completion_hints(), ExtensionFunctionsWhitelist::get_ext_funcs(), foreign_storage::anonymous_namespace{AbstractFileStorageDataWrapper.cpp}::get_file_roll_off_value(), get_kmeans_init_type(), get_ml_framework(), get_ml_model_type_from_str(), get_raster_agg_type(), DBHandler::get_uc_compatible_table_names_by_column(), ExtensionFunctionsWhitelist::get_udf(), get_var_importance_metric(), Catalog_Namespace::SysCatalog::getCatalog(), Catalog_Namespace::Catalog::getDictionary(), ShowModelDetailsCommand::getFilteredModelNames(), ShowTableDetailsCommand::getFilteredTableNames(), Catalog_Namespace::Catalog::getForeignTableUnlocked(), Catalog_Namespace::SysCatalog::getGrantee(), Catalog_Namespace::SysCatalog::getMetadataForDB(), MLModelMap::getModel(), MLModelMap::getModelMetadata(), Catalog_Namespace::Catalog::getMutableMetadataForTableUnlocked(), DdlCommandExecutor::getSessionParameter(), shared::FileOrderBase< LocalFileComparator >::getSortBy(), Catalog_Namespace::is_reserved_sql_keyword(), just_whitelisted_keyword_hints(), MLModelMap::modelExists(), parseStorageType(), foreign_storage::OptionsContainer::populateOptionsMap(), Catalog_Namespace::Catalog::reloadTableMetadataUnlocked(), Catalog_Namespace::SysCatalog::removeCatalog(), Catalog_Namespace::Catalog::removeFromColumnMap(), Catalog_Namespace::Catalog::removeTableFromMap(), Catalog_Namespace::Catalog::renameColumn(), Catalog_Namespace::SysCatalog::renameDatabase(), Catalog_Namespace::Catalog::renamePhysicalTable(), Catalog_Namespace::Catalog::renamePhysicalTables(), Catalog_Namespace::Catalog::setForeignServerDataWrapper(), Catalog_Namespace::Catalog::setUncappedTableEpoch(), should_suggest_column_hints(), StringToDatum(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), Catalog_Namespace::Catalog::updateInColumnMap(), Catalog_Namespace::SysCatalog::updateUserRoleName(), ddl_utils::validate_and_set_default_value(), ddl_utils::anonymous_namespace{DdlUtils.cpp}::validate_literal(), and shared::validate_sort_options().

93  {
94  auto str_uc = str;
95  std::transform(str_uc.begin(), str_uc.end(), str_uc.begin(), ::toupper);
96  return str_uc;
97 }
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:329

+ Here is the call graph for this function: