OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shared Namespace Reference

Namespaces

 anonymous_namespace{file_path_util.cpp}
 

Classes

struct  StringDictKey
 
struct  TableKey
 
struct  ColumnKey
 
class  FileNotFoundException
 
class  NoRegexFilterMatchException
 
struct  FilePathOptions
 
class  FileOrderBase
 
class  FileOrderLocal
 
struct  FullyQualifiedTableName
 
struct  PrintContainer
 
struct  is_std_container
 
struct  is_std_container< std::deque< T, A > >
 
struct  is_std_container< std::list< T, A > >
 
struct  is_std_container< std::set< T, A > >
 
struct  is_std_container< std::unordered_set< T, A > >
 
struct  is_std_container< std::vector< T, A > >
 
struct  FileContentsEscaper
 
struct  DivUMod
 

Typedefs

using LocalFileComparator = std::function< bool(const std::string &, const std::string &)>
 

Functions

std::string decode_base64_uri (const std::string &data, bool trim_nulls)
 
std::string decode_base64 (const std::string &val, bool trim_nulls)
 
std::string decode_base64 (const std::string &val)
 
static std::string encode_base64 (const std::string &val)
 
std::ostream & operator<< (std::ostream &os, const StringDictKey &dict_key)
 
std::ostream & operator<< (std::ostream &os, const TableKey &table_key)
 
size_t hash_value (const TableKey &table_key)
 
std::ostream & operator<< (std::ostream &os, const ColumnKey &column_key)
 
void validate_sort_options (const FilePathOptions &options)
 
std::vector< std::string > local_glob_filter_sort_files (const std::string &file_path, const FilePathOptions &options, const bool recurse)
 
bool file_or_glob_path_exists (const std::string &path)
 
std::set< std::string > check_for_rolled_off_file_paths (const std::vector< std::string > &all_file_paths, std::vector< std::string > &processed_file_paths)
 
bool is_s3_uri (const std::string &file_path)
 
void throw_file_not_found (const std::string &file_path)
 
void throw_no_filter_match (const std::string &pattern)
 
bool is_compressed_mime_type (const std::string &mime_type)
 
bool is_compressed_file_extension (const std::string &location)
 
std::ostream & operator<< (std::ostream &os, const FullyQualifiedTableName &table_name)
 
size_t hash_value (const FullyQualifiedTableName &table_name)
 
void execute_over_contiguous_indices (const std::vector< size_t > &indices, std::function< void(const size_t, const size_t)> to_execute)
 
bool isPowOfTwo (unsigned n)
 
unsigned getExpOfTwo (unsigned n)
 
size_t formatDate (char *buf, size_t const max, int64_t const unixtime)
 
size_t formatDateTime (char *buf, size_t const max, int64_t const timestamp, int const dimension, bool use_iso_format)
 
size_t formatHMS (char *buf, size_t const max, int64_t const unixtime)
 
std::string convert_temporal_to_iso_format (const SQLTypeInfo &type_info, int64_t unix_time)
 
size_t compute_hash (int32_t item_1, int32_t item_2)
 
std::ostream & operator<< (std::ostream &os, FileContentsEscaper const &fce)
 
template<typename K , typename V , typename comp >
V & get_from_map (std::map< K, V, comp > &map, const K &key)
 
template<typename K , typename V , typename comp >
const V & get_from_map (const std::map< K, V, comp > &map, const K &key)
 
template<typename T >
size_t append_move (std::vector< T > &destination, std::vector< T > &&source)
 
template<typename... Ts, typename T >
bool dynamic_castable_to_any (T const *ptr)
 
template<typename CONTAINER >
PrintContainer< CONTAINER > printContainer (CONTAINER &container)
 
template<typename OSTREAM , typename CONTAINER >
OSTREAM & operator<< (OSTREAM &os, PrintContainer< CONTAINER > pc)
 
DivUMod divUMod (int64_t num, int64_t den)
 
uint64_t unsignedMod (int64_t num, int64_t den)
 
template<typename T , typename U >
bool contains (const T &container, const U &element)
 
template<typename... COEFFICIENTS>
DEVICE constexpr double horner (double const x, double const c0, COEFFICIENTS...c)
 
DEVICE double fastAtanh (double const x)
 
DEVICE double fastCos (double const x)
 
DEVICE double fastCosh (double const x)
 
DEVICE double fastSin (double const x)
 
DEVICE double fastSinh (double const x)
 
template<int... values, typename T >
bool is_any (T &&value)
 
template<typename T , size_t N>
constexpr std::array< T, N > powersOf (T const a)
 
template<size_t N>
constexpr std::array< double, N > inversePowersOf (double const a)
 
double power10 (unsigned const x)
 
double power10inv (unsigned const x)
 
template<typename TO , typename FROM >
TO reinterpret_bits (FROM const from)
 
template<typename TO , typename FROM >
TO bit_cast (FROM &&from)
 
template<typename... STR>
constexpr std::array
< std::string_view, sizeof...(STR)> 
string_view_array (STR &&...str)
 
template<typename OUTPUT , typename INPUT , typename FUNC >
OUTPUT transform (INPUT const &input, FUNC const &func)
 
unsigned ceil_div (unsigned const dividend, unsigned const divisor)
 
template<typename T >
bool is_unordered_set_intersection_empty (std::unordered_set< T > const &r, std::unordered_set< T > const &s)
 
template<typename T >
void compute_unordered_set_intersection (std::unordered_set< T > *const dest, std::unordered_set< T > const &r, std::unordered_set< T > const &s)
 
template<class T , std::size_t... N>
constexpr T bswap_impl (T i, std::index_sequence< N...>)
 
template<class T , class U = typename std::make_unsigned<T>::type>
constexpr U bswap (T i)
 
template<class T >
constexpr T byteswap (T n) noexcept
 
constexpr auto heavyai_htons (std::uint16_t h)
 
constexpr auto heavyai_htonl (std::uint32_t h)
 
constexpr auto heavyai_htonll (std::uint64_t h)
 
constexpr auto heavyai_ntohs (std::uint16_t n)
 
constexpr auto heavyai_ntohl (std::uint32_t n)
 
constexpr auto heavyai_ntohll (std::uint64_t n)
 
std::shared_ptr
< apache::thrift::TConfiguration > 
default_tconfig ()
 

Variables

const std::string FILE_SORT_ORDER_BY_KEY = "FILE_SORT_ORDER_BY"
 
const std::string FILE_SORT_REGEX_KEY = "FILE_SORT_REGEX"
 
const std::string PATHNAME_ORDER_TYPE = "PATHNAME"
 
const std::string DATE_MODIFIED_ORDER_TYPE = "DATE_MODIFIED"
 
const std::string REGEX_ORDER_TYPE = "REGEX"
 
const std::string REGEX_DATE_ORDER_TYPE = "REGEX_DATE"
 
const std::string REGEX_NUMBER_ORDER_TYPE = "REGEX_NUMBER"
 
const std::array< std::string, 5 > supported_file_sort_order_types
 
const std::array< std::string, 2 > non_regex_sort_order_types
 
const std::array< std::string, 3 > regex_sort_order_types
 
