Merge with master

This commit is contained in:
Alexey Milovidov 2023-11-02 00:33:33 +01:00
parent 016285ea87
commit 697f2591b9
3 changed files with 22 additions and 14 deletions

View File

@ -7,7 +7,6 @@
namespace DB
{
Range::Range(const FieldRef & point) /// NOLINT
: left(point), right(point), left_included(true), right_included(true) {}
@ -164,12 +163,12 @@ Range intersect(const Range & a, const Range & b)
{
Range res = Range::createWholeUniverse();
if (less(a.left, b.left))
if (Range::less(a.left, b.left))
{
res.left = b.left;
res.left_included = b.left_included;
}
else if (equals(a.left, b.left))
else if (Range::equals(a.left, b.left))
{
res.left = a.left;
res.left_included = a.left_included && b.left_included;
@ -180,12 +179,12 @@ Range intersect(const Range & a, const Range & b)
res.left_included = a.left_included;
}
if (less(a.right, b.right))
if (Range::less(a.right, b.right))
{
res.right = a.right;
res.right_included = a.right_included;
}
else if (equals(a.right, b.right))
else if (Range::equals(a.right, b.right))
{
res.right = a.right;
res.right_included = a.right_included && b.right_included;

View File

@ -59,8 +59,8 @@ public:
static Range createRightBounded(const FieldRef & right_point, bool right_included, bool with_null = false);
static Range createLeftBounded(const FieldRef & left_point, bool left_included, bool with_null = false);
static ALWAYS_INLINE bool equals(const Field & lhs, const Field & rhs);
static ALWAYS_INLINE bool less(const Field & lhs, const Field & rhs);
static bool equals(const Field & lhs, const Field & rhs);
static bool less(const Field & lhs, const Field & rhs);
/** Optimize the range. If it has an open boundary and the Field type is "loose"
* - then convert it to closed, narrowing by one.

View File

@ -431,7 +431,8 @@ static void buildORCSearchArgumentImpl(
case KeyCondition::RPNElement::FUNCTION_IN_SET:
case KeyCondition::RPNElement::FUNCTION_NOT_IN_SET:
case KeyCondition::RPNElement::FUNCTION_IS_NULL:
case KeyCondition::RPNElement::FUNCTION_IS_NOT_NULL: {
case KeyCondition::RPNElement::FUNCTION_IS_NOT_NULL:
{
const bool need_wrap_not = curr.function == KeyCondition::RPNElement::FUNCTION_IS_NOT_NULL
|| curr.function == KeyCondition::RPNElement::FUNCTION_NOT_IN_RANGE
|| curr.function == KeyCondition::RPNElement::FUNCTION_NOT_IN_SET;
@ -625,19 +626,24 @@ static void buildORCSearchArgumentImpl(
break;
}
case KeyCondition::RPNElement::FUNCTION_UNKNOWN: {
/// There is no optimization with space-filling curves for ORC.
case KeyCondition::RPNElement::FUNCTION_ARGS_IN_HYPERRECTANGLE:
case KeyCondition::RPNElement::FUNCTION_UNKNOWN:
{
builder.literal(orc::TruthValue::YES_NO_NULL);
rpn_stack.pop_back();
break;
}
case KeyCondition::RPNElement::FUNCTION_NOT: {
case KeyCondition::RPNElement::FUNCTION_NOT:
{
builder.startNot();
rpn_stack.pop_back();
buildORCSearchArgumentImpl(key_condition, header, schema, rpn_stack, builder, format_settings);
builder.end();
break;
}
case KeyCondition::RPNElement::FUNCTION_AND: {
case KeyCondition::RPNElement::FUNCTION_AND:
{
builder.startAnd();
rpn_stack.pop_back();
buildORCSearchArgumentImpl(key_condition, header, schema, rpn_stack, builder, format_settings);
@ -645,7 +651,8 @@ static void buildORCSearchArgumentImpl(
builder.end();
break;
}
case KeyCondition::RPNElement::FUNCTION_OR: {
case KeyCondition::RPNElement::FUNCTION_OR:
{
builder.startOr();
rpn_stack.pop_back();
buildORCSearchArgumentImpl(key_condition, header, schema, rpn_stack, builder, format_settings);
@ -653,12 +660,14 @@ static void buildORCSearchArgumentImpl(
builder.end();
break;
}
case KeyCondition::RPNElement::ALWAYS_FALSE: {
case KeyCondition::RPNElement::ALWAYS_FALSE:
{
builder.literal(orc::TruthValue::NO);
rpn_stack.pop_back();
break;
}
case KeyCondition::RPNElement::ALWAYS_TRUE: {
case KeyCondition::RPNElement::ALWAYS_TRUE:
{
builder.literal(orc::TruthValue::YES);
rpn_stack.pop_back();
break;