Split has.

This commit is contained in:
Nikolai Kochetov 2020-09-16 16:33:28 +03:00
parent 715b1a41ed
commit bc1031be9b
6 changed files with 92 additions and 37 deletions

View File

@ -52,7 +52,26 @@ ColumnArray::MutablePtr sliceFromRightConstantOffsetBounded(IArraySource & src,
ColumnArray::MutablePtr sliceDynamicOffsetUnbounded(IArraySource & src, const IColumn & offset_column);
ColumnArray::MutablePtr sliceDynamicOffsetBounded(IArraySource & src, const IColumn & offset_column, const IColumn & length_column);
void sliceHas(IArraySource & first, IArraySource & second, ArraySearchType search_type, ColumnUInt8 & result);
void sliceHasAny(IArraySource & first, IArraySource & second, ColumnUInt8 & result);
void sliceHasAll(IArraySource & first, IArraySource & second, ColumnUInt8 & result);
void sliceHasSubstr(IArraySource & first, IArraySource & second, ColumnUInt8 & result);
void sliceHas(IArraySource & first, IArraySource & second, ArraySearchType search_type, ColumnUInt8 & result)
{
switch (search_type)
{
case ArraySearchType::All:
sliceHasAny(first, second, result);
break;
case ArraySearchType::Any:
sliceHasAll(first, second, result);
break;
case ArraySearchType::Substr:
sliceHasSubstr(first, second, result);
break;
}
}
void push(IArraySource & array_source, IValueSource & value_source, IArraySink & sink, bool push_front);

View File

@ -1,35 +0,0 @@
#include "GatherUtils.h"
#include "Selectors.h"
#include "Algorithms.h"
namespace DB::GatherUtils
{
struct ArrayHasSelectArraySourcePair : public ArraySourcePairSelector<ArrayHasSelectArraySourcePair>
{
template <typename FirstSource, typename SecondSource>
static void selectSourcePair(FirstSource && first, SecondSource && second, ArraySearchType search_type, ColumnUInt8 & result)
{
switch (search_type)
{
case ArraySearchType::All:
arrayAllAny<ArraySearchType::All>(first, second, result);
break;
case ArraySearchType::Any:
arrayAllAny<ArraySearchType::Any>(first, second, result);
break;
case ArraySearchType::Substr:
arrayAllAny<ArraySearchType::Substr>(first, second, result);
break;
}
}
};
void sliceHas(IArraySource & first, IArraySource & second, ArraySearchType search_type, ColumnUInt8 & result)
{
ArrayHasSelectArraySourcePair::select(first, second, search_type, result);
}
}

View File

@ -0,0 +1,23 @@
#include "GatherUtils.h"
#include "Selectors.h"
#include "Algorithms.h"
namespace DB::GatherUtils
{
struct ArrayHasAllSelectArraySourcePair : public ArraySourcePairSelector<ArrayHasSelectArraySourcePair>
{
template <typename FirstSource, typename SecondSource>
static void selectSourcePair(FirstSource && first, SecondSource && second, ArraySearchType search_type, ColumnUInt8 & result)
{
arrayAllAny<ArraySearchType::All>(first, second, result);
}
};
void sliceHasAll(IArraySource & first, IArraySource & second, ColumnUInt8 & result)
{
ArrayHasAllSelectArraySourcePair::select(first, second, result);
}
}

View File

@ -0,0 +1,23 @@
#include "GatherUtils.h"
#include "Selectors.h"
#include "Algorithms.h"
namespace DB::GatherUtils
{
struct ArrayHasAnySelectArraySourcePair : public ArraySourcePairSelector<ArrayHasSelectArraySourcePair>
{
template <typename FirstSource, typename SecondSource>
static void selectSourcePair(FirstSource && first, SecondSource && second, ArraySearchType search_type, ColumnUInt8 & result)
{
arrayAllAny<ArraySearchType::Any>(first, second, result);
}
};
void sliceHasAny(IArraySource & first, IArraySource & second, ColumnUInt8 & result)
{
ArrayHasAnySelectArraySourcePair::select(first, second, result);
}
}

View File

@ -0,0 +1,23 @@
#include "GatherUtils.h"
#include "Selectors.h"
#include "Algorithms.h"
namespace DB::GatherUtils
{
struct ArrayHasSubstrSelectArraySourcePair : public ArraySourcePairSelector<ArrayHasSelectArraySourcePair>
{
template <typename FirstSource, typename SecondSource>
static void selectSourcePair(FirstSource && first, SecondSource && second, ArraySearchType search_type, ColumnUInt8 & result)
{
arrayAllAny<ArraySearchType::Substr>(first, second, result);
}
};
void sliceHasSubstr(IArraySource & first, IArraySource & second, ColumnUInt8 & result)
{
ArrayHasSubstrSelectArraySourcePair::select(first, second, result);
}
}

View File

@ -190,7 +190,9 @@ SRCS(
GatherUtils/createArraySink.cpp
GatherUtils/createArraySource.cpp
GatherUtils/createValueSource.cpp
GatherUtils/has.cpp
GatherUtils/has_all.cpp
GatherUtils/has_any.cpp
GatherUtils/has_substr.cpp
GatherUtils/push.cpp
GatherUtils/resizeConstantSize.cpp
GatherUtils/resizeDynamicSize.cpp