const std::function< bool(const
std::string &, const
std::string &)> 
common_regex_date_comp_
 
const std::function< bool(const
std::string &, const
std::string &)> 
common_regex_number_comp_
 
const std::string kSystemCatalogName = "system_catalog"
 
const std::string kDefaultDbName = "heavyai"
 
const std::string kRootUsername = "admin"
 
const int kRootUserId = 0
 
const std::string kRootUserIdStr = "0"
 
const std::string kDefaultRootPasswd = "HyperInteractive"
 
const int32_t kTempUserIdRange = 1000000000
 
const std::string kInfoSchemaDbName = "information_schema"
 
const std::string kInfoSchemaMigrationName = "information_schema_db_created"
 
const std::string kDefaultExportDirName = "export"
 
const std::string kDefaultImportDirName = "import"
 
const std::string kDefaultDiskCacheDirName = "disk_cache"
 
const std::string kDefaultKeyFileName = "heavyai.pem"
 
const std::string kDefaultKeyStoreDirName = "key_store"
 
const std::string kDefaultLogDirName = "log"
 
const std::string kCatalogDirectoryName = "catalogs"
 
const std::string kDataDirectoryName = "data"
 
const std::string kLockfilesDirectoryName = "lockfiles"
 
const std::string kDefaultLicenseFileName = "heavyai.license"
 
static constexpr size_t kDefaultSampleRowsCount {100}
 

Typedef Documentation

using shared::LocalFileComparator = typedef std::function<bool(const std::string&, const std::string&)>

Definition at line 42 of file file_path_util.h.

Function Documentation

template<typename T >
size_t shared::append_move ( std::vector< T > &  destination,
std::vector< T > &&  source 
)

Definition at line 78 of file misc.h.

Referenced by RelAlgExecutor::createUnionWorkUnit().

78  {
79  if (source.empty()) {
80  return 0;
81  } else if (destination.empty()) {
82  destination = std::move(source);
83  return destination.size();
84  } else {
85  size_t const source_size = source.size();
86  destination.reserve(destination.size() + source_size);
87  std::move(std::begin(source), std::end(source), std::back_inserter(destination));
88  return source_size;
89  }
90 }

+ Here is the caller graph for this function:

template<typename TO , typename FROM >
TO shared::bit_cast ( FROM &&  from)
inline

Definition at line 307 of file misc.h.

Referenced by TargetExprCodegen::codegen(), GroupByAndAggregate::codegenAggColumnPtr(), CodeGenerator::codegenHoistedConstantsLoads(), GroupByAndAggregate::getAdditionalLiteral(), and ResultSet::isLessThan().

307  {
308 #if 202002L <= __cplusplus // C++20
309  if constexpr (sizeof(TO) <= sizeof(FROM)) {
310  return std::bit_cast<TO>(std::forward<FROM>(from));
311  } else {
312  TO to{0}; // std::bit_cast() has the undesirable feature of indeterminate bits.
313  memcpy(&to, &from, sizeof(FROM));
314  return to;
315  }
316 #else
317  TO to{0};
318  memcpy(&to, &from, sizeof(TO) < sizeof(FROM) ? sizeof(TO) : sizeof(FROM));
319  return to;
320 #endif
321 }
TO bit_cast(FROM &&from)
Definition: misc.h:307

+ Here is the caller graph for this function:

template<class T , class U = typename std::make_unsigned<T>::type>
constexpr U shared::bswap ( i)

Definition at line 435 of file misc.h.

Referenced by byteswap().

435  {
436  return bswap_impl<U>(i, std::make_index_sequence<sizeof(T)>{});
437 }

+ Here is the caller graph for this function:

template<class T , std::size_t... N>
constexpr T shared::bswap_impl ( i,
std::index_sequence< N...>   
)

Definition at line 429 of file misc.h.

References anonymous_namespace{Utm.h}::N, and heavydb.dtypes::T.

429  {
430  return ((((i >> (N * CHAR_BIT)) & (T)(unsigned char)(-1))
431  << ((sizeof(T) - 1 - N) * CHAR_BIT)) |
432  ...);
433 };
constexpr unsigned N
Definition: Utm.h:110
template<class T >
constexpr T shared::byteswap ( n)
noexcept

Definition at line 439 of file misc.h.

References bswap(), and anonymous_namespace{Utm.h}::n.

Referenced by heavyai_htonl(), heavyai_htonll(), heavyai_htons(), heavyai_ntohl(), heavyai_ntohll(), and heavyai_ntohs().

439  {
440  return bswap(n);
441 }
constexpr U bswap(T i)
Definition: misc.h:435
constexpr double n
Definition: Utm.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned shared::ceil_div ( unsigned const  dividend,
unsigned const  divisor 
)
inline

Definition at line 338 of file misc.h.

Referenced by Executor::numBlocksPerMP().

338  {
339  return (dividend + (divisor - 1)) / divisor;
340 }

+ Here is the caller graph for this function:

std::set< std::string > shared::check_for_rolled_off_file_paths ( const std::vector< std::string > &  all_file_paths,
std::vector< std::string > &  processed_file_paths 
)

Definition at line 181 of file file_path_util.cpp.

Referenced by foreign_storage::MultiFileReader::checkForRolledOffFiles(), and foreign_storage::ParquetDataWrapper::fetchChunkMetadata().

183  {
184  std::set<std::string> rolled_off_file_paths;
185  if (all_file_paths.empty()) {
186  // An empty all_file_paths vector implies that all files have been rolled off
187  rolled_off_file_paths.insert(processed_file_paths.begin(),
188  processed_file_paths.end());
189  } else {
190  auto roll_off_end_it = std::find(
191  processed_file_paths.begin(), processed_file_paths.end(), all_file_paths[0]);
192  for (auto it = processed_file_paths.begin(); it != roll_off_end_it; it++) {
193  rolled_off_file_paths.emplace(*it);
194  }
195  }
196  if (!rolled_off_file_paths.empty()) {
197  processed_file_paths.erase(
198  processed_file_paths.begin(),
199  processed_file_paths.begin() + rolled_off_file_paths.size());
200  }
201  return rolled_off_file_paths;
202 }

+ Here is the caller graph for this function:

size_t shared::compute_hash ( int32_t  item_1,
int32_t  item_2 
)

Definition at line 143 of file misc.cpp.

Referenced by PhysicalInput::hash(), shared::StringDictKey::hash(), shared::TableKey::hash(), and shared::ColumnKey::hash().

143  {
144  static_assert(sizeof(item_1) + sizeof(item_2) <= sizeof(size_t));
145  return (static_cast<size_t>(item_1) << (8 * sizeof(item_2))) |
146  (static_cast<size_t>(item_2));
147 }

+ Here is the caller graph for this function:

template<typename T >
void shared::compute_unordered_set_intersection ( std::unordered_set< T > *const  dest,
std::unordered_set< T > const &  r,
std::unordered_set< T > const &  s 
)

Definition at line 358 of file misc.h.

