2020-03-20 03:32:47 +00:00
|
|
|
#ifndef __clang_analyzer__ // It's too hard to analyze.
|
|
|
|
|
2019-12-15 06:34:43 +00:00
|
|
|
#include "GatherUtils.h"
|
2019-06-21 15:31:37 +00:00
|
|
|
#include "Selectors.h"
|
|
|
|
#include "Algorithms.h"
|
2017-10-12 19:58:39 +00:00
|
|
|
|
2020-02-25 19:05:15 +00:00
|
|
|
namespace DB
|
2017-10-12 19:58:39 +00:00
|
|
|
{
|
2020-02-25 19:05:15 +00:00
|
|
|
|
2020-02-25 18:10:48 +00:00
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int LOGICAL_ERROR;
|
|
|
|
}
|
2017-10-12 19:58:39 +00:00
|
|
|
|
2020-02-25 19:05:15 +00:00
|
|
|
|
|
|
|
namespace GatherUtils
|
|
|
|
{
|
|
|
|
|
2018-01-19 11:41:26 +00:00
|
|
|
struct ArrayConcat : public ArraySinkSourceSelector<ArrayConcat>
|
2017-10-12 19:58:39 +00:00
|
|
|
{
|
|
|
|
using Sources = std::vector<std::unique_ptr<IArraySource>>;
|
|
|
|
|
2018-01-19 11:41:26 +00:00
|
|
|
template <typename Source, typename Sink>
|
|
|
|
static void selectSourceSink(Source &&, Sink && sink, const Sources & sources)
|
2017-10-12 19:58:39 +00:00
|
|
|
{
|
2018-01-19 11:41:26 +00:00
|
|
|
using SourceType = typename std::decay<Source>::type;
|
|
|
|
concat<SourceType, Sink>(sources, sink);
|
2017-10-12 19:58:39 +00:00
|
|
|
}
|
|
|
|
|
2018-01-19 11:41:26 +00:00
|
|
|
template <typename Source, typename Sink>
|
|
|
|
static void selectSourceSink(ConstSource<Source> &&, Sink && sink, const Sources & sources)
|
2017-10-12 19:58:39 +00:00
|
|
|
{
|
2018-01-19 11:41:26 +00:00
|
|
|
using SourceType = typename std::decay<Source>::type;
|
|
|
|
concat<SourceType, Sink>(sources, sink);
|
2017-10-12 19:58:39 +00:00
|
|
|
}
|
|
|
|
|
2018-01-19 11:41:26 +00:00
|
|
|
template <typename Source, typename Sink>
|
|
|
|
static void selectSourceSink(ConstSource<Source> &, Sink && sink, const Sources & sources)
|
2017-10-12 19:58:39 +00:00
|
|
|
{
|
2018-01-19 11:41:26 +00:00
|
|
|
using SourceType = typename std::decay<Source>::type;
|
|
|
|
concat<SourceType, Sink>(sources, sink);
|
2017-10-12 19:58:39 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-01-19 11:41:26 +00:00
|
|
|
void concat(const std::vector<std::unique_ptr<IArraySource>> & sources, IArraySink & sink)
|
2017-10-12 19:58:39 +00:00
|
|
|
{
|
2018-01-19 11:41:26 +00:00
|
|
|
if (sources.empty())
|
|
|
|
throw Exception("Concat function should get at least 1 ArraySource", ErrorCodes::LOGICAL_ERROR);
|
|
|
|
return ArrayConcat::select(*sources.front(), sink, sources);
|
2017-10-12 19:58:39 +00:00
|
|
|
}
|
2020-03-20 03:32:47 +00:00
|
|
|
|
2017-10-12 19:58:39 +00:00
|
|
|
}
|
2020-02-26 14:14:25 +00:00
|
|
|
|
|
|
|
}
|
2020-03-20 03:32:47 +00:00
|
|
|
|
|
|
|
#endif
|