OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArrowImporter.h File Reference
#include <cstdlib>
#include <ctime>
#include <map>
#include <mutex>
#include <arrow/api.h>
#include <arrow/io/api.h>
#include <boost/algorithm/string.hpp>
#include <boost/variant.hpp>
#include "Shared/SqlTypesLayout.h"
#include "Shared/ThreadController.h"
#include "Shared/sqltypes.h"
#include "arrow/util/decimal.h"
+ Include dependency graph for ArrowImporter.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ArrowImporterException
 
struct  anonymous_namespace{ArrowImporter.h}::DataBufferBase
 
struct  anonymous_namespace{ArrowImporter.h}::DataBuffer< DATA_TYPE >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValueBase< VALUE_TYPE >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValue< VALUE_TYPE >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValue< void * >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValue< bool >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValue< float >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValue< double >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValue< std::string >
 
struct  anonymous_namespace{ArrowImporter.h}::ArrowValue< arrow::Decimal128 >
 

Namespaces

 anonymous_namespace{ArrowImporter.h}
 

Macros

#define exprtype(expr)   std::decay_t<decltype(expr)>
 
#define NUMERIC_CASE(tid, src_type, var_type)
 
#define STRING_CASE(tid, src_type)
 

Typedefs

using anonymous_namespace{ArrowImporter.h}::VarValue = boost::variant< bool, float, double, int64_t, std::string, void *, arrow::Decimal128 >
 
template<typename T >
using anonymous_namespace{ArrowImporter.h}::enable_if_integral = typename std::enable_if_t< std::is_integral< T >::value, T >
 
template<typename T >
using anonymous_namespace{ArrowImporter.h}::enable_if_integral_not_bool = typename std::enable_if_t< std::is_integral< T >::value &&!std::is_same< T, bool >::value, T >
 
template<typename T >
using anonymous_namespace{ArrowImporter.h}::enable_if_floating = typename std::enable_if_t< std::is_floating_point< T >::value, T >
 

Functions

template<typename T = ArrowImporterException>
void arrow_throw_if (const bool cond, const std::string &message)
 
std::string anonymous_namespace{ArrowImporter.h}::error_context (const ColumnDescriptor *cd, import_export::BadRowsTracker *const bad_rows_tracker)
 
template<typename SrcType , typename DstType >
VarValue anonymous_namespace{ArrowImporter.h}::get_numeric_value (const arrow::Array &array, const int64_t idx)
 
template<typename SrcType >
VarValue anonymous_namespace{ArrowImporter.h}::get_string_value (const arrow::Array &array, const int64_t idx)
 
auto anonymous_namespace{ArrowImporter.h}::value_getter (const arrow::Array &array, const ColumnDescriptor *cd, import_export::BadRowsTracker *const bad_rows_tracker)
 
void anonymous_namespace{ArrowImporter.h}::type_conversion_error (const std::string pt, const ColumnDescriptor *cd, import_export::BadRowsTracker *const bad_rows_tracker)
 
template<typename DATA_TYPE , typename VALUE_TYPE >
void anonymous_namespace{ArrowImporter.h}::data_conversion_error (const VALUE_TYPE v, const ColumnDescriptor *cd, import_export::BadRowsTracker *const bad_rows_tracker)
 
void anonymous_namespace{ArrowImporter.h}::data_conversion_error (const std::string &v, const ColumnDescriptor *cd, import_export::BadRowsTracker *const bad_rows_tracker)
 
template<typename DATA_TYPE >
auto & anonymous_namespace{ArrowImporter.h}::operator<< (DataBuffer< DATA_TYPE > &data, const VarValue &var)
 

Variables

constexpr int64_t anonymous_namespace{ArrowImporter.h}::kMillisecondsInSecond = 1000LL
 
constexpr int64_t anonymous_namespace{ArrowImporter.h}::kMicrosecondsInSecond = 1000LL * 1000LL
 
constexpr int64_t anonymous_namespace{ArrowImporter.h}::kNanosecondsinSecond = 1000LL * 1000LL * 1000LL
 
constexpr int32_t anonymous_namespace{ArrowImporter.h}::kSecondsInDay = 86400
 
static const std::map
< std::pair< int32_t,
arrow::TimeUnit::type >
, std::pair< SQLOps, int64_t > > 
anonymous_namespace{ArrowImporter.h}::_precision_scale_lookup
 

Macro Definition Documentation

#define exprtype (   expr)    std::decay_t<decltype(expr)>

Definition at line 75 of file ArrowImporter.h.

Referenced by anonymous_namespace{ArrowImporter.h}::operator<<().

#define NUMERIC_CASE (   tid,
  src_type,
  var_type 
)
Value:
case arrow::Type::tid: \
return get_numeric_value<src_type, var_type>;

Definition at line 97 of file ArrowImporter.h.

Referenced by anonymous_namespace{ArrowImporter.h}::value_getter().

#define STRING_CASE (   tid,
  src_type 
)
Value:
case arrow::Type::tid: \
return get_string_value<src_type>;

Definition at line 100 of file ArrowImporter.h.

Referenced by anonymous_namespace{ArrowImporter.h}::value_getter().

Function Documentation

template<typename T = ArrowImporterException>
void arrow_throw_if ( const bool  cond,
const std::string &  message 
)
inline

Definition at line 42 of file ArrowImporter.h.

References logger::ERROR, LOG, and heavydb.dtypes::T.

Referenced by import_export::TypedImportBuffer::add_arrow_values(), anonymous_namespace{ArrowImporter.h}::ArrowValue< arrow::Decimal128 >::ArrowValue(), anonymous_namespace{ArrowImporter.h}::data_conversion_error(), anonymous_namespace{ArrowImporter.h}::type_conversion_error(), and anonymous_namespace{ArrowImporter.h}::value_getter().

42  {
43  if (cond) {
44  // work around race from goooogle log
45  static std::mutex mtx;
46  std::unique_lock<std::mutex> lock(mtx);
47  LOG(ERROR) << message;
48  throw T(message);
49  }
50 }
#define LOG(tag)
Definition: Logger.h:285

+ Here is the caller graph for this function: