OmniSciDB  5ade3759e0
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< 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 *, 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, Importer_NS::BadRowsTracker *const bad_rows_tracker)
 
template<typename SrcType , typename DstType >
VarValue anonymous_namespace{ArrowImporter.h}::get_numeric_value (const Array &array, const int64_t idx)
 
template<typename SrcType >
VarValue anonymous_namespace{ArrowImporter.h}::get_string_value (const Array &array, const int64_t idx)
 
auto anonymous_namespace{ArrowImporter.h}::value_getter (const Array &array, const ColumnDescriptor *cd, Importer_NS::BadRowsTracker *const bad_rows_tracker)
 
void anonymous_namespace{ArrowImporter.h}::type_conversion_error (const std::string pt, const ColumnDescriptor *cd, Importer_NS::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, Importer_NS::BadRowsTracker *const bad_rows_tracker)
 
void anonymous_namespace{ArrowImporter.h}::data_conversion_error (const std::string &v, const ColumnDescriptor *cd, Importer_NS::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 = 1000L
 
constexpr int64_t anonymous_namespace{ArrowImporter.h}::kMicrosecondsInSecond = 1000L * 1000L
 
constexpr int64_t anonymous_namespace{ArrowImporter.h}::kNanosecondsinSecond = 1000L * 1000L * 1000L
 
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

◆ exprtype

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

Definition at line 73 of file ArrowImporter.h.

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

◆ NUMERIC_CASE

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

Definition at line 95 of file ArrowImporter.h.

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

◆ STRING_CASE

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

Definition at line 98 of file ArrowImporter.h.

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

Function Documentation

◆ arrow_throw_if()

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

Definition at line 40 of file ArrowImporter.h.

References logger::ERROR, and LOG.

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

40  {
41  if (cond) {
42  // work around race from goooogle log
43  static std::mutex mtx;
44  std::unique_lock<std::mutex> lock(mtx);
45  LOG(ERROR) << message;
46  throw T(message);
47  }
48 }
#define LOG(tag)
Definition: Logger.h:182
+ Here is the caller graph for this function: