mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#pragma once
|
|
#include <string>
|
|
|
|
namespace DB
|
|
{
|
|
namespace ASOF
|
|
{
|
|
|
|
enum class Inequality
|
|
{
|
|
None = 0,
|
|
Less,
|
|
Greater,
|
|
LessOrEquals,
|
|
GreaterOrEquals,
|
|
};
|
|
|
|
inline Inequality getInequality(const std::string & func_name)
|
|
{
|
|
Inequality inequality{Inequality::None};
|
|
if (func_name == "less")
|
|
inequality = Inequality::Less;
|
|
else if (func_name == "greater")
|
|
inequality = Inequality::Greater;
|
|
else if (func_name == "lessOrEquals")
|
|
inequality = Inequality::LessOrEquals;
|
|
else if (func_name == "greaterOrEquals")
|
|
inequality = Inequality::GreaterOrEquals;
|
|
return inequality;
|
|
}
|
|
|
|
inline Inequality reverseInequality(Inequality inequality)
|
|
{
|
|
if (inequality == Inequality::Less)
|
|
return Inequality::Greater;
|
|
else if (inequality == Inequality::Greater)
|
|
return Inequality::Less;
|
|
else if (inequality == Inequality::LessOrEquals)
|
|
return Inequality::GreaterOrEquals;
|
|
else if (inequality == Inequality::GreaterOrEquals)
|
|
return Inequality::LessOrEquals;
|
|
return Inequality::None;
|
|
}
|
|
|
|
}
|
|
}
|