aboutsummaryrefslogtreecommitdiff
path: root/contrib/native/client/src/include
diff options
context:
space:
mode:
authorXiao Meng <xiaom.cs@gmail.com>2014-05-30 11:31:44 -0700
committerJacques Nadeau <jacques@apache.org>2014-06-19 20:30:36 -0700
commitb90956e3afc96df3968d2e7882b449c506ea0924 (patch)
tree178bb8b82ad32be65665d3154ce8e70f94f9531e /contrib/native/client/src/include
parentaaa4db74b215e03ad0e1334cfc18964972d93a3b (diff)
DRILL-748: C++ Client. Support timestamp/date before unix time and handle y2028 problem.
Diffstat (limited to 'contrib/native/client/src/include')
-rw-r--r--contrib/native/client/src/include/drill/drillc.hpp2
-rw-r--r--contrib/native/client/src/include/drill/recordBatch.hpp23
2 files changed, 13 insertions, 12 deletions
diff --git a/contrib/native/client/src/include/drill/drillc.hpp b/contrib/native/client/src/include/drill/drillc.hpp
index e5a0d33de..817b680d2 100644
--- a/contrib/native/client/src/include/drill/drillc.hpp
+++ b/contrib/native/client/src/include/drill/drillc.hpp
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-#ifndef DRILL_CLIENT__ALL_H
+#ifndef DRILL_CLIENT_ALL_H
#define DRILL_CLIENT_ALL_H
#include "drill/common.hpp"
diff --git a/contrib/native/client/src/include/drill/recordBatch.hpp b/contrib/native/client/src/include/drill/recordBatch.hpp
index 4ed1e3139..dab8b9b6b 100644
--- a/contrib/native/client/src/include/drill/recordBatch.hpp
+++ b/contrib/native/client/src/include/drill/recordBatch.hpp
@@ -403,19 +403,20 @@ template <typename VALUE_TYPE>
// more complex and start doing dynamic allocations in these classes.
struct DateTimeBase{
- DateTimeBase(){m_datetime=0;}
+ DateTimeBase():m_datetime(0){}
virtual ~DateTimeBase(){}
- uint64_t m_datetime;
+ int64_t m_datetime;
+ int64_t getMillis() const { return m_datetime; }
virtual void load() =0;
virtual std::string toString()=0;
};
struct DateHolder: public virtual DateTimeBase{
DateHolder(){};
- DateHolder(uint64_t d){m_datetime=d; load();}
- uint32_t m_year;
- uint32_t m_month;
- uint32_t m_day;
+ DateHolder(int64_t d){m_datetime=d; load();}
+ int32_t m_year;
+ int32_t m_month;
+ int32_t m_day;
void load();
std::string toString();
};
@@ -433,21 +434,21 @@ struct TimeHolder: public virtual DateTimeBase{
struct DateTimeHolder: public DateHolder, public TimeHolder{
DateTimeHolder(){};
- DateTimeHolder(uint64_t d){m_datetime=d; load();}
+ DateTimeHolder(int64_t d){m_datetime=d; load();}
void load();
std::string toString();
};
struct DateTimeTZHolder: public DateTimeHolder{
DateTimeTZHolder(ByteBuf_t b){
- m_datetime=*(uint64_t*)b;
+ m_datetime=*(int64_t*)b;
m_tzIndex=*(uint32_t*)(b+sizeof(uint64_t));
load();
}
void load();
std::string toString();
int32_t m_tzIndex;
- static uint32_t size(){ return sizeof(uint64_t)+sizeof(uint32_t); }
+ static uint32_t size(){ return sizeof(int64_t)+sizeof(uint32_t); }
};
@@ -703,8 +704,8 @@ typedef NullableValueVectorTyped<DecimalValue , ValueVectorDecimal38Dense> Nulla
typedef NullableValueVectorTyped<DecimalValue , ValueVectorDecimal28Sparse> NullableValueVectorDecimal28Sparse;
typedef NullableValueVectorTyped<DecimalValue , ValueVectorDecimal38Sparse> NullableValueVectorDecimal38Sparse;
-typedef ValueVectorTyped<DateHolder, uint64_t> ValueVectorDate;
-typedef ValueVectorTyped<DateTimeHolder, uint64_t> ValueVectorTimestamp;
+typedef ValueVectorTyped<DateHolder, int64_t> ValueVectorDate;
+typedef ValueVectorTyped<DateTimeHolder, int64_t> ValueVectorTimestamp;
typedef ValueVectorTyped<TimeHolder, uint32_t> ValueVectorTime;
typedef ValueVectorTypedComposite<DateTimeTZHolder> ValueVectorTimestampTZ;
typedef ValueVectorTypedComposite<IntervalHolder> ValueVectorInterval;