Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cast-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_CAST_FUNCTIONS_H
17 #define IMPALA_EXPRS_CAST_FUNCTIONS_H
18 
19 #include "udf/udf.h"
20 
21 using namespace impala_udf;
22 
23 namespace impala {
24 
26  public:
27  static BooleanVal CastToBooleanVal(FunctionContext* context, const TinyIntVal& val);
28  static BooleanVal CastToBooleanVal(FunctionContext* context, const SmallIntVal& val);
29  static BooleanVal CastToBooleanVal(FunctionContext* context, const IntVal& val);
30  static BooleanVal CastToBooleanVal(FunctionContext* context, const BigIntVal& val);
31  static BooleanVal CastToBooleanVal(FunctionContext* context, const FloatVal& val);
32  static BooleanVal CastToBooleanVal(FunctionContext* context, const DoubleVal& val);
33  static BooleanVal CastToBooleanVal(FunctionContext* context, const TimestampVal& val);
34 
35  static TinyIntVal CastToTinyIntVal(FunctionContext* context, const BooleanVal& val);
36  static TinyIntVal CastToTinyIntVal(FunctionContext* context, const SmallIntVal& val);
37  static TinyIntVal CastToTinyIntVal(FunctionContext* context, const IntVal& val);
38  static TinyIntVal CastToTinyIntVal(FunctionContext* context, const BigIntVal& val);
39  static TinyIntVal CastToTinyIntVal(FunctionContext* context, const FloatVal& val);
40  static TinyIntVal CastToTinyIntVal(FunctionContext* context, const DoubleVal& val);
41  static TinyIntVal CastToTinyIntVal(FunctionContext* context, const StringVal& val);
42  static TinyIntVal CastToTinyIntVal(FunctionContext* context, const TimestampVal& val);
43 
44  static SmallIntVal CastToSmallIntVal(FunctionContext* context, const BooleanVal& val);
45  static SmallIntVal CastToSmallIntVal(FunctionContext* context, const TinyIntVal& val);
46  static SmallIntVal CastToSmallIntVal(FunctionContext* context, const IntVal& val);
47  static SmallIntVal CastToSmallIntVal(FunctionContext* context, const BigIntVal& val);
48  static SmallIntVal CastToSmallIntVal(FunctionContext* context, const FloatVal& val);
49  static SmallIntVal CastToSmallIntVal(FunctionContext* context, const DoubleVal& val);
50  static SmallIntVal CastToSmallIntVal(FunctionContext* context, const StringVal& val);
51  static SmallIntVal CastToSmallIntVal(FunctionContext* context, const TimestampVal& val);
52 
53  static IntVal CastToIntVal(FunctionContext* context, const BooleanVal& val);
54  static IntVal CastToIntVal(FunctionContext* context, const TinyIntVal& val);
55  static IntVal CastToIntVal(FunctionContext* context, const SmallIntVal& val);
56  static IntVal CastToIntVal(FunctionContext* context, const BigIntVal& val);
57  static IntVal CastToIntVal(FunctionContext* context, const FloatVal& val);
58  static IntVal CastToIntVal(FunctionContext* context, const DoubleVal& val);
59  static IntVal CastToIntVal(FunctionContext* context, const StringVal& val);
60  static IntVal CastToIntVal(FunctionContext* context, const TimestampVal& val);
61 
62  static BigIntVal CastToBigIntVal(FunctionContext* context, const BooleanVal& val);
63  static BigIntVal CastToBigIntVal(FunctionContext* context, const TinyIntVal& val);
64  static BigIntVal CastToBigIntVal(FunctionContext* context, const SmallIntVal& val);
65  static BigIntVal CastToBigIntVal(FunctionContext* context, const IntVal& val);
66  static BigIntVal CastToBigIntVal(FunctionContext* context, const FloatVal& val);
67  static BigIntVal CastToBigIntVal(FunctionContext* context, const DoubleVal& val);
68  static BigIntVal CastToBigIntVal(FunctionContext* context, const StringVal& val);
69  static BigIntVal CastToBigIntVal(FunctionContext* context, const TimestampVal& val);
70 
71  static FloatVal CastToFloatVal(FunctionContext* context, const BooleanVal& val);
72  static FloatVal CastToFloatVal(FunctionContext* context, const TinyIntVal& val);
73  static FloatVal CastToFloatVal(FunctionContext* context, const SmallIntVal& val);
74  static FloatVal CastToFloatVal(FunctionContext* context, const IntVal& val);
75  static FloatVal CastToFloatVal(FunctionContext* context, const BigIntVal& val);
76  static FloatVal CastToFloatVal(FunctionContext* context, const DoubleVal& val);
77  static FloatVal CastToFloatVal(FunctionContext* context, const StringVal& val);
78  static FloatVal CastToFloatVal(FunctionContext* context, const TimestampVal& val);
79 
80  static DoubleVal CastToDoubleVal(FunctionContext* context, const BooleanVal& val);
81  static DoubleVal CastToDoubleVal(FunctionContext* context, const TinyIntVal& val);
82  static DoubleVal CastToDoubleVal(FunctionContext* context, const SmallIntVal& val);
83  static DoubleVal CastToDoubleVal(FunctionContext* context, const IntVal& val);
84  static DoubleVal CastToDoubleVal(FunctionContext* context, const BigIntVal& val);
85  static DoubleVal CastToDoubleVal(FunctionContext* context, const FloatVal& val);
86  static DoubleVal CastToDoubleVal(FunctionContext* context, const StringVal& val);
87  static DoubleVal CastToDoubleVal(FunctionContext* context, const TimestampVal& val);
88 
89  static StringVal CastToStringVal(FunctionContext* context, const BooleanVal& val);
90  static StringVal CastToStringVal(FunctionContext* context, const TinyIntVal& val);
91  static StringVal CastToStringVal(FunctionContext* context, const SmallIntVal& val);
92  static StringVal CastToStringVal(FunctionContext* context, const IntVal& val);
93  static StringVal CastToStringVal(FunctionContext* context, const BigIntVal& val);
94  static StringVal CastToStringVal(FunctionContext* context, const FloatVal& val);
95  static StringVal CastToStringVal(FunctionContext* context, const DoubleVal& val);
96  static StringVal CastToStringVal(FunctionContext* context, const TimestampVal& val);
97  static StringVal CastToStringVal(FunctionContext* context, const StringVal& val);
98 
99  static StringVal CastToChar(FunctionContext* context, const StringVal& val);
100 
101  static TimestampVal CastToTimestampVal(FunctionContext* context, const BooleanVal& val);
102  static TimestampVal CastToTimestampVal(FunctionContext* context, const TinyIntVal& val);
103  static TimestampVal CastToTimestampVal(FunctionContext* context, const SmallIntVal& val);
104  static TimestampVal CastToTimestampVal(FunctionContext* context, const IntVal& val);
105  static TimestampVal CastToTimestampVal(FunctionContext* context, const BigIntVal& val);
106  static TimestampVal CastToTimestampVal(FunctionContext* context, const FloatVal& val);
107  static TimestampVal CastToTimestampVal(FunctionContext* context, const DoubleVal& val);
108  static TimestampVal CastToTimestampVal(FunctionContext* context, const StringVal& val);
109 };
110 
111 }
112 
113 #endif
This object has a compatible storage format with boost::ptime.
Definition: udf.h:495