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

#include <url-parser.h>

Collaboration diagram for impala::UrlParser:

Public Types

enum  UrlPart {
  INVALID, AUTHORITY, FILE, HOST,
  PATH, PROTOCOL, QUERY, REF,
  USERINFO
}
 Parts of a URL that can be requested. More...
 

Static Public Member Functions

static bool ParseUrl (const StringValue &url, UrlPart part, StringValue *result)
 
static bool ParseUrlKey (const StringValue &url, UrlPart part, const StringValue &key, StringValue *result)
 
static UrlPart GetUrlPart (const StringValue &part)
 

Static Private Attributes

static const StringValue url_authority
 
static const StringValue url_file
 
static const StringValue url_host
 
static const StringValue url_path
 
static const StringValue url_protocol
 
static const StringValue url_query
 
static const StringValue url_ref
 
static const StringValue url_userinfo
 
static const StringValue protocol
 
static const StringValue at
 
static const StringValue slash
 
static const StringValue colon
 
static const StringValue question
 
static const StringValue hash
 
static const StringSearch protocol_search
 
static const StringSearch at_search
 
static const StringSearch slash_search
 
static const StringSearch colon_search
 
static const StringSearch question_search
 
static const StringSearch hash_search
 

Detailed Description

TODO: For now, our parse_url may not behave exactly like Hive when given malformed URLs. If necessary, we can closely follow Java's URL implementation to behave exactly like Hive. Example for explaining URL parts: http://user:pass@example.com:80/docs/books/tutorial/index.html?name=networking#DOWNLOADING PROTOCOL = http AUTHORITY = example.com:80 HOST = example.com PATH = /docs/books/tutorial/index.html QUERY = name=networking FILENAME = /docs/books/tutorial/index.html?name=networking REF = DOWNLOADING USERINFO = user:pass More details on what exactly the URL parts mean can be found here: http://docs.oracle.com/javase/tutorial/networking/urls/urlInfo.html

Definition at line 41 of file url-parser.h.

Member Enumeration Documentation

Parts of a URL that can be requested.

Enumerator
INVALID 
AUTHORITY 
FILE 
HOST 
PATH 
PROTOCOL 
QUERY 
REF 
USERINFO 

Definition at line 44 of file url-parser.h.

Member Function Documentation

UrlParser::UrlPart impala::UrlParser::GetUrlPart ( const StringValue part)
static

Compares part against url_authority, url_file, url_host, etc., and returns the corresponding enum. If part did not match any of the url part constants, returns INVALID.

Definition at line 214 of file url-parser.cc.

References AUTHORITY, impala::StringValue::Eq(), FILE, HOST, INVALID, PATH, PROTOCOL, impala::StringValue::ptr, QUERY, REF, url_authority, url_file, url_host, url_path, url_protocol, url_query, url_ref, url_userinfo, and USERINFO.

bool impala::UrlParser::ParseUrl ( const StringValue url,
UrlPart  part,
StringValue result 
)
static

Tries to parse the part from url. Places the result in result. Returns false if the URL is malformed or if part is invalid. True otherwise. If false is returned the contents of results are undefined.

Definition at line 43 of file url-parser.cc.

References at, at_search, AUTHORITY, colon_search, FILE, hash, hash_search, HOST, INVALID, impala::StringValue::len, PATH, PROTOCOL, protocol, protocol_search, impala::StringValue::ptr, QUERY, question, question_search, REF, impala::StringSearch::Search(), slash_search, impala::StringValue::Substring(), impala::StringValue::Trim(), and USERINFO.

bool impala::UrlParser::ParseUrlKey ( const StringValue url,
UrlPart  part,
const StringValue key,
StringValue result 
)
static

Tries to parse key from url. Places the result in result. Returns false if the URL is malformed or if part is invalid. True otherwise. If false is returned the contents of results are undefined.

Definition at line 160 of file url-parser.cc.

References impala::StringValue::len, impala::StringValue::ptr, QUERY, impala::StringSearch::Search(), impala::StringValue::Substring(), and impala::StringValue::Trim().

Member Data Documentation

const StringValue impala::UrlParser::at
staticprivate

Definition at line 84 of file url-parser.h.

Referenced by ParseUrl().

const StringSearch impala::UrlParser::at_search
staticprivate

Definition at line 90 of file url-parser.h.

Referenced by ParseUrl().

const StringValue impala::UrlParser::colon
staticprivate

Definition at line 86 of file url-parser.h.

const StringSearch impala::UrlParser::colon_search
staticprivate

Definition at line 92 of file url-parser.h.

Referenced by ParseUrl().

const StringValue impala::UrlParser::hash
staticprivate

Definition at line 88 of file url-parser.h.

Referenced by ParseUrl().

const StringSearch impala::UrlParser::hash_search
staticprivate

Definition at line 94 of file url-parser.h.

Referenced by ParseUrl().

const StringValue impala::UrlParser::protocol
staticprivate

Definition at line 83 of file url-parser.h.

Referenced by ParseUrl().

const StringSearch impala::UrlParser::protocol_search
staticprivate

Definition at line 89 of file url-parser.h.

Referenced by ParseUrl().

const StringValue impala::UrlParser::question
staticprivate

Definition at line 87 of file url-parser.h.

Referenced by ParseUrl().

const StringSearch impala::UrlParser::question_search
staticprivate

Definition at line 93 of file url-parser.h.

Referenced by ParseUrl().

const StringValue impala::UrlParser::slash
staticprivate

Definition at line 85 of file url-parser.h.

const StringSearch impala::UrlParser::slash_search
staticprivate

Definition at line 91 of file url-parser.h.

Referenced by ParseUrl().

const StringValue impala::UrlParser::url_authority
staticprivate

Definition at line 74 of file url-parser.h.

Referenced by GetUrlPart().

const StringValue impala::UrlParser::url_file
staticprivate

Definition at line 75 of file url-parser.h.

Referenced by GetUrlPart().

const StringValue impala::UrlParser::url_host
staticprivate

Definition at line 76 of file url-parser.h.

Referenced by GetUrlPart().

const StringValue impala::UrlParser::url_path
staticprivate

Definition at line 77 of file url-parser.h.

Referenced by GetUrlPart().

const StringValue impala::UrlParser::url_protocol
staticprivate

Definition at line 78 of file url-parser.h.

Referenced by GetUrlPart().

const StringValue impala::UrlParser::url_query
staticprivate

Definition at line 79 of file url-parser.h.

Referenced by GetUrlPart().

const StringValue impala::UrlParser::url_ref
staticprivate

Definition at line 80 of file url-parser.h.

Referenced by GetUrlPart().

const StringValue impala::UrlParser::url_userinfo
staticprivate

Definition at line 81 of file url-parser.h.

Referenced by GetUrlPart().


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