dbms: Server: Support for multiple time zones: development [#METR-15618]

This commit is contained in:
Alexey Arno 2015-07-02 17:14:07 +03:00
parent 7ef2b9595a
commit 426e27d98e
2 changed files with 15 additions and 25 deletions

View File

@ -261,15 +261,6 @@ struct Transformer
}
}
static void vector_fixed(const typename ColumnVector<FromType>::Container_t & vec_from, const ColumnString::Chars_t & data,
size_t n, typename ColumnVector<ToType>::Container_t & vec_to)
{
auto & local_date_lut = DateLUT::instance();
auto & remote_date_lut = DateLUT::instance(std::string(reinterpret_cast<const char*>(&data[0]), n));
for (size_t i = 0; i < vec_from.size(); ++i)
vec_to[i] = Transform::execute(vec_from[i], remote_date_lut, local_date_lut);
}
static void vector_constant(const typename ColumnVector<FromType>::Container_t & vec_from, const std::string & data,
typename ColumnVector<ToType>::Container_t & vec_to)
{
@ -295,13 +286,6 @@ struct Transformer
}
}
static void constant_fixed(const FromType & from, const ColumnString::Chars_t & data, size_t n, ToType & to)
{
auto & local_date_lut = DateLUT::instance();
auto & remote_date_lut = DateLUT::instance(std::string(reinterpret_cast<const char*>(&data[0]), n));
to = Transform::execute(from, remote_date_lut, local_date_lut);
}
static void constant_constant(const FromType & from, const std::string & data, ToType & to)
{
auto & local_date_lut = DateLUT::instance();
@ -352,7 +336,6 @@ struct DateTimeTransformImpl
{
const ColumnPtr time_zone_col = block.getByPosition(arguments[1]).column;
const ColumnString * time_zones = typeid_cast<const ColumnString *>(&*time_zone_col);
const ColumnFixedString * fixed_time_zone = typeid_cast<const ColumnFixedString *>(&*time_zone_col);
const ColumnConstString * const_time_zone = typeid_cast<const ColumnConstString *>(&*time_zone_col);
if (sources)
@ -366,8 +349,6 @@ struct DateTimeTransformImpl
if (time_zones)
Op::vector_vector(vec_from, time_zones->getChars(), time_zones->getOffsets(), vec_to);
else if (fixed_time_zone)
Op::vector_fixed(vec_from, fixed_time_zone->getChars(), fixed_time_zone->getN(), vec_to);
else if (const_time_zone)
Op::vector_constant(vec_from, const_time_zone->getData(), vec_to);
else
@ -387,12 +368,6 @@ struct DateTimeTransformImpl
Op::constant_vector(const_source->getData(), time_zones->getChars(), time_zones->getOffsets(), vec_to);
}
else if (fixed_time_zone)
{
ToType res;
Op::constant_fixed(const_source->getData(), fixed_time_zone->getChars(), fixed_time_zone->getN(), res);
block.getByPosition(result).column = new ColumnConst<ToType>(const_source->size(), res);
}
else if (const_time_zone)
{
ToType res;

View File

@ -23,6 +23,21 @@
1970-01-02 09:00:00 1970-01-02 10:00:00
1970-01-02 18:00:00 1970-01-02 18:00:00
1970-01-02 01:30:00 1970-01-02 01:30:00
2014-12-29 2015-01-01 2015-01-01 1970-01-02 12:00:00
2014-09-29 2014-09-01 2014-07-01 1970-01-02 21:50:00
2015-07-13 2015-07-01 2015-07-01 1970-01-02 19:30:00
2014-12-22 2014-12-01 2014-10-01 1970-01-02 21:00:00
2015-03-09 2015-03-01 2015-01-01 1970-01-02 02:00:00
2014-12-29 2015-01-01 2015-01-01 1970-01-02 01:30:00
2014-12-22 2014-12-01 2014-10-01 1970-01-02 13:30:00
2014-09-29 2014-09-01 2014-10-01 1970-01-02 11:20:00
2015-07-13 2015-07-01 2015-07-01 1970-01-02 02:00:00
2015-03-09 2015-03-01 2015-01-01 1970-01-02 02:00:00
2015-03-09 2015-03-01 2015-01-01 1970-01-02 13:30:00
2015-03-09 2015-03-01 2015-01-01 1970-01-02 11:30:00
2015-03-09 2015-03-01 2015-01-01 1970-01-02 10:30:00
2015-03-09 2015-03-01 2015-01-01 1970-01-02 19:30:00
2015-03-09 2015-03-01 2015-01-01 1970-01-02 02:00:00
2015-07-15 13:30:00
2015-07-15 12:30:00
2015-07-15 11:30:00