OmniSciDB  72c90bc290
 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  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)
 
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 77 of file misc.h.

Referenced by RelAlgExecutor::createUnionWorkUnit().

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

+ Here is the caller graph for this function:

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

Definition at line 298 of file misc.h.

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

298  {
299 #if 202002L <= __cplusplus // C++20
300  if constexpr (sizeof(TO) <= sizeof(FROM)) {
301  return std::bit_cast<TO>(std::forward<FROM>(from));
302  } else {
303  TO to{0}; // std::bit_cast() has the undesirable feature of indeterminate bits.
304  memcpy(&to, &from, sizeof(FROM));
305  return to;
306  }
307 #else
308  TO to{0};
309  memcpy(&to, &from, sizeof(TO) < sizeof(FROM) ? sizeof(TO) : sizeof(FROM));
310  return to;
311 #endif
312 }
TO bit_cast(FROM &&from)
Definition: misc.h:298

+ 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 426 of file misc.h.

Referenced by byteswap().

426  {
427  return bswap_impl<U>(i, std::make_index_sequence<sizeof(T)>{});
428 }

+ 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 420 of file misc.h.

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

420  {
421  return ((((i >> (N * CHAR_BIT)) & (T)(unsigned char)(-1))
422  << ((sizeof(T) - 1 - N) * CHAR_BIT)) |
423  ...);
424 };
constexpr unsigned N
Definition: Utm.h:110
template<class T >
constexpr T shared::byteswap ( n)
noexcept

Definition at line 430 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().

430  {
431  return bswap(n);
432 }
constexpr U bswap(T i)
Definition: misc.h:426
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 329 of file misc.h.

Referenced by Executor::numBlocksPerMP().

329  {
330  return (dividend + (divisor - 1)) / divisor;
331 }

+ 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 141 of file misc.cpp.

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

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

+ 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 349 of file misc.h.

351  {
352  auto const& c_r = r.size() < s.size() ? r : s;
353  auto const& c_s = r.size() < s.size() ? s : r;
354  for (auto const& v : c_r) {
355  if (c_s.count(v)) {
356  dest->insert(v);
357  }
358  }
359 }
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 109 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(), and import_export::anonymous_namespace{QueryExporterCSV.cpp}::target_value_to_string().

110  {
111  std::string iso_str;
112  if (type_info.get_type() == kTIME) {
113  // Set a buffer size that can contain HH:MM:SS
114  iso_str.resize(8);
115  const auto len = shared::formatHMS(iso_str.data(), iso_str.length() + 1, unix_time);
116  CHECK_EQ(len, iso_str.length());
117  } else if (type_info.get_type() == kDATE) {
118  // Set a buffer size that can contain YYYYYYYYYYYY-mm-dd (int64_t can represent up to
119  // 12 digit years)
120  iso_str.resize(18);
121  const size_t len =
122  shared::formatDate(iso_str.data(), iso_str.length() + 1, unix_time);
123  CHECK_GT(len, static_cast<size_t>(0));
124  iso_str.resize(len);
125  } else if (type_info.get_type() == kTIMESTAMP) {
126  auto precision = type_info.get_precision();
127  // Set a buffer size that can contain the specified timestamp precision
128  // YYYYYYYYYYYY-mm-dd(18) T(1) HH:MM:SS(8) .(precision?) nnnnnnnnn(precision) Z(1)
129  // (int64_t can represent up to 12 digit years with seconds precision)
130  iso_str.resize(18 + 1 + 8 + bool(precision) + precision + 1);
131  const size_t len = shared::formatDateTime(
132  iso_str.data(), iso_str.length() + 1, unix_time, precision, true);
133  CHECK_GT(len, static_cast<size_t>(0));
134  iso_str.resize(len);
135  } else {
136  UNREACHABLE() << "Unexpected column type: " << type_info.toString();
137  }
138  return iso_str;
139 }
#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:96
std::string toString() const
Definition: sqltypes.h:523
int get_precision() const
Definition: sqltypes.h:394
size_t formatDate(char *buf, size_t const max, int64_t const unixtime)
Definition: misc.cpp:27
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:45

+ 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:320
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 176 of file misc.h.

References shared::DivUMod::quot.

Referenced by formatDate(), and formatDateTime().

176  {
177  DivUMod div{num / den, num % den};
178  if (div.rem < 0) {
179  --div.quot;
180  div.rem += den;
181  }
182  return div;
183 }

+ 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 92 of file misc.h.

92  {
93  return (... || dynamic_cast<Ts const*>(ptr));
94 }
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 215 of file misc.h.

References horner().

Referenced by Transform4326ToUTM::Transform4326ToUTM().

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

+ 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 221 of file misc.h.

References horner().

Referenced by Transform4326ToUTM::Transform4326ToUTM().