360  {
361  auto const& c_r = r.size() < s.size() ? r : s;
362  auto const& c_s = r.size() < s.size() ? s : r;
363  for (auto const& v : c_r) {
364  if (c_s.count(v)) {
365  dest->insert(v);
366  }
367  }
368 }
template<typename T , typename U >
bool shared::contains ( const T &  container,
const U &  element 
)
inline
std::string shared::convert_temporal_to_iso_format ( const SQLTypeInfo type_info,
int64_t  unix_time 
)

Definition at line 111 of file misc.cpp.

References CHECK_EQ, CHECK_GT, formatDate(), formatDateTime(), formatHMS(), SQLTypeInfo::get_precision(), SQLTypeInfo::get_type(), kDATE, kTIME, kTIMESTAMP, SQLTypeInfo::toString(), and UNREACHABLE.

Referenced by import_export::QueryExporterCSV::exportResults(), anonymous_namespace{DBHandler.cpp}::get_refresh_info(), import_export::anonymous_namespace{QueryExporterGDAL.cpp}::insert_array_column(), import_export::anonymous_namespace{QueryExporterGDAL.cpp}::insert_scalar_column(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::set_common_log_system_table_options(), and import_export::anonymous_namespace{QueryExporterCSV.cpp}::target_value_to_string().

112  {
113  std::string iso_str;
114  if (type_info.get_type() == kTIME) {
115  // Set a buffer size that can contain HH:MM:SS
116  iso_str.resize(8);
117  const auto len = shared::formatHMS(iso_str.data(), iso_str.length() + 1, unix_time);
118  CHECK_EQ(len, iso_str.length());
119  } else if (type_info.get_type() == kDATE) {
120  // Set a buffer size that can contain YYYYYYYYYYYY-mm-dd (int64_t can represent up to
121  // 12 digit years)
122  iso_str.resize(18);
123  const size_t len =
124  shared::formatDate(iso_str.data(), iso_str.length() + 1, unix_time);
125  CHECK_GT(len, static_cast<size_t>(0));
126  iso_str.resize(len);
127  } else if (type_info.get_type() == kTIMESTAMP) {
128  auto precision = type_info.get_precision();
129  // Set a buffer size that can contain the specified timestamp precision
130  // YYYYYYYYYYYY-mm-dd(18) T(1) HH:MM:SS(8) .(precision?) nnnnnnnnn(precision) Z(1)
131  // (int64_t can represent up to 12 digit years with seconds precision)
132  iso_str.resize(18 + 1 + 8 + bool(precision) + precision + 1);
133  const size_t len = shared::formatDateTime(
134  iso_str.data(), iso_str.length() + 1, unix_time, precision, true);
135  CHECK_GT(len, static_cast<size_t>(0));
136  iso_str.resize(len);
137  } else {
138  UNREACHABLE() << "Unexpected column type: " << type_info.toString();
139  }
140  return iso_str;
141 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
Definition: sqltypes.h:76
#define UNREACHABLE()
Definition: Logger.h:338
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
#define CHECK_GT(x, y)
Definition: Logger.h:305
size_t formatHMS(char *buf, size_t const max, int64_t const unixtime)
Definition: misc.cpp:98
std::string toString() const
Definition: sqltypes.h:525
int get_precision() const
Definition: sqltypes.h:394
size_t formatDate(char *buf, size_t const max, int64_t const unixtime)
Definition: misc.cpp:29
Definition: sqltypes.h:80
size_t formatDateTime(char *buf, size_t const max, int64_t const timestamp, int const dimension, bool use_iso_format)
Definition: misc.cpp:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string shared::decode_base64 ( const std::string &  val,
bool  trim_nulls 
)
inline

Definition at line 27 of file base64.h.

Referenced by decode_base64(), decode_base64_uri(), and anonymous_namespace{AbstractMLModel.h}::default_metadata().

27  {
28  // For some strings, signatature particualary it is important no to trim
29  // '\0' characters
30  using namespace boost::archive::iterators;
31  using It = transform_width<binary_from_base64<std::string::const_iterator>, 8, 6>;
32 
33  if (!trim_nulls) {
34  return std::string(It(val.begin()), It(val.end()));
35  }
36  return boost::algorithm::trim_right_copy_if(
37  std::string(It(std::begin(val)), It(std::end(val))),
38  [](char c) { return c == '\0'; });
39 }

+ Here is the caller graph for this function:

std::string shared::decode_base64 ( const std::string &  val)
inline

Definition at line 41 of file base64.h.

References decode_base64().

41  {
42  return decode_base64(val, true);
43 }
std::string decode_base64(const std::string &val, bool trim_nulls)
Definition: base64.h:27

+ Here is the call graph for this function:

std::string shared::decode_base64_uri ( const std::string &  data,
bool  trim_nulls 
)

Definition at line 21 of file base64.cpp.

References decode_base64(), and transform().

21  {
22  // Allocate a string large enough to hold exta '=' as padding
23  std::string uri_dec;
24  size_t data_len = data.length();
25  // base64_uri encoding removes '=' padding at the end of the string.
26  size_t padding = 4 - (data_len % 4);
27  if (padding == 4) {
28  padding = 0;
29  }
30  uri_dec.resize(data_len + padding);
31 
32  // base64_uri encoding replaces all '+' and '/' with '-' and '_' respectively.
34  data.begin(), data.end(), uri_dec.begin(), [](unsigned char c) -> unsigned char {
35  switch (c) {
36  case '-':
37  return '+';
38  case '_':
39  return '/';
40  default:
41  return c;
42  }
43  });
44  if (padding != 0) {
45  uri_dec.replace(uri_dec.begin() + data_len, uri_dec.end(), padding, '=');
46  }
47  // in the case of a signature from a JWT trim_nulls should be false
48  return decode_base64(uri_dec, trim_nulls);
49 }
OUTPUT transform(INPUT const &input, FUNC const &func)
Definition: misc.h:329
std::string decode_base64(const std::string &val, bool trim_nulls)
Definition: base64.h:27

+ Here is the call graph for this function:

std::shared_ptr<apache::thrift::TConfiguration> shared::default_tconfig ( )
inline

Definition at line 26 of file ThriftConfig.h.

Referenced by ThriftClientConnection::open_buffered_client_transport().

26  {
27  return std::make_shared<apache::thrift::TConfiguration>(
28  std::numeric_limits<int32_t>::max());
29 }

+ Here is the caller graph for this function:

DivUMod shared::divUMod ( int64_t  num,
int64_t  den 
)
inline

Definition at line 185 of file misc.h.

References shared::DivUMod::quot.

Referenced by formatDate(), and formatDateTime().

185  {
186  DivUMod div{num / den, num % den};
187  if (div.rem < 0) {
188  --div.quot;
189  div.rem += den;
190  }
191  return div;
192 }

+ Here is the caller graph for this function:

template<typename... Ts, typename T >
bool shared::dynamic_castable_to_any ( T const *  ptr)

Definition at line 93 of file misc.h.

93  {
94  return (... || dynamic_cast<Ts const*>(ptr));
95 }
static std::string shared::encode_base64 ( const std::string &  val)
inlinestatic

Definition at line 45 of file base64.h.

Referenced by Parser::CreateModelStmt::train_model().

45  {
46  using namespace boost::archive::iterators;
47  using It = base64_from_binary<transform_width<std::string::const_iterator, 6, 8>>;
48  auto tmp = std::string(It(std::begin(val)), It(std::end(val)));
49  return tmp.append((3 - val.size() % 3) % 3, '=');
50 }

+ Here is the caller graph for this function:

void shared::execute_over_contiguous_indices ( const std::vector< size_t > &  indices,
std::function< void(const size_t, const size_t)>  to_execute 
)

Definition at line 22 of file Iteration.h.

Referenced by DateDaysEncoder< T, V >::appendEncodedDataAtIndices(), FixedLengthEncoder< T, V >::appendEncodedDataAtIndices(), and NoneEncoder< T >::appendEncodedDataAtIndices().

24  {
25  size_t start_pos = 0;
26 
27  while (start_pos < indices.size()) {
28  size_t end_pos = indices.size();
29  for (size_t i = start_pos + 1; i < indices.size(); ++i) {
30  if (indices[i] != indices[i - 1] + 1) {
31  end_pos = i;
32  break;
33  }
34  }
35  to_execute(start_pos, end_pos);
36  start_pos = end_pos;
37  }
38 }

+ Here is the caller graph for this function:

DEVICE double shared::fastAtanh ( double const  x)
inline

Definition at line 224 of file misc.h.

References horner().

Referenced by Transform4326ToUTM::Transform4326ToUTM().

224  {
225  // Mathematica: CoefficientList[Normal@Series[ArcTanh[x],{x,0,16}],x] // InputForm
226  return x * horner(x * x, 1, 1 / 3., 1 / 5., 1 / 7., 1 / 9., 1 / 11., 1 / 13., 1 / 15.);
227 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:214

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DEVICE double shared::fastCos ( double const  x)
inline

Definition at line 230 of file misc.h.

References horner().

Referenced by Transform4326ToUTM::Transform4326ToUTM().

230  {
231  // Mathematica: CoefficientList[Normal@Series[Cos[x],{x,0,16}],x] // InputForm
232  // clang-format off
233  return horner(x * x, 1, -1/2., 1/24., -1/720., 1/40320., -1/3628800.,
234  1/479001600., -1/87178291200., 1/20922789888000.);
235  // clang-format on
236 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:214

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DEVICE double shared::fastCosh ( double const  x)
inline

Definition at line 239 of file misc.h.

References horner().

Referenced by Transform4326ToUTM::calculateY(), TransformUTMTo4326::calculateY(), and TransformUTMTo4326::TransformUTMTo4326().

239  {
240  // Mathematica: CoefficientList[Normal@Series[Cosh[x],{x,0,16}],x] // InputForm
241  // clang-format off
242  return horner(x * x, 1, 1/2., 1/24., 1/720., 1/40320., 1/3628800.,
243  1/479001600., 1/87178291200., 1/20922789888000.);
244  // clang-format on
245 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:214

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DEVICE double shared::fastSin ( double const  x)
inline

Definition at line 248 of file misc.h.

References horner().

Referenced by Transform4326ToUTM::Transform4326ToUTM().

248  {
249  // Mathematica: CoefficientList[Normal@Series[Sin[x],{x,0,16}],x] // InputForm
250  // clang-format off
251  return x * horner(x * x, 1, -1/6., 1/120., -1/5040., 1/362880.,
252  -1/39916800., 1/6227020800., -1/1307674368000.);
253  // clang-format on
254 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:214

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DEVICE double shared::fastSinh ( double const  x)
inline

Definition at line 257 of file misc.h.

References horner().

Referenced by Transform4326ToUTM::calculateX(), TransformUTMTo4326::calculateX(), and TransformUTMTo4326::TransformUTMTo4326().

257  {
258  // Mathematica: CoefficientList[Normal@Series[Sinh[x],{x,0,16}],x] // InputForm
259  // clang-format off
260  return x * horner(x * x, 1, 1/6., 1/120., 1/5040., 1/362880.,
261  1/39916800., 1/6227020800., 1/1307674368000.);
262  // clang-format on
263 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:214

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool shared::file_or_glob_path_exists ( const std::string &  path)

Definition at line 177 of file file_path_util.cpp.

References heavyai::glob().

Referenced by DBHandler::detect_column_types(), and DBHandler::import_table().

177  {
178  return boost::filesystem::exists(path) || !heavyai::glob(path).empty();
179 }
std::vector< std::string > glob(const std::string &pattern)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t shared::formatDate ( char *  buf,
size_t const  max,
int64_t const  unixtime 
)

Definition at line 29 of file misc.cpp.

References divUMod(), shared::DivUMod::quot, and shared::DivUMod::rem.

Referenced by convert_temporal_to_iso_format(), convert_to_string_and_encode_date(), and DatumToString().

29  {
30  DivUMod const div_day = divUMod(unixtime, 24 * 60 * 60);
31  DivUMod const div_era = divUMod(div_day.quot - 11017, 146097);
32  unsigned const doe = static_cast<unsigned>(div_era.rem);
33  unsigned const yoe = (doe - doe / 1460 + doe / 36524 - (doe == 146096)) / 365;
34  unsigned const doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
35  unsigned const moy = (5 * doy + 2) / 153;
36  static_assert(8 <= sizeof(long long)); // long long needed for snprintf()
37  long long const y = 2000 + div_era.quot * 400 + yoe + (9 < moy);
38  unsigned const m = moy + (9 < moy ? -9 : 3);
39  unsigned const d = doy - (153 * moy + 2) / 5 + 1;
40  int const len = snprintf(buf, max, "%04lld-%02u-%02u", y, m, d);
41  if (0 <= len && static_cast<size_t>(len) < max) {
42  return static_cast<size_t>(len);
43  }
44  return 0;
45 }
DivUMod divUMod(int64_t num, int64_t den)
Definition: misc.h:185

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t shared::formatDateTime ( char *  buf,
size_t const  max,
int64_t const  timestamp,
int const  dimension,
bool  use_iso_format 
)

Definition at line 47 of file misc.cpp.

References divUMod(), shared::DivUMod::quot, and shared::DivUMod::rem.

Referenced by convert_temporal_to_iso_format(), convert_to_string_and_encode_timestamp(), and DatumToString().

51  {
52  constexpr int pow10[10]{
53  1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
54  DivUMod const div_hip = divUMod(timestamp, pow10[dimension]);
55  DivUMod const div_day = divUMod(div_hip.quot, 24 * 60 * 60);
56  DivUMod const div_era = divUMod(div_day.quot - 11017, 146097);
57  unsigned const doe = static_cast<unsigned>(div_era.rem);
58  unsigned const yoe = (doe - doe / 1460 + doe / 36524 - (doe == 146096)) / 365;
59  unsigned const doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
60  unsigned const moy = (5 * doy + 2) / 153;
61  static_assert(8 <= sizeof(long long)); // long long needed for snprintf()
62  long long const y = 2000 + div_era.quot * 400 + yoe + (9 < moy);
63  unsigned const m = moy + (9 < moy ? -9 : 3);
64  unsigned const d = doy - (153 * moy + 2) / 5 + 1;
65  unsigned const minutes = static_cast<unsigned>(div_day.rem) / 60;
66  unsigned const ss = div_day.rem % 60;
67  unsigned const hh = minutes / 60;
68  unsigned const mm = minutes % 60;
69  const char* date_time_format;
70  if (use_iso_format) {
71  if (dimension) {
72  date_time_format = "%04lld-%02u-%02uT%02u:%02u:%02u";
73  } else {
74  date_time_format = "%04lld-%02u-%02uT%02u:%02u:%02uZ";
75  }
76  } else {
77  date_time_format = "%04lld-%02u-%02u %02u:%02u:%02u";
78  }
79  int const len = snprintf(buf, max, date_time_format, y, m, d, hh, mm, ss);
80  if (0 <= len && static_cast<size_t>(len) < max) {
81  if (dimension) {
82  auto precision_format = use_iso_format ? ".%0*dZ" : ".%0*d";
83  int const len_frac = snprintf(buf + len,
84  max - len,
85  precision_format,
86  dimension,
87  static_cast<int>(div_hip.rem));
88  if (0 <= len_frac && static_cast<size_t>(len + len_frac) < max) {
89  return static_cast<size_t>(len + len_frac);
90  }
91  } else {
92  return static_cast<size_t>(len);
93  }
94  }
95  return 0;
96 }
DivUMod divUMod(int64_t num, int64_t den)
Definition: misc.h:185

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t shared::formatHMS ( char *  buf,
size_t const  max,
int64_t const  unixtime 
)

Definition at line 98 of file misc.cpp.

References unsignedMod().

Referenced by convert_temporal_to_iso_format(), convert_to_string_and_encode_time(), and DatumToString().

98  {
99  unsigned const seconds = static_cast<unsigned>(unsignedMod(unixtime, 24 * 60 * 60));
100  unsigned const minutes = seconds / 60;
101  unsigned const ss = seconds % 60;
102  unsigned const hh = minutes / 60;
103  unsigned const mm = minutes % 60;
104  int const len = snprintf(buf, max, "%02u:%02u:%02u", hh, mm, ss);
105  if (0 <= len && static_cast<size_t>(len) < max) {
106  return static_cast<size_t>(len);
107  }
108  return 0;
109 }
uint64_t unsignedMod(int64_t num, int64_t den)
Definition: misc.h:195

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename K , typename V , typename comp >
V& shared::get_from_map ( std::map< K, V, comp > &  map,
const K &  key 
)

Definition at line 62 of file misc.h.

References CHECK.

Referenced by foreign_storage::append_data_block_to_chunk(), anonymous_namespace{ForeignDataImporter.cpp}::create_fragment_buffers(), foreign_storage::CachingForeignStorageMgr::createDataWrapperIfNotExists(), Buffer_Namespace::TieredCpuBufferMgr::getAllocatorForSlab(), import_export::RasterImporter::import(), foreign_storage::ParquetDataWrapper::initializeChunkBuffers(), anonymous_namespace{ForeignDataImporter.cpp}::load_foreign_data_buffers(), foreign_storage::ParquetDataWrapper::loadBuffersUsingLazyParquetChunkLoader(), foreign_storage::LazyParquetChunkLoader::loadRowGroups(), foreign_storage::ParquetDataWrapper::metadataScanRowGroupIntervals(), foreign_storage::partition_data_blocks(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::populate_encoder_map_for_import(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::populate_encoder_map_for_metadata_scan(), foreign_storage::ParquetDataWrapper::removeMetadataForLastFile(), Catalog_Namespace::Catalog::updateInColumnMap(), foreign_storage::AbstractTextFileDataWrapper::updateMetadata(), foreign_storage::ParquetDataWrapper::updateMetadataForRolledOffFiles(), and foreign_storage::AbstractTextFileDataWrapper::updateRolledOffChunks().

62  {
63  auto find_it = map.find(key);
64  CHECK(find_it != map.end());
65  return find_it->second;
66 }
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

template<typename K , typename V , typename comp >
const V& shared::get_from_map ( const std::map< K, V, comp > &  map,
const K &  key 
)

Definition at line 69 of file misc.h.

References CHECK.

69  {
70  auto find_it = map.find(key);
71  CHECK(find_it != map.end());
72  return find_it->second;
73 }
#define CHECK(condition)
Definition: Logger.h:291
unsigned shared::getExpOfTwo ( unsigned  n)

Definition at line 23 of file MathUtils.cpp.

23  {
24  unsigned i = 0;
25 
26  while ((n = n >> 1)) {
27  ++i;
28  }
29 
30  return i;
31 }
constexpr double n
Definition: Utm.h:38
size_t shared::hash_value ( const FullyQualifiedTableName &  table_name)

Definition at line 50 of file FullyQualifiedTableName.cpp.

References shared::FullyQualifiedTableName::hash().

50  {
51  return table_name.hash();
52 }

+ Here is the call graph for this function:

size_t shared::hash_value ( const TableKey &  table_key)

Definition at line 79 of file DbObjectKeys.cpp.

References shared::TableKey::hash().

79  {
80  return table_key.hash();
81 }

+ Here is the call graph for this function:

constexpr auto shared::heavyai_htonl ( std::uint32_t  h)
inline

Definition at line 465 of file misc.h.

References byteswap().

465  {
466  return (shared::endian::native == shared::endian::big) ? h : shared::byteswap(h);
467 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:439

+ Here is the call graph for this function:

constexpr auto shared::heavyai_htonll ( std::uint64_t  h)
inline

Definition at line 469 of file misc.h.

References byteswap().

469  {
470  return (shared::endian::native == shared::endian::big) ? h : shared::byteswap(h);
471 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:439

+ Here is the call graph for this function:

constexpr auto shared::heavyai_htons ( std::uint16_t  h)
inline

Definition at line 461 of file misc.h.

References byteswap().

461  {
462  return (shared::endian::native == shared::endian::big) ? h : shared::byteswap(h);
463 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:439

+ Here is the call graph for this function:

constexpr auto shared::heavyai_ntohl ( std::uint32_t  n)
inline

Definition at line 477 of file misc.h.

References byteswap().

477  {
478  return (shared::endian::native == shared::endian::big) ? n : shared::byteswap(n);
479 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:439
constexpr double n
Definition: Utm.h:38

+ Here is the call graph for this function:

constexpr auto shared::heavyai_ntohll ( std::uint64_t  n)
inline

Definition at line 481 of file misc.h.

References byteswap().

481  {
482  return (shared::endian::native == shared::endian::big) ? n : shared::byteswap(n);
483 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:439
constexpr double n
Definition: Utm.h:38

+ Here is the call graph for this function:

constexpr auto shared::heavyai_ntohs ( std::uint16_t  n)
inline

Definition at line 473 of file misc.h.

References byteswap().

473  {
474  return (shared::endian::native == shared::endian::big) ? n : shared::byteswap(n);
475 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:439
constexpr double n
Definition: Utm.h:38

+ Here is the call graph for this function:

template<typename... COEFFICIENTS>
DEVICE constexpr double shared::horner ( double const  x,
double const  c0,
COEFFICIENTS...  c 
)

Definition at line 214 of file misc.h.

Referenced by fastAtanh(), fastCos(), fastCosh(), fastSin(), and fastSinh().

214  {
215  if constexpr (sizeof...(COEFFICIENTS) == 0) { // NOLINT
216  return c0;
217  } else {
218  return horner(x, c...) * x + c0;
219  }
220  return {}; // quiet nvcc warning https://stackoverflow.com/a/64561686/2700898
221 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:214

+ Here is the caller graph for this function:

template<size_t N>
constexpr std::array<double, N> shared::inversePowersOf ( double const  a)

Definition at line 279 of file misc.h.

References anonymous_namespace{misc.h}::inversePowersOfImpl().

279  {
280  return inversePowersOfImpl(a, std::make_index_sequence<N>{});
281 }
constexpr double a
Definition: Utm.h:32
constexpr std::array< double, sizeof...(Indices)> inversePowersOfImpl(double const a, std::index_sequence< Indices...>)
Definition: misc.h:51

+ Here is the call graph for this function:

template<int... values, typename T >
bool shared::is_any ( T &&  value)
inline

Definition at line 267 of file misc.h.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::is_agg(), and is_regression_model().

267  {
268  return (... || (values == value));
269 }

+ Here is the caller graph for this function:

bool shared::is_compressed_file_extension ( const std::string &  location)

Definition at line 49 of file file_type.cpp.

References contains().

Referenced by foreign_storage::LocalMultiFileReader::insertFile(), and foreign_storage::LocalMultiFileReader::LocalMultiFileReader().

49  {
50  static const std::vector<std::string> compressed_exts = {
51  ".7z", ".bz", ".bz2", ".gz", ".rar", ".tar", ".zip", ".tgz"};
52  return shared::contains(compressed_exts,
53  boost::filesystem::path(location).extension().string());
54 }
bool contains(const T &container, const U &element)
Definition: misc.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool shared::is_compressed_mime_type ( const std::string &  mime_type)

Definition at line 34 of file file_type.cpp.

References contains().

34  {
35  // strips possible vender (vnd.), personal (prs.) & unregistered (x.) prefixes from the
36  // mime-type
37  static const std::regex mime_prefix("\\/(vnd|prs|x)(\\.|-)");
38  const auto mime_type_no_prefix = std::regex_replace(mime_type, mime_prefix, "/");
39  static const std::vector<std::string> compressed_types = {"application/7z-compressed",
40  "application/bzip",
41  "application/bzip2",
42  "application/gzip",
43  "application/rar",
44  "application/tar",
45  "application/zip"};
46  return shared::contains(compressed_types, mime_type_no_prefix);
47 }
bool contains(const T &container, const U &element)
Definition: misc.h:204

+ Here is the call graph for this function:

bool shared::is_s3_uri ( const std::string &  file_path)

Definition at line 204 of file file_path_util.cpp.

Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignServerProxy(), foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), import_export::ForeignDataImporter::import(), import_export::ForeignDataImporter::importGeneralS3(), and TableArchiver::restoreTable().

204  {
205  const std::string s3_prefix = "s3://";
206  return file_path.find(s3_prefix) != std::string::npos;
207 }

+ Here is the caller graph for this function:

template<typename T >
bool shared::is_unordered_set_intersection_empty ( std::unordered_set< T > const &  r,
std::unordered_set< T > const &  s 
)

Definition at line 345 of file misc.h.

346  {
347  auto const& c_r = r.size() < s.size() ? r : s;
348  auto const& c_s = r.size() < s.size() ? s : r;
349  for (auto const& v : c_r) {
350  if (c_s.count(v)) {
351  return false;
352  }
353  }
354  return true;
355 }
bool shared::isPowOfTwo ( unsigned  n)

Definition at line 19 of file MathUtils.cpp.

19  {
20  return (n & (n - 1)) == 0;
21 }
constexpr double n
Definition: Utm.h:38
std::vector< std::string > shared::local_glob_filter_sort_files ( const std::string &  file_path,
const FilePathOptions &  options,
const bool  recurse 
)

Definition at line 112 of file file_path_util.cpp.

References shared::FilePathOptions::filter_regex, shared::anonymous_namespace{file_path_util.cpp}::glob_local_recursive_files(), PATHNAME_ORDER_TYPE, shared::anonymous_namespace{file_path_util.cpp}::regex_file_filter(), and shared::FilePathOptions::sort_by.

Referenced by import_export::DataStreamSink::archivePlumber(), DBHandler::detect_column_types(), ddl_utils::get_expanded_file_paths(), foreign_storage::ParquetDataWrapper::getAllFilePaths(), foreign_storage::LocalMultiFileReader::getAllFilePaths(), DBHandler::importGeoTableGlobFilterSort(), and foreign_storage::LocalMultiFileReader::LocalMultiFileReader().

114  {
115  auto result_files = glob_local_recursive_files(file_path, recurse);
116  if (options.filter_regex.has_value()) {
117  result_files = regex_file_filter(options.filter_regex.value(), result_files);
118  }
119  // initial lexicographical order ensures a determinisitc ordering for files not matching
120  // sort_regex
121  FilePathOptions temp_options;
122  temp_options.sort_by = PATHNAME_ORDER_TYPE;
123  auto initial_file_order = FileOrderLocal(temp_options);
124  auto lexi_comp = initial_file_order.getFileComparator();
125  std::stable_sort(result_files.begin(), result_files.end(), lexi_comp);
126 
127  auto file_order = FileOrderLocal(options);
128  auto comp = file_order.getFileComparator();
129  std::stable_sort(result_files.begin(), result_files.end(), comp);
130  return result_files;
131 }
const std::string PATHNAME_ORDER_TYPE
std::vector< std::string > glob_local_recursive_files(const std::string &file_path, const bool recurse)
std::vector< std::string > regex_file_filter(const std::string &pattern, const std::vector< std::string > &file_paths)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::ostream& shared::operator<< ( std::ostream &  os,
const FullyQualifiedTableName &  table_name 
)

Definition at line 37 of file FullyQualifiedTableName.cpp.

References shared::FullyQualifiedTableName::db_name, and shared::FullyQualifiedTableName::table_name.

37  {
38  os << "(db_name: " << table_name.db_name << ", table_name: " << table_name.table_name
39  << ")";
40  return os;
41 }
std::ostream& shared::operator<< ( std::ostream &  os,
const StringDictKey &  dict_key 
)

Definition at line 39 of file DbObjectKeys.cpp.

References shared::StringDictKey::db_id, and shared::StringDictKey::dict_id.

39  {
40  os << "(db_id: " << dict_key.db_id << ", string_dict_id: " << dict_key.dict_id << ")";
41  return os;
42 }
std::ostream& shared::operator<< ( std::ostream &  os,
const TableKey &  table_key 
)

Definition at line 70 of file DbObjectKeys.cpp.

References shared::TableKey::db_id, and shared::TableKey::table_id.

70  {
71  os << "(db_id: " << table_key.db_id << ", table_id: " << table_key.table_id << ")";
72  return os;
73 }
std::ostream& shared::operator<< ( std::ostream &  os,
const ColumnKey &  column_key 
)

Definition at line 102 of file DbObjectKeys.cpp.

References shared::ColumnKey::column_id, shared::ColumnKey::db_id, and shared::ColumnKey::table_id.

102  {
103  os << "(db_id: " << column_key.db_id << ", table_id: " << column_key.table_id
104  << ", column_id: " << column_key.column_id << ")";
105  return os;
106 }
template<typename OSTREAM , typename CONTAINER >
OSTREAM& shared::operator<< ( OSTREAM &  os,
PrintContainer< CONTAINER >  pc 
)

Definition at line 126 of file misc.h.

References printContainer().

126  {
127  if (pc.container.empty()) {
128  return os << "()";
129  } else {
130  if constexpr (is_std_container<typename CONTAINER::value_type>::value) { // NOLINT
131  os << '(';
132  for (auto& container : pc.container) {
133  os << printContainer(container);
134  }
135  } else {
136  for (auto itr = pc.container.begin(); itr != pc.container.end(); ++itr) {
137  if constexpr (std::is_pointer_v<typename CONTAINER::value_type>) { // NOLINT
138  os << (itr == pc.container.begin() ? '(' : ' ') << (void const*)*itr;
139  } else {
140  os << (itr == pc.container.begin() ? '(' : ' ') << *itr;
141  }
142  }
143  }
144  return os << ')';
145  }
146 }
PrintContainer< CONTAINER > printContainer(CONTAINER &container)
Definition: misc.h:108

+ Here is the call graph for this function:

std::ostream & shared::operator<< ( std::ostream &  os,
FileContentsEscaper const &  fce 
)

Definition at line 190 of file misc.cpp.

References shared::FileContentsEscaper::quoteAndPrint().

190  {
191  fce.quoteAndPrint(os);
192  return os;
193 }

+ Here is the call graph for this function:

double shared::power10 ( unsigned const  x)
inline

Definition at line 284 of file misc.h.

References anonymous_namespace{Utm.h}::N.

Referenced by CodeGenerator::codegenCastToFp(), Analyzer::anonymous_namespace{Analyzer.cpp}::floatFromDecimal(), and pg_shim().

284  {
285  constexpr unsigned N = 20;
286  constexpr auto pow10 = powersOf<double, N>(10.0);
287  return x < N ? pow10[x] : (pow10[N - 1] * 10) * power10(x - N);
288 }
double power10(unsigned const x)
Definition: misc.h:284
constexpr unsigned N
Definition: Utm.h:110

+ Here is the caller graph for this function:

double shared::power10inv ( unsigned const  x)
inline

Definition at line 291 of file misc.h.

References anonymous_namespace{Utm.h}::N.

Referenced by convert_to_string_and_encode_decimal().

291  {
292  constexpr unsigned N = 20;
293  constexpr auto pow10inv = inversePowersOf<N>(10.0);
294  return x < N ? pow10inv[x] : (pow10inv[N - 1] / 10) * power10inv(x - N);
295 }
double power10inv(unsigned const x)
Definition: misc.h:291
constexpr unsigned N
Definition: Utm.h:110

+ Here is the caller graph for this function:

template<typename T , size_t N>
constexpr std::array<T, N> shared::powersOf ( T const  a)

Definition at line 273 of file misc.h.

References anonymous_namespace{Utm.h}::a.

273  {
274  return powersOfImpl<T>(a, std::make_index_sequence<N>{});
275 }
constexpr double a
Definition: Utm.h:32
template<typename CONTAINER >
PrintContainer<CONTAINER> shared::printContainer ( CONTAINER &  container)
template<typename TO , typename FROM >
TO shared::reinterpret_bits ( FROM const  from)
inline

Definition at line 300 of file misc.h.

300  {
301  TO to{0};
302  memcpy(&to, &from, sizeof(TO) < sizeof(FROM) ? sizeof(TO) : sizeof(FROM));
303  return to;
304 }
template<typename... STR>
constexpr std::array<std::string_view, sizeof...(STR)> shared::string_view_array ( STR &&...  str)

Definition at line 324 of file misc.h.

324  {
325  return {std::forward<STR>(str)...};
326 }
void shared::throw_file_not_found ( const std::string &  file_path)
inline

Definition at line 78 of file file_path_util.h.

Referenced by shared::anonymous_namespace{file_path_util.cpp}::glob_local_recursive_files().

78  {
79  throw FileNotFoundException{"File or directory \"" + file_path + "\" does not exist."};
80 }

+ Here is the caller graph for this function:

void shared::throw_no_filter_match ( const std::string &  pattern)
inline

Definition at line 88 of file file_path_util.h.

Referenced by shared::anonymous_namespace{file_path_util.cpp}::regex_file_filter(), and foreign_storage::anonymous_namespace{S3FilePathUtil.cpp}::s3_objects_regex_file_filter().

88  {
89  throw NoRegexFilterMatchException{"No files matched the regex file path \"" + pattern +
90  "\"."};
91 }

+ Here is the caller graph for this function:

template<typename OUTPUT , typename INPUT , typename FUNC >
OUTPUT shared::transform ( INPUT const &  input,
FUNC const &  func 
)

Definition at line 329 of file misc.h.

Referenced by anonymous_namespace{ArrowResultSetConverter.cpp}::appendToColumnBuilder(), anonymous_namespace{ArrowResultSetConverter.cpp}::appendToListColumnBuilder(), anonymous_namespace{ArrowResultSetConverter.cpp}::appendToListColumnBuilder< arrow::StringDictionaryBuilder, int64_t >(), StringDictionaryProxy::buildIntersectionTranslationMapToOtherProxyUnlocked(), ResultSetReductionJIT::cacheKey(), HashJoin::collectFragmentIds(), UdfCompiler::compileFromCommandLine(), decode_base64_uri(), import_export::Detector::detect_sqltype(), TableArchiver::dumpTable(), ThriftSerializers::from_thrift(), UdfCompiler::generateAST(), Parser::LikeExpr::get(), data_conversion::anonymous_namespace{StringViewSource.h}::get_materialized_string_views(), anonymous_namespace{RelAlgExecutor.cpp}::get_raw_pointers(), anonymous_namespace{ResultSetReductionInterpreter.cpp}::get_value_types(), ShowTableDetailsCommand::getFilteredTableNames(), anonymous_namespace{ResultSetReductionCodegen.cpp}::llvm_args(), parse_stats_requests_json(), ArrowForeignStorageBase::read(), TableArchiver::restoreTable(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), to_lower(), ThriftSerializers::to_thrift(), to_upper(), com.mapd.parser.extension.ddl.SqlLeadLag::transformType(), anonymous_namespace{ResultSetReductionCodegen.cpp}::translate_body(), and anonymous_namespace{ExternalExecutor.cpp}::vt_create().

329  {
330  OUTPUT output;
331  output.reserve(input.size());
332  for (auto const& x : input) {
333  output.push_back(func(x));
334  }
335  return output;
336 }

+ Here is the caller graph for this function:

uint64_t shared::unsignedMod ( int64_t  num,
int64_t  den 
)
inline

Definition at line 195 of file misc.h.

Referenced by formatHMS().

195  {
196  int64_t mod = num % den;
197  if (mod < 0) {
198  mod += den;
199  }
200  return mod;
201 }

+ Here is the caller graph for this function:

void shared::validate_sort_options ( const FilePathOptions &  options)

Definition at line 32 of file file_path_util.cpp.

References contains(), FILE_SORT_ORDER_BY_KEY, FILE_SORT_REGEX_KEY, join(), non_regex_sort_order_types, PATHNAME_ORDER_TYPE, regex_sort_order_types, shared::FilePathOptions::sort_by, shared::FilePathOptions::sort_regex, supported_file_sort_order_types, and to_upper().

Referenced by import_export::DataStreamSink::archivePlumber(), import_export::ForeignDataImporter::importGeneralS3(), DBHandler::importGeoTableGlobFilterSort(), and foreign_storage::AbstractFileStorageDataWrapper::validateTableOptions().

32  {
33  const auto sort_by_str = to_upper(options.sort_by.value_or(PATHNAME_ORDER_TYPE));
34 
36  throw std::runtime_error{FILE_SORT_ORDER_BY_KEY +
37  " must be one of the following options: " +
39  }
40 
41  if (shared::contains(non_regex_sort_order_types, sort_by_str) &&
42  options.sort_regex.has_value()) {
43  throw std::runtime_error{"Option \"" + FILE_SORT_REGEX_KEY +
44  "\" must not be set for selected option \"" +
45  FILE_SORT_ORDER_BY_KEY + "='" + sort_by_str + "'\"."};
46  }
47 
48  if (shared::contains(regex_sort_order_types, sort_by_str) &&
49  !options.sort_regex.has_value()) {
50  throw std::runtime_error{"Option \"" + FILE_SORT_REGEX_KEY +
51  "\" must be set for selected option \"" +
52  FILE_SORT_ORDER_BY_KEY + "='" + sort_by_str + "'\"."};
53  }
54 }
bool contains(const T &container, const U &element)
Definition: misc.h:204
const std::array< std::string, 2 > non_regex_sort_order_types
const std::string FILE_SORT_REGEX_KEY
std::string join(T const &container, std::string const &delim)
const std::string PATHNAME_ORDER_TYPE
const std::string FILE_SORT_ORDER_BY_KEY
std::string to_upper(const std::string &str)
const std::array< std::string, 5 > supported_file_sort_order_types
const std::array< std::string, 3 > regex_sort_order_types

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const std::function<bool(const std::string&, const std::string&)> shared::common_regex_date_comp_
Initial value:
= [](const std::string& lhs, const std::string& rhs) -> bool {
int64_t lhs_t;
int64_t rhs_t;
try {
lhs_t = dateTimeParse<kDATE>(lhs, 0);
} catch (const std::exception& e) {
lhs_t = 0;
}
try {
rhs_t = dateTimeParse<kDATE>(rhs, 0);
} catch (const std::exception& e) {
rhs_t = 0;
}
return lhs_t < rhs_t;
}

Definition at line 112 of file file_path_util.h.

const std::function<bool(const std::string&, const std::string&)> shared::common_regex_number_comp_
Initial value:
=
[](const std::string& lhs, const std::string& rhs) -> bool {
int64_t lhs_i;
int64_t rhs_i;
try {
lhs_i = stoll(lhs, 0);
} catch (const std::exception& e) {
lhs_i = 0;
}
try {
rhs_i = stoll(rhs, 0);
} catch (const std::exception& e) {
rhs_i = 0;
}
return lhs_i < rhs_i;
}

Definition at line 128 of file file_path_util.h.

const std::string shared::DATE_MODIFIED_ORDER_TYPE = "DATE_MODIFIED"
inline

Definition at line 52 of file file_path_util.h.

const std::string shared::FILE_SORT_ORDER_BY_KEY = "FILE_SORT_ORDER_BY"
inline

Definition at line 48 of file file_path_util.h.

Referenced by validate_sort_options().

const std::string shared::FILE_SORT_REGEX_KEY = "FILE_SORT_REGEX"
inline

Definition at line 49 of file file_path_util.h.

Referenced by validate_sort_options().

const std::string shared::kDefaultDiskCacheDirName = "disk_cache"
inline
const std::string shared::kDefaultKeyFileName = "heavyai.pem"
inline

Definition at line 38 of file SysDefinitions.h.

Referenced by migrations::MigrationMgr::executeRebrandMigration().

const std::string shared::kDefaultKeyStoreDirName = "key_store"
inline

Definition at line 39 of file SysDefinitions.h.

Referenced by migrations::MigrationMgr::executeRebrandMigration().

const std::string shared::kDefaultLicenseFileName = "heavyai.license"
inline
const std::string shared::kDefaultLogDirName = "log"
inline
const std::string shared::kDefaultRootPasswd = "HyperInteractive"
inline
constexpr size_t shared::kDefaultSampleRowsCount {100}
static

Definition at line 45 of file SysDefinitions.h.

Referenced by DBHandler::detect_column_types().

const std::string shared::kInfoSchemaMigrationName = "information_schema_db_created"
inline
const std::string shared::kRootUserIdStr = "0"
inline

Definition at line 30 of file SysDefinitions.h.

Referenced by Catalog_Namespace::SysCatalog::initDB().

const int32_t shared::kTempUserIdRange = 1000000000
inline

Definition at line 32 of file SysDefinitions.h.

const std::array<std::string, 2> shared::non_regex_sort_order_types
inline
Initial value:
{
const std::string PATHNAME_ORDER_TYPE
const std::string DATE_MODIFIED_ORDER_TYPE

Definition at line 64 of file file_path_util.h.

Referenced by validate_sort_options().

const std::string shared::PATHNAME_ORDER_TYPE = "PATHNAME"
inline
const std::string shared::REGEX_DATE_ORDER_TYPE = "REGEX_DATE"
inline

Definition at line 54 of file file_path_util.h.

const std::string shared::REGEX_NUMBER_ORDER_TYPE = "REGEX_NUMBER"
inline

Definition at line 55 of file file_path_util.h.

const std::string shared::REGEX_ORDER_TYPE = "REGEX"
inline

Definition at line 53 of file file_path_util.h.

const std::array<std::string, 3> shared::regex_sort_order_types
inline
Initial value:
const std::string REGEX_NUMBER_ORDER_TYPE
const std::string REGEX_ORDER_TYPE
const std::string REGEX_DATE_ORDER_TYPE

Definition at line 68 of file file_path_util.h.

Referenced by validate_sort_options().

const std::array<std::string, 5> shared::supported_file_sort_order_types
inline
Initial value:
{
const std::string REGEX_NUMBER_ORDER_TYPE
const std::string REGEX_ORDER_TYPE
const std::string REGEX_DATE_ORDER_TYPE
const std::string PATHNAME_ORDER_TYPE
const std::string DATE_MODIFIED_ORDER_TYPE

Definition at line 57 of file file_path_util.h.

Referenced by validate_sort_options().