Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
static-asserts.cc
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 #include <boost/static_assert.hpp>
16 
17 #include "common/hdfs.h"
19 #include "runtime/string-value.h"
21 #include "udf/udf.h"
22 
23 namespace impala {
24 // This class is unused. It contains static (compile time) asserts.
25 // This is useful to validate struct sizes and other similar things
26 // at compile time. If these asserts fail, the compile will fail.
27 class UnusedClass {
28  private:
29  BOOST_STATIC_ASSERT(sizeof(StringValue) == 16);
30  BOOST_STATIC_ASSERT(offsetof(StringValue, len) == 8);
31  BOOST_STATIC_ASSERT(sizeof(TimestampValue) == 16);
32  BOOST_STATIC_ASSERT(offsetof(TimestampValue, date_) == 8);
33  BOOST_STATIC_ASSERT(sizeof(boost::posix_time::time_duration) == 8);
34  BOOST_STATIC_ASSERT(sizeof(boost::gregorian::date) == 4);
35  BOOST_STATIC_ASSERT(sizeof(hdfsFS) == sizeof(void*));
36  BOOST_STATIC_ASSERT(sizeof(hdfsFile) == sizeof(void*));
37  BOOST_STATIC_ASSERT(sizeof(BufferedTupleStream::RowIdx) == sizeof(void*));
38 
39  // If the memory layout of any of these types changes, it will be necessary to change
40  // LlvmCodeGen::GetUdfValType(), and we may also run into calling convention problems
41  // with codegen'd calls to UDFs.
50 };
51 
52 }
BOOST_STATIC_ASSERT(sizeof(StringValue)==16)