Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
utility-functions.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 #ifndef IMPALA_EXPRS_UTILITY_FUNCTIONS_H
17 #define IMPALA_EXPRS_UTILITY_FUNCTIONS_H
18 
19 #include "udf/udf.h"
20 
21 using namespace impala_udf;
22 
23 namespace impala {
24 
25 class Expr;
26 class OpcodeRegistry;
27 class TupleRow;
28 
30  public:
33  template <typename T> static BigIntVal FnvHash(FunctionContext* ctx, const T& input_val);
34  static BigIntVal FnvHashString(FunctionContext* ctx, const StringVal& input_val);
35  static BigIntVal FnvHashTimestamp(FunctionContext* ctx, const TimestampVal& input_val);
36  static BigIntVal FnvHashDecimal(FunctionContext* ctx, const DecimalVal& input_val);
37 
40  static StringVal User(FunctionContext* ctx);
41 
43  static StringVal Version(FunctionContext* ctx);
44 
47  static IntVal Pid(FunctionContext* ctx);
48 
50  static BooleanVal Sleep(FunctionContext* ctx, const IntVal& milliseconds);
51 
54  static StringVal CurrentDatabase(FunctionContext* ctx);
55 
59  template <typename T> static StringVal TypeOf(FunctionContext* ctx, const T& input_val);
60 };
61 
62 }
63 
64 #endif
This object has a compatible storage format with boost::ptime.
Definition: udf.h:495
static uint64_t FnvHash(const void *data, int32_t bytes, uint64_t hash)