Added requested changes. [#METR-23473]

This commit is contained in:
Vitaliy Lyudvichenko 2016-11-23 16:33:05 +03:00
parent e07fc7cea5
commit d27951b4a7
3 changed files with 6 additions and 6 deletions

View File

@ -224,7 +224,7 @@ public:
/// Не учитывает секцию SAMPLE. all_columns - набор всех столбцов таблицы.
PKCondition(ASTPtr & query, const Context & context, const NamesAndTypesList & all_columns, const SortDescription & sort_descr,
const Block & pk_sample_block);
const Block & pk_sample_block = Block());
/// Выполнимо ли условие в диапазоне ключей.
/// left_pk и right_pk должны содержать все поля из sort_descr в соответствующем порядке.

View File

@ -195,11 +195,10 @@ BlockInputStreams MergeTreeDataSelectExecutor::read(
SortDescription sort_descr = data.getSortDescription();
Block pk_sample_block = data.getPrimaryExpression()->getSampleBlock();
PKCondition key_condition(query, context, available_real_and_virtual_columns, sort_descr, pk_sample_block);
PKCondition key_condition(query, context, available_real_and_virtual_columns, sort_descr,
data.getPrimaryExpression()->getSampleBlock());
PKCondition date_condition(query, context, available_real_and_virtual_columns,
SortDescription(1, SortColumnDescription(data.date_column_name, 1)), pk_sample_block);
SortDescription(1, SortColumnDescription(data.date_column_name, 1)));
if (settings.force_primary_key && key_condition.alwaysUnknownOrTrue())
{

View File

@ -4,6 +4,7 @@
#include <DB/Interpreters/ExpressionActions.h>
#include <DB/DataTypes/DataTypeEnum.h>
#include <DB/DataTypes/DataTypeDate.h>
#include <DB/DataTypes/DataTypeDateTime.h>
#include <DB/DataTypes/DataTypeString.h>
#include <DB/Columns/ColumnSet.h>
#include <DB/Columns/ColumnTuple.h>
@ -369,7 +370,7 @@ static bool tryCastValueToType(const DataTypePtr & desired_type, const DataTypeP
src_value = data_type_enum->castToValue(src_value);
}
/// Convert 'YYYY-MM-DD' Strings to Date
else if (typeid_cast<const DataTypeDate *>(desired_type.get()))
else if (typeid_cast<const DataTypeDate *>(desired_type.get()) || typeid_cast<const DataTypeDateTime *>(desired_type.get()))
{
if (typeid_cast<const DataTypeString *>(src_type.get()))
{