221  {
222  // Mathematica: CoefficientList[Normal@Series[Cos[x],{x,0,16}],x] // InputForm
223  // clang-format off
224  return horner(x * x, 1, -1/2., 1/24., -1/720., 1/40320., -1/3628800.,
225  1/479001600., -1/87178291200., 1/20922789888000.);
226  // clang-format on
227 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:205

+ 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 230 of file misc.h.

References horner().

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

230  {
231  // Mathematica: CoefficientList[Normal@Series[Cosh[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:205

+ 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 239 of file misc.h.

References horner().

Referenced by Transform4326ToUTM::Transform4326ToUTM().

239  {
240  // Mathematica: CoefficientList[Normal@Series[Sin[x],{x,0,16}],x] // InputForm
241  // clang-format off
242  return x * horner(x * x, 1, -1/6., 1/120., -1/5040., 1/362880.,
243  -1/39916800., 1/6227020800., -1/1307674368000.);
244  // clang-format on
245 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:205

+ 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 248 of file misc.h.

References horner().

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

248  {
249  // Mathematica: CoefficientList[Normal@Series[Sinh[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:205

+ 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 27 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().

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

+ 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 45 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().

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

+ 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 96 of file misc.cpp.

References unsignedMod().

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

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

+ 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 61 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().

61  {
62  auto find_it = map.find(key);
63  CHECK(find_it != map.end());
64  return find_it->second;
65 }
#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 68 of file misc.h.

References CHECK.

68  {
69  auto find_it = map.find(key);
70  CHECK(find_it != map.end());
71  return find_it->second;
72 }
#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 456 of file misc.h.

References byteswap().

456  {
457  return (shared::endian::native == shared::endian::big) ? h : shared::byteswap(h);
458 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:430

+ Here is the call graph for this function:

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

Definition at line 460 of file misc.h.

References byteswap().

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

+ Here is the call graph for this function:

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

Definition at line 452 of file misc.h.

References byteswap().

452  {
453  return (shared::endian::native == shared::endian::big) ? h : shared::byteswap(h);
454 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:430

+ Here is the call graph for this function:

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

Definition at line 468 of file misc.h.

References byteswap().

468  {
469  return (shared::endian::native == shared::endian::big) ? n : shared::byteswap(n);
470 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:430
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 472 of file misc.h.

References byteswap().

472  {
473  return (shared::endian::native == shared::endian::big) ? n : shared::byteswap(n);
474 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:430
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 464 of file misc.h.

References byteswap().

464  {
465  return (shared::endian::native == shared::endian::big) ? n : shared::byteswap(n);
466 }
constexpr T byteswap(T n) noexcept
Definition: misc.h:430
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 205 of file misc.h.

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

205  {
206  if constexpr (sizeof...(COEFFICIENTS) == 0) { // NOLINT
207  return c0;
208  } else {
209  return horner(x, c...) * x + c0;
210  }
211  return {}; // quiet nvcc warning https://stackoverflow.com/a/64561686/2700898
212 }
DEVICE constexpr double horner(double const x, double const c0, COEFFICIENTS...c)
Definition: misc.h:205

+ 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 270 of file misc.h.

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

270  {
271  return inversePowersOfImpl(a, std::make_index_sequence<N>{});
272 }
constexpr double a
Definition: Utm.h:32
constexpr std::array< double, sizeof...(Indices)> inversePowersOfImpl(double const a, std::index_sequence< Indices...>)
Definition: misc.h:50

+ Here is the call graph for this function:

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

Definition at line 258 of file misc.h.

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

258  {
259  return (... || (values == value));
260 }

+ 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:195

+ 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:195

+ 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 336 of file misc.h.

337  {
338  auto const& c_r = r.size() < s.size() ? r : s;
339  auto const& c_s = r.size() < s.size() ? s : r;
340  for (auto const& v : c_r) {
341  if (c_s.count(v)) {
342  return false;
343  }
344  }
345  return true;
346 }
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 125 of file misc.h.

References printContainer().

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

+ Here is the call graph for this function:

double shared::power10 ( unsigned const  x)
inline

Definition at line 275 of file misc.h.

References anonymous_namespace{Utm.h}::N.

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

275  {
276  constexpr unsigned N = 20;
277  constexpr auto pow10 = powersOf<double, N>(10.0);
278  return x < N ? pow10[x] : (pow10[N - 1] * 10) * power10(x - N);
279 }
double power10(unsigned const x)
Definition: misc.h:275
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 282 of file misc.h.

References anonymous_namespace{Utm.h}::N.

Referenced by convert_to_string_and_encode_decimal().

282  {
283  constexpr unsigned N = 20;
284  constexpr auto pow10inv = inversePowersOf<N>(10.0);
285  return x < N ? pow10inv[x] : (pow10inv[N - 1] / 10) * power10inv(x - N);
286 }
double power10inv(unsigned const x)
Definition: misc.h:282
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 264 of file misc.h.

References anonymous_namespace{Utm.h}::a.

264  {
265  return powersOfImpl<T>(a, std::make_index_sequence<N>{});
266 }
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 291 of file misc.h.

291  {
292  TO to{0};
293  memcpy(&to, &from, sizeof(TO) < sizeof(FROM) ? sizeof(TO) : sizeof(FROM));
294  return to;
295 }
template<typename... STR>
constexpr std::array<std::string_view, sizeof...(STR)> shared::string_view_array ( STR &&...  str)

Definition at line 315 of file misc.h.

315  {
316  return {std::forward<STR>(str)...};
317 }
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 320 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().

320  {
321  OUTPUT output;
322  output.reserve(input.size());
323  for (auto const& x : input) {
324  output.push_back(func(x));
325  }
326  return output;
327 }

+ Here is the caller graph for this function:

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

Definition at line 186 of file misc.h.

Referenced by formatHMS().

186  {
187  int64_t mod = num % den;
188  if (mod < 0) {
189  mod += den;
190  }
191  return mod;
192 }

+ 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:195
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().