1#include <DataTypes/DataTypeInterval.h>
2#include <DataTypes/DataTypeFactory.h>
3
4
5namespace DB
6{
7
8bool DataTypeInterval::equals(const IDataType & rhs) const
9{
10 return typeid(rhs) == typeid(*this) && kind == static_cast<const DataTypeInterval &>(rhs).kind;
11}
12
13template <IntervalKind::Kind kind>
14static DataTypePtr create(const String & /*type_name*/)
15{
16 return DataTypePtr(std::make_shared<DataTypeInterval>(kind));
17}
18
19void registerDataTypeInterval(DataTypeFactory & factory)
20{
21 factory.registerSimpleDataType("IntervalSecond", create<IntervalKind::Second>);
22 factory.registerSimpleDataType("IntervalMinute", create<IntervalKind::Minute>);
23 factory.registerSimpleDataType("IntervalHour", create<IntervalKind::Hour>);
24 factory.registerSimpleDataType("IntervalDay", create<IntervalKind::Day>);
25 factory.registerSimpleDataType("IntervalWeek", create<IntervalKind::Week>);
26 factory.registerSimpleDataType("IntervalMonth", create<IntervalKind::Month>);
27 factory.registerSimpleDataType("IntervalQuarter", create<IntervalKind::Quarter>);
28 factory.registerSimpleDataType("IntervalYear", create<IntervalKind::Year>);
29}
30
31}
32