update code style

This commit is contained in:
Vxider 2021-05-29 10:29:38 +00:00
parent 635870f50c
commit b56d471540
6 changed files with 479 additions and 478 deletions

View File

@ -137,7 +137,7 @@ struct ToStartOfTransform;
namespace
{
static std::tuple<IntervalKind::Kind, Int64>
std::tuple<IntervalKind::Kind, Int64>
dispatchForIntervalColumns(const ColumnWithTypeAndName & interval_column, const String & function_name)
{
const auto * interval_type = checkAndGetDataType<DataTypeInterval>(interval_column.type.get());
@ -157,7 +157,7 @@ namespace
return {interval_type->getKind(), num_units};
}
static ColumnPtr executeWindowBound(const ColumnPtr & column, int index, const String & function_name)
ColumnPtr executeWindowBound(const ColumnPtr & column, int index, const String & function_name)
{
if (const ColumnTuple * col_tuple = checkAndGetColumn<ColumnTuple>(column.get()); col_tuple)
{
@ -224,17 +224,17 @@ namespace
checkIntervalArgument(argument, function_name, interval_kind, result_type_is_date);
return true;
}
}
template <WindowFunctionName type>
struct WindowImpl
{
template <WindowFunctionName type>
struct WindowImpl
{
static DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments, const String & function_name);
};
};
template <>
struct WindowImpl<TUMBLE>
{
template <>
struct WindowImpl<TUMBLE>
{
static constexpr auto name = "TUMBLE";
[[maybe_unused]] static DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments, const String & function_name)
@ -327,11 +327,11 @@ namespace
result.emplace_back(std::move(end));
return ColumnTuple::create(std::move(result));
}
};
};
template <>
struct WindowImpl<TUMBLE_START>
{
template <>
struct WindowImpl<TUMBLE_START>
{
static constexpr auto name = "TUMBLE_START";
static DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments, const String & function_name)
@ -360,12 +360,11 @@ namespace
result_column_ = arguments[0].column;
return executeWindowBound(result_column_, 0, function_name);
}
};
};
template <>
struct WindowImpl<TUMBLE_END>
{
template <>
struct WindowImpl<TUMBLE_END>
{
static constexpr auto name = "TUMBLE_END";
[[maybe_unused]] static DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments, const String & function_name)
@ -383,11 +382,11 @@ namespace
result_column_ = arguments[0].column;
return executeWindowBound(result_column_, 1, function_name);
}
};
};
template <>
struct WindowImpl<HOP>
{
template <>
struct WindowImpl<HOP>
{
static constexpr auto name = "HOP";
[[maybe_unused]] static DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments, const String & function_name)
@ -517,11 +516,11 @@ namespace
result.emplace_back(std::move(end));
return ColumnTuple::create(std::move(result));
}
};
};
template <>
struct WindowImpl<WINDOW_ID>
{
template <>
struct WindowImpl<WINDOW_ID>
{
static constexpr auto name = "WINDOW_ID";
[[maybe_unused]] static DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments, const String & function_name)
@ -671,11 +670,11 @@ namespace
return dispatchForHopColumns(arguments, function_name);
}
}
};
};
template <>
struct WindowImpl<HOP_START>
{
template <>
struct WindowImpl<HOP_START>
{
static constexpr auto name = "HOP_START";
static DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments, const String & function_name)
@ -711,11 +710,11 @@ namespace
result_column_ = WindowImpl<HOP>::dispatchForColumns(arguments, function_name);
return executeWindowBound(result_column_, 0, function_name);
}
};
};
template <>
struct WindowImpl<HOP_END>
{
template <>
struct WindowImpl<HOP_END>
{
static constexpr auto name = "HOP_END";
[[maybe_unused]] static DataTypePtr getReturnType(const ColumnsWithTypeAndName & arguments, const String & function_name)
@ -740,7 +739,6 @@ namespace
return executeWindowBound(result_column_, 1, function_name);
}
};
};
template <WindowFunctionName type>

View File

@ -205,7 +205,10 @@ namespace
static void visit(const ASTIdentifier & node, ASTPtr & node_ptr, Data & data)
{
if (node.getColumnName() == data.window_id_alias)
dynamic_cast<ASTIdentifier *>(node_ptr.get())->setShortName(data.window_id_name);
{
if (auto identifier = std::dynamic_pointer_cast<ASTIdentifier>(node_ptr))
identifier->setShortName(data.window_id_name);
}
}
};

View File

View File

View File

View File