mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
improve test and simplify code
This commit is contained in:
parent
e07a3e1193
commit
2bef2b09de
@ -118,9 +118,7 @@ bool SettingsConstraints::checkImpl(const Settings & current_settings, SettingCh
|
||||
bool cannot_cast;
|
||||
auto cast_value = [&](const Field & x) -> Field
|
||||
{
|
||||
/// `Default` can't be cast to other types, so it should be checked separately
|
||||
String setting_value;
|
||||
if (x.tryGet(setting_value) && setting_value == "DEFAULT")
|
||||
if (x.isNull())
|
||||
return {};
|
||||
cannot_cast = false;
|
||||
if (reaction == THROW_ON_VIOLATION)
|
||||
|
@ -148,8 +148,7 @@ std::vector<String> Settings::getAllRegisteredNames() const
|
||||
|
||||
void Settings::set(std::string_view name, const Field & value)
|
||||
{
|
||||
String setting_value;
|
||||
if (value.tryGet(setting_value) && setting_value == "DEFAULT") {
|
||||
if (value.isNull()) {
|
||||
resetToDefault(name);
|
||||
} else {
|
||||
BaseSettings::set(name, value);
|
||||
|
@ -110,7 +110,7 @@ bool ParserSetQuery::parseNameValuePair(SettingChange & change, IParser::Pos & p
|
||||
else if (ParserKeyword("FALSE").ignore(pos, expected))
|
||||
value = std::make_shared<ASTLiteral>(Field(static_cast<UInt64>(0)));
|
||||
else if (ParserKeyword("DEFAULT").ignore(pos, expected))
|
||||
value = std::make_shared<ASTLiteral>(Field("DEFAULT"));
|
||||
value = std::make_shared<ASTLiteral>(Field());
|
||||
else if (!value_p.parse(pos, value, expected))
|
||||
return false;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
1048545
|
||||
100000
|
||||
1
|
||||
1048545
|
||||
0
|
||||
|
@ -3,5 +3,7 @@
|
||||
SELECT value FROM system.settings where name='max_insert_block_size';
|
||||
SET max_insert_block_size=100000;
|
||||
SELECT value FROM system.settings where name='max_insert_block_size';
|
||||
SELECT changed FROM system.settings where name='max_insert_block_size';
|
||||
SET max_insert_block_size=DEFAULT;
|
||||
SELECT value FROM system.settings where name='max_insert_block_size';
|
||||
SELECT changed FROM system.settings where name='max_insert_block_size';
|
||||
|
Loading…
Reference in New Issue
Block a user