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

#include <string-value.h>

Collaboration diagram for impala::StringValue:

Public Member Functions

 StringValue (char *ptr, int len)
 
 StringValue ()
 
 StringValue (const std::string &s)
 
 StringValue (const char *s)
 
int Compare (const StringValue &other) const
 
bool Eq (const StringValue &other) const
 == More...
 
bool operator== (const StringValue &other) const
 
bool Ne (const StringValue &other) const
 != More...
 
bool operator!= (const StringValue &other) const
 
bool Le (const StringValue &other) const
 <= More...
 
bool operator<= (const StringValue &other) const
 
bool Ge (const StringValue &other) const
 >= More...
 
bool operator>= (const StringValue &other) const
 
bool Lt (const StringValue &other) const
 < More...
 
bool operator< (const StringValue &other) const
 
bool Gt (const StringValue &other) const
 > More...
 
bool operator> (const StringValue &other) const
 
std::string DebugString () const
 
StringValue Substring (int start_pos) const
 Returns the substring starting at start_pos until the end of string. More...
 
StringValue Substring (int start_pos, int new_len) const
 
StringValue Trim () const
 Trims leading and trailing spaces. More...
 
void ToStringVal (impala_udf::StringVal *sv) const
 

Static Public Member Functions

static StringValue FromStringVal (const impala_udf::StringVal &sv)
 
static void PadWithSpaces (char *cptr, int64_t cptr_len, int64_t num_chars)
 
static int64_t UnpaddedCharLength (const char *cptr, int64_t len)
 Returns number of characters in a char array (ignores trailing spaces) More...
 
static char * CharSlotToPtr (void *slot, const ColumnType &type)
 
static const char * CharSlotToPtr (const void *slot, const ColumnType &type)
 

Public Attributes

char * ptr
 
int len
 

Static Public Attributes

static const char * LLVM_CLASS_NAME = "struct.impala::StringValue"
 For C++/IR interop, we need to be able to look up types by name. More...
 

Detailed Description

The format of a string-typed slot. The returned StringValue of all functions that return StringValue shares its buffer the parent. TODO: rename this to be less confusing with impala_udf::StringVal.

Definition at line 33 of file string-value.h.

Constructor & Destructor Documentation

impala::StringValue::StringValue ( char *  ptr,
int  len 
)
inline

Definition at line 40 of file string-value.h.

impala::StringValue::StringValue ( )
inline

Definition at line 43 of file string-value.h.

Referenced by FromStringVal(), Substring(), and Trim().

impala::StringValue::StringValue ( const std::string &  s)
inline

Construct a StringValue from 's'. 's' must be valid for as long as this object is valid.

Definition at line 47 of file string-value.h.

impala::StringValue::StringValue ( const char *  s)
inline

Construct a StringValue from 's'. 's' must be valid for as long as this object is valid. s must be a null-terminated string. This constructor is to prevent accidental use of the version taking an std::string.

Definition at line 55 of file string-value.h.

Member Function Documentation

const char * impala::StringValue::CharSlotToPtr ( const void *  slot,
const ColumnType type 
)
inlinestatic
int impala::StringValue::Compare ( const StringValue other) const
inline

Byte-by-byte comparison. Returns: this < other: -1 this == other: 0 this > other: 1

Definition at line 59 of file string-value.inline.h.

References len, ptr, and impala::StringCompare().

Referenced by impala::RawValue::Compare(), Ge(), Gt(), Le(), and Lt().

string impala::StringValue::DebugString ( ) const
bool impala::StringValue::Ge ( const StringValue other) const
inline

>=

Definition at line 75 of file string-value.h.

References Compare().

Referenced by operator>=().

bool impala::StringValue::Gt ( const StringValue other) const
inline

>

Definition at line 81 of file string-value.h.

References Compare().

Referenced by operator>().

bool impala::StringValue::Le ( const StringValue other) const
inline

<=

Definition at line 72 of file string-value.h.

References Compare().

Referenced by operator<=().

bool impala::StringValue::Lt ( const StringValue other) const
inline

<

Definition at line 78 of file string-value.h.

References Compare().

Referenced by operator<().

bool impala::StringValue::Ne ( const StringValue other) const
inline

!=

Definition at line 69 of file string-value.h.

References Eq().

Referenced by operator!=().

bool impala::StringValue::operator!= ( const StringValue other) const
inline

Definition at line 70 of file string-value.h.

References Ne().

bool impala::StringValue::operator< ( const StringValue other) const
inline

Definition at line 79 of file string-value.h.

References Lt().

bool impala::StringValue::operator<= ( const StringValue other) const
inline

Definition at line 73 of file string-value.h.

References Le().

bool impala::StringValue::operator== ( const StringValue other) const
inline

Definition at line 67 of file string-value.h.

References Eq().

bool impala::StringValue::operator> ( const StringValue other) const
inline

Definition at line 82 of file string-value.h.

References Gt().

bool impala::StringValue::operator>= ( const StringValue other) const
inline

Definition at line 76 of file string-value.h.

References Ge().

void impala::StringValue::PadWithSpaces ( char *  cptr,
int64_t  cptr_len,
int64_t  num_chars 
)
inlinestatic

Pads the end of the char pointer with spaces. num_chars is the number of used characters, cptr_len is the length of cptr

Definition at line 100 of file string-value.inline.h.

Referenced by impala::CastFunctions::CastToChar(), impala::HdfsParquetScanner::ColumnReader< T >::ConvertSlot(), impala::HdfsAvroScanner::ReadAvroChar(), impala::TEST(), and impala::TextConverter::WriteSlot().

StringValue impala::StringValue::Substring ( int  start_pos) const
inline

Returns the substring starting at start_pos until the end of string.

Definition at line 79 of file string-value.inline.h.

References len, ptr, and StringValue().

Referenced by impala::UrlParser::ParseUrl(), and impala::UrlParser::ParseUrlKey().

StringValue impala::StringValue::Substring ( int  start_pos,
int  new_len 
) const
inline

Returns the substring starting at start_pos with given length. If new_len < 0 then the substring from start_pos to end of string is returned. If new_len > len, len is extended to new_len. TODO: len should never be extended. This is not a trivial fix because UrlParser depends on the current behavior.

Definition at line 83 of file string-value.inline.h.

References len, ptr, and StringValue().

StringValue impala::StringValue::Trim ( ) const
inline

Trims leading and trailing spaces.

Definition at line 87 of file string-value.inline.h.

References len, ptr, and StringValue().

Referenced by impala::UrlParser::ParseUrl(), and impala::UrlParser::ParseUrlKey().

int64_t impala::StringValue::UnpaddedCharLength ( const char *  cptr,
int64_t  len 
)
inlinestatic

Returns number of characters in a char array (ignores trailing spaces)

Definition at line 107 of file string-value.inline.h.

Referenced by impala::HdfsTextTableWriter::AppendRowBatch(), impala::HdfsParquetTableWriter::ColumnWriter< T >::CastValue(), impala::RawValue::Compare(), impala::RawValue::Eq(), and impala::TEST().

Member Data Documentation

int impala::StringValue::len

Definition at line 38 of file string-value.h.

Referenced by impala::DictEncoder< T >::AddToTable(), impala::StringBuffer::Append(), impala::HdfsAvroTableWriter::AppendField(), impala::SimpleTupleStreamTest::AppendValue(), impala::ParquetPlainEncoder::ByteSize(), CharSlotToPtr(), impala::StringBuffer::Clear(), impala::Sorter::Run::CollectNonNullVarSlots(), Compare(), impala::BufferedTupleStream::ComputeRowSize(), impala::LikePredicate::ConstantEndsWithFn(), impala::LikePredicate::ConstantStartsWithFn(), impala::LikePredicate::ConstantSubstringFn(), impala::PartitionedAggregationNode::ConstructIntermediateTuple(), impala::HdfsParquetScanner::ColumnReader< T >::ConvertSlot(), impala::HdfsParquetScanner::ColumnReader< T >::CopySlot(), impala::Sorter::Run::CopyVarLenData(), impala::Sorter::Run::CopyVarLenDataConvertOffset(), DebugString(), impala::ParquetPlainEncoder::Decode(), impala::Tuple::DeepCopy(), impala::BufferedTupleStream::DeepCopyInternal(), impala::StringBuffer::Empty(), impala::ParquetPlainEncoder::Encode(), Eq(), impala::ExprValue::ExprValue(), impala::HdfsTextScanner::FinishScanRange(), impala::Literal::GetCodegendComputeFn(), impala::RawValue::GetHashValue(), impala::RawValue::GetHashValueFnv(), impala::BufferedTupleStream::GetNextInternal(), impala::ExprContext::GetValue(), impala::StringBuffer::GrowBuffer(), impala::DictEncoder< T >::Hash(), impala::hash_value(), impala::HashTableCtx::HashVariableLenRow(), impala::OldHashTable::HashVariableLenRow(), impala::LikePredicate::LikePrepare(), impala::Literal::Literal(), impala::Tuple::MaterializeExprs(), impala::UrlParser::ParseUrl(), impala::UrlParser::ParseUrlKey(), impala::HdfsTextTableWriter::PrintEscaped(), impala::RawValue::PrintValue(), impala::RawValue::PrintValueAsBytes(), RandString(), impala::HdfsAvroScanner::ReadAvroChar(), impala::HdfsAvroScanner::ReadAvroString(), impala::HdfsAvroScanner::ReadAvroVarchar(), impala::StringBuffer::Reset(), impala::StringSearchSSE::Search(), impala::StringSearch::Search(), impala::StringBuffer::Size(), impala::StringBuffer::StringBuffer(), impala::StringSearch::StringSearch(), impala::StringSearchSSE::StringSearchSSE(), Substring(), impala::TEST(), impala::TEST_F(), TestBoostMixedHash(), impala::ExprTest::TestCharValue(), TestCrcMixedHash(), TestFnvMixedHash(), TestImpala(), TestImpalaCased(), TestImpalaUnrolled(), TestImpalaUnsafe(), TestNormalStringsRandom(), TestNormalStringsSequential(), impala::ExprTest::TestStringValue(), ToStringVal(), impala::RowBatch::TotalByteSize(), Trim(), impala::TextConverter::UnescapeString(), impala::TimestampFunctions::UnixAndFromUnixPrepare(), impala::RawValue::Write(), impala::HdfsSequenceTableWriter::WriteEscapedString(), impala::KeyNormalizer::WriteNormalizedKey(), and impala::TextConverter::WriteSlot().

const char * impala::StringValue::LLVM_CLASS_NAME = "struct.impala::StringValue"
static

For C++/IR interop, we need to be able to look up types by name.

Definition at line 121 of file string-value.h.

Referenced by impala::LlvmCodeGen::LoadImpalaIR().

char* impala::StringValue::ptr

TODO: change ptr to an offset relative to a contiguous memory block, so that we can send row batches between nodes without having to swizzle pointers

Definition at line 37 of file string-value.h.

Referenced by impala::DictEncoder< T >::AddToTable(), impala::StringBuffer::Append(), impala::HdfsAvroTableWriter::AppendField(), impala::SimpleTupleStreamTest::AppendValue(), CharSlotToPtr(), Compare(), impala::HdfsParquetScanner::ColumnReader< T >::ConvertSlot(), impala::HdfsTextScanner::CopyBoundaryField(), impala::HdfsParquetScanner::ColumnReader< T >::CopySlot(), impala::Sorter::Run::CopyVarLenData(), impala::Sorter::Run::CopyVarLenDataConvertOffset(), DebugString(), impala::ParquetPlainEncoder::Decode(), impala::Tuple::DeepCopy(), impala::BufferedTupleStream::DeepCopyInternal(), impala::ParquetPlainEncoder::Encode(), Eq(), impala::ExprValue::ExprValue(), impala::HdfsTextScanner::FinishScanRange(), impala::Literal::GetCodegendComputeFn(), impala::RawValue::GetHashValue(), impala::RawValue::GetHashValueFnv(), impala::BufferedTupleStream::GetNextInternal(), impala::UrlParser::GetUrlPart(), impala::ExprContext::GetValue(), impala::StringBuffer::GrowBuffer(), impala::DictEncoder< T >::Hash(), impala::hash_value(), impala::HashTableCtx::HashVariableLenRow(), impala::OldHashTable::HashVariableLenRow(), impala::LikePredicate::LikePrepare(), impala::UrlParser::ParseUrl(), impala::UrlParser::ParseUrlKey(), impala::HdfsTextTableWriter::PrintEscaped(), impala::RawValue::PrintValue(), impala::RawValue::PrintValueAsBytes(), RandString(), impala::HdfsAvroScanner::ReadAvroChar(), impala::HdfsAvroScanner::ReadAvroString(), impala::HdfsAvroScanner::ReadAvroVarchar(), impala::StringSearchSSE::Search(), impala::StringSearch::Search(), impala::StringSearch::StringSearch(), Substring(), impala::TEST_F(), TestBoostMixedHash(), impala::ExprTest::TestCharValue(), TestCrcMixedHash(), TestFnvMixedHash(), TestImpala(), TestImpalaCased(), TestImpalaUnrolled(), TestImpalaUnsafe(), TestNormalStringsRandom(), TestNormalStringsSequential(), impala::ExprTest::TestStringValue(), ToStringVal(), Trim(), impala::TextConverter::UnescapeString(), impala::TimestampFunctions::UnixAndFromUnixPrepare(), impala::ValidateString(), impala::RawValue::Write(), impala::HdfsSequenceTableWriter::WriteEscapedString(), impala::KeyNormalizer::WriteNormalizedKey(), and impala::TextConverter::WriteSlot().


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