Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
6f15a0d4
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6f15a0d4
编写于
5月 02, 2020
作者:
V
Vitaly Baranov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve the function range() to allow iterating through enum values.
上级
c7213ab6
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
101 addition
and
53 deletion
+101
-53
base/ext/range.h
base/ext/range.h
+44
-24
src/Access/EnabledQuota.cpp
src/Access/EnabledQuota.cpp
+1
-1
src/Access/EnabledQuota.h
src/Access/EnabledQuota.h
+1
-1
src/Access/EnabledRowPolicies.h
src/Access/EnabledRowPolicies.h
+1
-2
src/Access/Quota.cpp
src/Access/Quota.cpp
+8
-1
src/Access/Quota.h
src/Access/Quota.h
+16
-5
src/Access/QuotaCache.cpp
src/Access/QuotaCache.cpp
+4
-2
src/Access/QuotaUsageInfo.h
src/Access/QuotaUsageInfo.h
+1
-1
src/Access/RowPolicy.cpp
src/Access/RowPolicy.cpp
+10
-2
src/Access/RowPolicy.h
src/Access/RowPolicy.h
+2
-1
src/Access/RowPolicyCache.cpp
src/Access/RowPolicyCache.cpp
+2
-2
src/Interpreters/InterpreterShowCreateAccessEntityQuery.cpp
src/Interpreters/InterpreterShowCreateAccessEntityQuery.cpp
+1
-1
src/Interpreters/InterpreterShowQuotasQuery.cpp
src/Interpreters/InterpreterShowQuotasQuery.cpp
+1
-1
src/Parsers/ASTCreateQuotaQuery.cpp
src/Parsers/ASTCreateQuotaQuery.cpp
+1
-1
src/Parsers/ASTCreateQuotaQuery.h
src/Parsers/ASTCreateQuotaQuery.h
+1
-1
src/Parsers/ParserCreateQuotaQuery.cpp
src/Parsers/ParserCreateQuotaQuery.cpp
+3
-3
src/Storages/System/StorageSystemQuotaUsage.cpp
src/Storages/System/StorageSystemQuotaUsage.cpp
+1
-1
src/Storages/System/StorageSystemQuotas.cpp
src/Storages/System/StorageSystemQuotas.cpp
+2
-2
src/Storages/System/StorageSystemRowPolicies.cpp
src/Storages/System/StorageSystemRowPolicies.cpp
+1
-1
未找到文件。
base/ext/range.h
浏览文件 @
6f15a0d4
#pragma once
#include <type_traits>
#include <boost/range/counting_range.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <type_traits>
namespace
ext
{
/// For loop adaptor which is used to iterate through a half-closed interval [begin, end).
template
<
typename
BeginType
,
typename
EndType
>
inline
auto
range
(
BeginType
begin
,
EndType
end
)
namespace
internal
{
template
<
typename
ResultType
,
typename
CountingType
,
typename
BeginType
,
typename
EndType
>
auto
rangeImpl
(
BeginType
begin
,
EndType
end
)
{
using
CommonType
=
typename
std
::
common_type
<
BeginType
,
EndType
>::
type
;
return
boost
::
counting_range
<
CommonType
>
(
begin
,
end
);
if
constexpr
(
std
::
is_same_v
<
ResultType
,
CountingType
>
)
return
boost
::
counting_range
<
CountingType
>
(
static_cast
<
CountingType
>
(
begin
),
static_cast
<
CountingType
>
(
end
));
else
return
boost
::
counting_range
<
CountingType
>
(
static_cast
<
CountingType
>
(
begin
),
static_cast
<
CountingType
>
(
end
))
|
boost
::
adaptors
::
transformed
([](
CountingType
x
)
{
return
static_cast
<
ResultType
>
(
x
);
});
}
}
template
<
typename
Type
>
inline
auto
range
(
Type
end
)
/// For loop adaptor which is used to iterate through a half-closed interval [begin, end).
/// The parameters `begin` and `end` can have any integral or enum types.
template
<
typename
BeginType
,
typename
EndType
,
typename
=
std
::
enable_if_t
<
(
std
::
is_integral_v
<
BeginType
>
||
std
::
is_enum_v
<
BeginType
>
)
&&
(
std
::
is_integral_v
<
EndType
>
||
std
::
is_enum_v
<
EndType
>
)
&&
(
!
std
::
is_enum_v
<
BeginType
>
||
!
std
::
is_enum_v
<
EndType
>
||
std
::
is_same_v
<
BeginType
,
EndType
>
),
void
>>
inline
auto
range
(
BeginType
begin
,
EndType
end
)
{
if
constexpr
(
std
::
is_integral_v
<
BeginType
>
&&
std
::
is_integral_v
<
EndType
>
)
{
return
range
<
Type
,
Type
>
(
static_cast
<
Type
>
(
0
),
end
);
using
CommonType
=
std
::
common_type_t
<
BeginType
,
EndType
>
;
return
internal
::
rangeImpl
<
CommonType
,
CommonType
>
(
begin
,
end
);
}
/// The same as range(), but every value is casted statically to a specified `ValueType`.
/// This is useful to iterate through all constants of a enum.
template
<
typename
ValueType
,
typename
BeginType
,
typename
EndType
>
inline
auto
range_with_static_cast
(
BeginType
begin
,
EndType
end
)
else
if
constexpr
(
std
::
is_enum_v
<
BeginType
>
)
{
using
CommonType
=
typename
std
::
common_type
<
BeginType
,
EndType
>::
type
;
if
constexpr
(
std
::
is_same_v
<
ValueType
,
CommonType
>
)
return
boost
::
counting_range
<
CommonType
>
(
begin
,
end
);
else
return
boost
::
counting_range
<
CommonType
>
(
begin
,
end
)
|
boost
::
adaptors
::
transformed
([](
CommonType
x
)
->
ValueType
{
return
static_cast
<
ValueType
>
(
x
);
});
return
internal
::
rangeImpl
<
BeginType
,
std
::
underlying_type_t
<
BeginType
>>
(
begin
,
end
);
}
template
<
typename
ValueType
,
typename
EndType
>
inline
auto
range_with_static_cast
(
EndType
end
)
else
{
return
range_with_static_cast
<
ValueType
,
EndType
,
EndType
>
(
static_cast
<
EndType
>
(
0
)
,
end
);
return
internal
::
rangeImpl
<
EndType
,
std
::
underlying_type_t
<
EndType
>>
(
begin
,
end
);
}
}
/// For loop adaptor which is used to iterate through a half-closed interval [0, end).
/// The parameter `end` can have any integral or enum type.
/// The same as range(0, end).
template
<
typename
Type
,
typename
=
std
::
enable_if_t
<
std
::
is_integral_v
<
Type
>
||
std
::
is_enum_v
<
Type
>
,
void
>>
inline
auto
range
(
Type
end
)
{
if
constexpr
(
std
::
is_integral_v
<
Type
>
)
return
internal
::
rangeImpl
<
Type
,
Type
>
(
0
,
end
);
else
return
internal
::
rangeImpl
<
Type
,
std
::
underlying_type_t
<
Type
>>
(
0
,
end
);
}
}
src/Access/EnabledQuota.cpp
浏览文件 @
6f15a0d4
...
...
@@ -128,7 +128,7 @@ struct EnabledQuota::Impl
const
Intervals
&
intervals
,
std
::
chrono
::
system_clock
::
time_point
current_time
)
{
for
(
auto
resource_type
:
ext
::
range
_with_static_cast
<
Quota
::
ResourceType
>
(
Quota
::
MAX_RESOURCE_TYPE
))
for
(
auto
resource_type
:
ext
::
range
(
Quota
::
MAX_RESOURCE_TYPE
))
checkExceeded
(
user_name
,
intervals
,
resource_type
,
current_time
);
}
};
...
...
src/Access/EnabledQuota.h
浏览文件 @
6f15a0d4
...
...
@@ -65,7 +65,7 @@ private:
const
String
&
getUserName
()
const
{
return
params
.
user_name
;
}
static
constexpr
size_t
MAX_RESOURCE_TYPE
=
Quota
::
MAX_RESOURCE_TYPE
;
static
constexpr
auto
MAX_RESOURCE_TYPE
=
Quota
::
MAX_RESOURCE_TYPE
;
struct
Interval
{
...
...
src/Access/EnabledRowPolicies.h
浏览文件 @
6f15a0d4
...
...
@@ -58,8 +58,7 @@ private:
{
size_t
operator
()(
const
DatabaseAndTableNameRef
&
database_and_table_name
)
const
;
};
static
constexpr
size_t
MAX_CONDITION_TYPE
=
RowPolicy
::
MAX_CONDITION_TYPE
;
using
ParsedConditions
=
std
::
array
<
ASTPtr
,
MAX_CONDITION_TYPE
>
;
using
ParsedConditions
=
std
::
array
<
ASTPtr
,
RowPolicy
::
MAX_CONDITION_TYPE
>
;
struct
MixedConditions
{
std
::
unique_ptr
<
DatabaseAndTableName
>
database_and_table_name_keeper
;
...
...
src/Access/Quota.cpp
浏览文件 @
6f15a0d4
...
...
@@ -5,6 +5,12 @@
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
LOGICAL_ERROR
;
}
Quota
::
Limits
::
Limits
()
{
boost
::
range
::
fill
(
max
,
0
);
...
...
@@ -38,8 +44,9 @@ const char * Quota::resourceTypeToColumnName(ResourceType resource_type)
case
Quota
::
READ_ROWS
:
return
"read_rows"
;
case
Quota
::
READ_BYTES
:
return
"read_bytes"
;
case
Quota
::
EXECUTION_TIME
:
return
"execution_time"
;
case
Quota
::
MAX_RESOURCE_TYPE
:
break
;
}
__builtin_unreachable
(
);
throw
Exception
(
"Unexpected resource type: "
+
std
::
to_string
(
static_cast
<
int
>
(
resource_type
)),
ErrorCodes
::
LOGICAL_ERROR
);
}
}
src/Access/Quota.h
浏览文件 @
6f15a0d4
...
...
@@ -7,6 +7,12 @@
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
LOGICAL_ERROR
;
}
/** Quota for resources consumption for specific interval.
* Used to limit resource usage by user.
* Quota is applied "softly" - could be slightly exceed, because it is checked usually only on each block of processed data.
...
...
@@ -26,8 +32,9 @@ struct Quota : public IAccessEntity
READ_ROWS
,
/// Number of rows read from tables.
READ_BYTES
,
/// Number of bytes read from tables.
EXECUTION_TIME
,
/// Total amount of query execution time in nanoseconds.
MAX_RESOURCE_TYPE
};
static
constexpr
size_t
MAX_RESOURCE_TYPE
=
7
;
using
ResourceAmount
=
UInt64
;
static
constexpr
ResourceAmount
UNLIMITED
=
0
;
/// 0 means unlimited.
...
...
@@ -58,8 +65,9 @@ struct Quota : public IAccessEntity
CLIENT_KEY
,
/// Client should explicitly supply a key to use.
CLIENT_KEY_OR_USER_NAME
,
/// Same as CLIENT_KEY, but use USER_NAME if the client doesn't supply a key.
CLIENT_KEY_OR_IP_ADDRESS
,
/// Same as CLIENT_KEY, but use IP_ADDRESS if the client doesn't supply a key.
MAX
};
static
constexpr
size_t
MAX_KEY_TYPE
=
6
;
KeyType
key_type
=
KeyType
::
NONE
;
/// Which roles or users should use this quota.
...
...
@@ -88,8 +96,9 @@ inline const char * Quota::getNameOfResourceType(ResourceType resource_type)
case
Quota
::
READ_ROWS
:
return
"read rows"
;
case
Quota
::
READ_BYTES
:
return
"read bytes"
;
case
Quota
::
EXECUTION_TIME
:
return
"execution time"
;
case
Quota
::
MAX_RESOURCE_TYPE
:
break
;
}
__builtin_unreachable
(
);
throw
Exception
(
"Unexpected resource type: "
+
std
::
to_string
(
static_cast
<
int
>
(
resource_type
)),
ErrorCodes
::
LOGICAL_ERROR
);
}
...
...
@@ -104,8 +113,9 @@ inline const char * Quota::resourceTypeToKeyword(ResourceType resource_type)
case
Quota
::
READ_ROWS
:
return
"READ ROWS"
;
case
Quota
::
READ_BYTES
:
return
"READ BYTES"
;
case
Quota
::
EXECUTION_TIME
:
return
"EXECUTION TIME"
;
case
Quota
::
MAX_RESOURCE_TYPE
:
break
;
}
__builtin_unreachable
(
);
throw
Exception
(
"Unexpected resource type: "
+
std
::
to_string
(
static_cast
<
int
>
(
resource_type
)),
ErrorCodes
::
LOGICAL_ERROR
);
}
...
...
@@ -119,8 +129,9 @@ inline const char * Quota::getNameOfKeyType(KeyType key_type)
case
KeyType
::
CLIENT_KEY
:
return
"client key"
;
case
KeyType
::
CLIENT_KEY_OR_USER_NAME
:
return
"client key or user name"
;
case
KeyType
::
CLIENT_KEY_OR_IP_ADDRESS
:
return
"client key or ip address"
;
case
KeyType
::
MAX
:
break
;
}
__builtin_unreachable
(
);
throw
Exception
(
"Unexpected quota key type: "
+
std
::
to_string
(
static_cast
<
int
>
(
key_type
)),
ErrorCodes
::
LOGICAL_ERROR
);
}
...
...
src/Access/QuotaCache.cpp
浏览文件 @
6f15a0d4
...
...
@@ -17,6 +17,7 @@ namespace DB
namespace
ErrorCodes
{
extern
const
int
QUOTA_REQUIRES_CLIENT_KEY
;
extern
const
int
LOGICAL_ERROR
;
}
...
...
@@ -72,8 +73,9 @@ String QuotaCache::QuotaInfo::calculateKey(const EnabledQuota & enabled) const
return
params
.
client_key
;
return
params
.
client_address
.
toString
();
}
case
KeyType
::
MAX
:
break
;
}
__builtin_unreachable
(
);
throw
Exception
(
"Unexpected quota key type: "
+
std
::
to_string
(
static_cast
<
int
>
(
quota
->
key_type
)),
ErrorCodes
::
LOGICAL_ERROR
);
}
...
...
@@ -101,7 +103,7 @@ boost::shared_ptr<const EnabledQuota::Intervals> QuotaCache::QuotaInfo::rebuildI
new_intervals
->
quota_key
=
key
;
auto
&
intervals
=
new_intervals
->
intervals
;
intervals
.
reserve
(
quota
->
all_limits
.
size
());
static
constexpr
size_t
MAX_RESOURCE_TYPE
=
Quota
::
MAX_RESOURCE_TYPE
;
static
constexpr
auto
MAX_RESOURCE_TYPE
=
Quota
::
MAX_RESOURCE_TYPE
;
for
(
const
auto
&
limits
:
quota
->
all_limits
)
{
intervals
.
emplace_back
();
...
...
src/Access/QuotaUsageInfo.h
浏览文件 @
6f15a0d4
...
...
@@ -11,7 +11,7 @@ struct QuotaUsageInfo
{
using
ResourceType
=
Quota
::
ResourceType
;
using
ResourceAmount
=
Quota
::
ResourceAmount
;
static
constexpr
size_t
MAX_RESOURCE_TYPE
=
Quota
::
MAX_RESOURCE_TYPE
;
static
constexpr
auto
MAX_RESOURCE_TYPE
=
Quota
::
MAX_RESOURCE_TYPE
;
struct
Interval
{
...
...
src/Access/RowPolicy.cpp
浏览文件 @
6f15a0d4
...
...
@@ -6,6 +6,12 @@
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
LOGICAL_ERROR
;
}
namespace
{
void
generateFullNameImpl
(
const
String
&
database_
,
const
String
&
table_name_
,
const
String
&
policy_name_
,
String
&
full_name_
)
...
...
@@ -90,8 +96,9 @@ const char * RowPolicy::conditionTypeToString(ConditionType index)
case
UPDATE_FILTER
:
return
"UPDATE_FILTER"
;
case
UPDATE_CHECK
:
return
"UPDATE_CHECK"
;
case
DELETE_FILTER
:
return
"DELETE_FILTER"
;
case
MAX_CONDITION_TYPE
:
break
;
}
__builtin_unreachable
(
);
throw
Exception
(
"Unexpected condition type: "
+
std
::
to_string
(
static_cast
<
int
>
(
index
)),
ErrorCodes
::
LOGICAL_ERROR
);
}
...
...
@@ -104,8 +111,9 @@ const char * RowPolicy::conditionTypeToColumnName(ConditionType index)
case
UPDATE_FILTER
:
return
"update_filter"
;
case
UPDATE_CHECK
:
return
"update_check"
;
case
DELETE_FILTER
:
return
"delete_filter"
;
case
MAX_CONDITION_TYPE
:
break
;
}
__builtin_unreachable
(
);
throw
Exception
(
"Unexpected condition type: "
+
std
::
to_string
(
static_cast
<
int
>
(
index
)),
ErrorCodes
::
LOGICAL_ERROR
);
}
}
src/Access/RowPolicy.h
浏览文件 @
6f15a0d4
...
...
@@ -44,8 +44,9 @@ struct RowPolicy : public IAccessEntity
UPDATE_FILTER
,
UPDATE_CHECK
,
DELETE_FILTER
,
MAX_CONDITION_TYPE
};
static
constexpr
size_t
MAX_CONDITION_TYPE
=
5
;
static
const
char
*
conditionTypeToString
(
ConditionType
index
);
static
const
char
*
conditionTypeToColumnName
(
ConditionType
index
);
...
...
src/Access/RowPolicyCache.cpp
浏览文件 @
6f15a0d4
...
...
@@ -16,7 +16,7 @@ namespace DB
namespace
{
using
ConditionType
=
RowPolicy
::
ConditionType
;
constexpr
size_t
MAX_CONDITION_TYPE
=
RowPolicy
::
MAX_CONDITION_TYPE
;
constexpr
auto
MAX_CONDITION_TYPE
=
RowPolicy
::
MAX_CONDITION_TYPE
;
/// Accumulates conditions from multiple row policies and joins them using the AND logical operation.
...
...
@@ -58,7 +58,7 @@ void RowPolicyCache::PolicyInfo::setPolicy(const RowPolicyPtr & policy_)
policy
=
policy_
;
roles
=
&
policy
->
to_roles
;
for
(
auto
type
:
ext
::
range
_with_static_cast
<
ConditionType
>
(
0
,
MAX_CONDITION_TYPE
))
for
(
auto
type
:
ext
::
range
(
0
,
MAX_CONDITION_TYPE
))
{
parsed_conditions
[
type
]
=
nullptr
;
const
String
&
condition
=
policy
->
conditions
[
type
];
...
...
src/Interpreters/InterpreterShowCreateAccessEntityQuery.cpp
浏览文件 @
6f15a0d4
...
...
@@ -166,7 +166,7 @@ namespace
if
(
policy
.
isRestrictive
())
query
->
is_restrictive
=
policy
.
isRestrictive
();
for
(
auto
index
:
ext
::
range
_with_static_cast
<
RowPolicy
::
ConditionType
>
(
RowPolicy
::
MAX_CONDITION_TYPE
))
for
(
auto
index
:
ext
::
range
(
RowPolicy
::
MAX_CONDITION_TYPE
))
{
const
auto
&
condition
=
policy
.
conditions
[
index
];
if
(
!
condition
.
empty
())
...
...
src/Interpreters/InterpreterShowQuotasQuery.cpp
浏览文件 @
6f15a0d4
...
...
@@ -30,7 +30,7 @@ String InterpreterShowQuotasQuery::getRewrittenQuery()
expr
=
"name || ' key=
\\
'' || key || '
\\
'' || if(isNull(end_of_interval), '', ' interval=[' || "
"toString(end_of_interval - duration) || ' .. ' || "
"toString(end_of_interval) || ']'"
;
for
(
auto
resource_type
:
ext
::
range
_with_static_cast
<
Quota
::
ResourceType
>
(
Quota
::
MAX_RESOURCE_TYPE
))
for
(
auto
resource_type
:
ext
::
range
(
Quota
::
MAX_RESOURCE_TYPE
))
{
String
column_name
=
Quota
::
resourceTypeToColumnName
(
resource_type
);
expr
+=
String
{
" || ' "
}
+
column_name
+
"=' || toString("
+
column_name
+
")"
;
...
...
src/Parsers/ASTCreateQuotaQuery.cpp
浏览文件 @
6f15a0d4
...
...
@@ -67,7 +67,7 @@ namespace
else
{
bool
limit_found
=
false
;
for
(
auto
resource_type
:
ext
::
range
_with_static_cast
<
ResourceType
>
(
Quota
::
MAX_RESOURCE_TYPE
))
for
(
auto
resource_type
:
ext
::
range
(
Quota
::
MAX_RESOURCE_TYPE
))
{
if
(
limits
.
max
[
resource_type
])
{
...
...
src/Parsers/ASTCreateQuotaQuery.h
浏览文件 @
6f15a0d4
...
...
@@ -42,7 +42,7 @@ public:
using
ResourceType
=
Quota
::
ResourceType
;
using
ResourceAmount
=
Quota
::
ResourceAmount
;
static
constexpr
size_t
MAX_RESOURCE_TYPE
=
Quota
::
MAX_RESOURCE_TYPE
;
static
constexpr
auto
MAX_RESOURCE_TYPE
=
Quota
::
MAX_RESOURCE_TYPE
;
struct
Limits
{
...
...
src/Parsers/ParserCreateQuotaQuery.cpp
浏览文件 @
6f15a0d4
...
...
@@ -48,7 +48,7 @@ namespace
return
false
;
const
String
&
key_type_str
=
key_type_ast
->
as
<
ASTLiteral
&>
().
value
.
safeGet
<
const
String
&>
();
for
(
auto
kt
:
ext
::
range
_with_static_cast
<
Quota
::
KeyType
>
(
Quota
::
MAX_KEY_TYPE
))
for
(
auto
kt
:
ext
::
range
(
Quota
::
KeyType
::
MAX
))
if
(
boost
::
iequals
(
Quota
::
getNameOfKeyType
(
kt
),
key_type_str
))
{
key_type
=
kt
;
...
...
@@ -56,7 +56,7 @@ namespace
}
String
all_key_types_str
;
for
(
auto
kt
:
ext
::
range
_with_static_cast
<
Quota
::
KeyType
>
(
Quota
::
MAX_KEY_TYPE
))
for
(
auto
kt
:
ext
::
range
(
Quota
::
KeyType
::
MAX
))
all_key_types_str
+=
String
(
all_key_types_str
.
empty
()
?
""
:
", "
)
+
"'"
+
Quota
::
getNameOfKeyType
(
kt
)
+
"'"
;
String
msg
=
"Quota cannot be keyed by '"
+
key_type_str
+
"'. Expected one of these literals: "
+
all_key_types_str
;
throw
Exception
(
msg
,
ErrorCodes
::
SYNTAX_ERROR
);
...
...
@@ -81,7 +81,7 @@ namespace
}
bool
resource_type_set
=
false
;
for
(
auto
rt
:
ext
::
range
_with_static_cast
<
Quota
::
ResourceType
>
(
Quota
::
MAX_RESOURCE_TYPE
))
for
(
auto
rt
:
ext
::
range
(
Quota
::
MAX_RESOURCE_TYPE
))
{
if
(
ParserKeyword
{
Quota
::
resourceTypeToKeyword
(
rt
)}.
ignore
(
pos
,
expected
))
{
...
...
src/Storages/System/StorageSystemQuotaUsage.cpp
浏览文件 @
6f15a0d4
...
...
@@ -23,7 +23,7 @@ NamesAndTypesList StorageSystemQuotaUsage::getNamesAndTypes()
{
"duration"
,
std
::
make_shared
<
DataTypeNullable
>
(
std
::
make_shared
<
DataTypeUInt64
>
())},
{
"end_of_interval"
,
std
::
make_shared
<
DataTypeNullable
>
(
std
::
make_shared
<
DataTypeDateTime
>
())}};
for
(
auto
resource_type
:
ext
::
range
_with_static_cast
<
Quota
::
ResourceType
>
(
Quota
::
MAX_RESOURCE_TYPE
))
for
(
auto
resource_type
:
ext
::
range
(
Quota
::
MAX_RESOURCE_TYPE
))
{
DataTypePtr
data_type
;
if
(
resource_type
==
Quota
::
EXECUTION_TIME
)
...
...
src/Storages/System/StorageSystemQuotas.cpp
浏览文件 @
6f15a0d4
...
...
@@ -20,7 +20,7 @@ namespace
DataTypeEnum8
::
Values
getKeyTypeEnumValues
()
{
DataTypeEnum8
::
Values
enum_values
;
for
(
auto
key_type
:
ext
::
range
_with_static_cast
<
Quota
::
KeyType
>
(
Quota
::
MAX_KEY_TYPE
))
for
(
auto
key_type
:
ext
::
range
(
Quota
::
KeyType
::
MAX
))
enum_values
.
push_back
({
Quota
::
getNameOfKeyType
(
key_type
),
static_cast
<
UInt8
>
(
key_type
)});
return
enum_values
;
}
...
...
@@ -38,7 +38,7 @@ NamesAndTypesList StorageSystemQuotas::getNamesAndTypes()
{
"intervals.duration"
,
std
::
make_shared
<
DataTypeArray
>
(
std
::
make_shared
<
DataTypeUInt64
>
())},
{
"intervals.randomize_interval"
,
std
::
make_shared
<
DataTypeArray
>
(
std
::
make_shared
<
DataTypeUInt8
>
())}};
for
(
auto
resource_type
:
ext
::
range
_with_static_cast
<
Quota
::
ResourceType
>
(
Quota
::
MAX_RESOURCE_TYPE
))
for
(
auto
resource_type
:
ext
::
range
(
Quota
::
MAX_RESOURCE_TYPE
))
{
DataTypePtr
data_type
;
if
(
resource_type
==
Quota
::
EXECUTION_TIME
)
...
...
src/Storages/System/StorageSystemRowPolicies.cpp
浏览文件 @
6f15a0d4
...
...
@@ -25,7 +25,7 @@ NamesAndTypesList StorageSystemRowPolicies::getNamesAndTypes()
{
"restrictive"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
};
for
(
auto
index
:
ext
::
range
_with_static_cast
<
RowPolicy
::
ConditionType
>
(
RowPolicy
::
MAX_CONDITION_TYPE
))
for
(
auto
index
:
ext
::
range
(
RowPolicy
::
MAX_CONDITION_TYPE
))
names_and_types
.
push_back
({
RowPolicy
::
conditionTypeToColumnName
(
index
),
std
::
make_shared
<
DataTypeString
>
()});
return
names_and_types
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录