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

#include <string-search-sse.h>

Collaboration diagram for impala::StringSearchSSE:

Public Member Functions

 StringSearchSSE (const char *needle)
 
 StringSearchSSE (const StringValue *needle)
 
 StringSearchSSE ()
 
int Search (const StringValue &haystack) const
 

Private Attributes

const StringValueneedle_str_val_
 Only one of these two will be non-null. Both are unowned. More...
 
const char * needle_cstr_
 
int needle_len_
 

Detailed Description

NOTE: Because this modifies the strings in place, you cannot pass it data that was from the data section (e.g. StringSearchSSE(StringValue("abcd", 4)); TODO: this is still 25% slower than just calling strstr. Look into why TODO: this cannot be used with data containing nulls (I think)

Definition at line 18 of file string-search-sse.h.

Constructor & Destructor Documentation

impala::StringSearchSSE::StringSearchSSE ( const char *  needle)
inline

Create a search needle for null-terminated strings. This is more efficient for searching and should be used if either the needle already happens to be null terminated or the needle will be reused repeatedly, in which case the copy and null terminate is worth it. The caller owns the memory for the needle.

Definition at line 25 of file string-search-sse.h.

References needle_len_.

impala::StringSearchSSE::StringSearchSSE ( const StringValue needle)
inline

Create a search needle from a non-null terminated string. The caller owns the memory for the needle.

Definition at line 32 of file string-search-sse.h.

References impala::StringValue::len, and needle_len_.

impala::StringSearchSSE::StringSearchSSE ( )
inline

Definition at line 37 of file string-search-sse.h.

Member Function Documentation

int impala::StringSearchSSE::Search ( const StringValue haystack) const
inline

Search for needle in haystack. Returns the offset into str if the needle exists Returns -1 if the needle is not found str will be temporarily modified for the duration of the function

Definition at line 43 of file string-search-sse.h.

References impala::StringValue::len, LIKELY, needle_cstr_, needle_len_, needle_str_val_, offset, impala::StringValue::ptr, and UNLIKELY.

Referenced by TestImpalaNonNullTerminated(), TestImpalaNullTerminated(), and impala::TestSearch().

Member Data Documentation

const char* impala::StringSearchSSE::needle_cstr_
private

Definition at line 143 of file string-search-sse.h.

Referenced by Search().

int impala::StringSearchSSE::needle_len_
private

Definition at line 145 of file string-search-sse.h.

Referenced by Search(), and StringSearchSSE().

const StringValue* impala::StringSearchSSE::needle_str_val_
private

Only one of these two will be non-null. Both are unowned.

Definition at line 142 of file string-search-sse.h.

Referenced by Search().


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