Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::DecimalUtil Class Reference

#include <decimal-util.h>

Collaboration diagram for impala::DecimalUtil:

Public Member Functions

template<>
int32_t GetScaleMultiplier (int scale)
 
template<>
int64_t GetScaleMultiplier (int scale)
 
template<>
int128_t GetScaleMultiplier (int scale)
 

Static Public Member Functions

static void InitMaxUnscaledDecimal ()
 Initializes MAX_UNSCALED_DECIMAL. Must be called once before using it. More...
 
template<typename T >
static T MultiplyByScale (const T &v, const ColumnType &t)
 TODO: do we need to handle overflow here or at a higher abstraction. More...
 
template<typename T >
static T MultiplyByScale (const T &v, int scale)
 
template<typename T >
static T GetScaleMultiplier (int scale)
 
template<typename T >
static void EncodeToFixedLenByteArray (uint8_t *buffer, int fixed_len_size, const T &v)
 Write decimals as big endian (byte comparable) in fixed_len_size bytes. More...
 
template<typename T >
static void DecodeFromFixedLenByteArray (const uint8_t *buffer, int fixed_len_size, T *v)
 

Static Public Attributes

static int128_t MAX_UNSCALED_DECIMAL
 Maximum absolute value of int128_t that we use. This is 38 digits of 9's. More...
 

Detailed Description

Definition at line 29 of file decimal-util.h.

Member Function Documentation

template<typename T >
static void impala::DecimalUtil::DecodeFromFixedLenByteArray ( const uint8_t *  buffer,
int  fixed_len_size,
T *  v 
)
inlinestatic
template<typename T >
static void impala::DecimalUtil::EncodeToFixedLenByteArray ( uint8_t *  buffer,
int  fixed_len_size,
const T &  v 
)
inlinestatic

Write decimals as big endian (byte comparable) in fixed_len_size bytes.

Definition at line 61 of file decimal-util.h.

References impala::BitUtil::ByteSwap().

Referenced by impala::ParquetPlainEncoder::Encode().

template<typename T >
static T impala::DecimalUtil::GetScaleMultiplier ( int  scale)
inlinestatic

Definition at line 50 of file decimal-util.h.

template<>
int32_t impala::DecimalUtil::GetScaleMultiplier ( int  scale)
inline

Definition at line 109 of file decimal-util.h.

References LIKELY, and impala::ColumnType::MAX_DECIMAL4_PRECISION.

template<>
int64_t impala::DecimalUtil::GetScaleMultiplier ( int  scale)
inline

Definition at line 128 of file decimal-util.h.

References LIKELY, and impala::ColumnType::MAX_DECIMAL8_PRECISION.

template<>
int128_t impala::DecimalUtil::GetScaleMultiplier ( int  scale)
inline

Definition at line 156 of file decimal-util.h.

References LIKELY, and impala::ColumnType::MAX_PRECISION.

void impala::DecimalUtil::InitMaxUnscaledDecimal ( )
static

Initializes MAX_UNSCALED_DECIMAL. Must be called once before using it.

Definition at line 22 of file decimal-util.cc.

References impala::ColumnType::MAX_PRECISION, and MAX_UNSCALED_DECIMAL.

Referenced by main().

template<typename T >
static T impala::DecimalUtil::MultiplyByScale ( const T &  v,
const ColumnType t 
)
inlinestatic

TODO: do we need to handle overflow here or at a higher abstraction.

Definition at line 39 of file decimal-util.h.

References impala::ColumnType::scale, impala::ColumnType::type, and impala::TYPE_DECIMAL.

template<typename T >
static T impala::DecimalUtil::MultiplyByScale ( const T &  v,
int  scale 
)
inlinestatic

Definition at line 45 of file decimal-util.h.

Member Data Documentation


The documentation for this class was generated from the following files: