mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Add type column into system.settings/merge_tree_settings
This can be useful for various drivers to know the type.
This commit is contained in:
parent
3c98bfeeea
commit
2090925270
@ -345,6 +345,7 @@ private:
|
||||
|
||||
StringRef name;
|
||||
StringRef description;
|
||||
StringRef type;
|
||||
bool is_important;
|
||||
IsChangedFunction is_changed;
|
||||
GetStringFunction get_string;
|
||||
@ -391,6 +392,7 @@ public:
|
||||
const_reference(const const_reference & src) = default;
|
||||
const StringRef & getName() const { return member->name; }
|
||||
const StringRef & getDescription() const { return member->description; }
|
||||
const StringRef & getType() const { return member->type; }
|
||||
bool isChanged() const { return member->is_changed(*collection); }
|
||||
Field getValue() const;
|
||||
String getValueAsString() const { return member->get_string(*collection); }
|
||||
|
@ -323,7 +323,9 @@ void SettingsCollection<Derived>::deserialize(ReadBuffer & buf, SettingsBinaryFo
|
||||
|
||||
|
||||
#define IMPLEMENT_SETTINGS_COLLECTION_ADD_MEMBER_INFO_HELPER_(TYPE, NAME, DEFAULT, DESCRIPTION, FLAGS) \
|
||||
add({StringRef(#NAME, strlen(#NAME)), StringRef(DESCRIPTION, strlen(DESCRIPTION)), \
|
||||
add({StringRef(#NAME, strlen(#NAME)), \
|
||||
StringRef(DESCRIPTION, strlen(DESCRIPTION)), \
|
||||
StringRef(#TYPE, strlen(#TYPE)), \
|
||||
FLAGS & IMPORTANT, \
|
||||
[](const Derived & d) { return d.NAME.changed; }, \
|
||||
&Functions::NAME##_getString, &Functions::NAME##_getField, \
|
||||
|
@ -14,6 +14,7 @@ NamesAndTypesList SystemMergeTreeSettings::getNamesAndTypes()
|
||||
{"value", std::make_shared<DataTypeString>()},
|
||||
{"changed", std::make_shared<DataTypeUInt8>()},
|
||||
{"description", std::make_shared<DataTypeString>()},
|
||||
{"type", std::make_shared<DataTypeString>()},
|
||||
};
|
||||
}
|
||||
|
||||
@ -25,6 +26,7 @@ void SystemMergeTreeSettings::fillData(MutableColumns & res_columns, const Conte
|
||||
res_columns[1]->insert(setting.getValueAsString());
|
||||
res_columns[2]->insert(setting.isChanged());
|
||||
res_columns[3]->insert(setting.getDescription().toString());
|
||||
res_columns[4]->insert(setting.getType().toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,8 @@ NamesAndTypesList StorageSystemSettings::getNamesAndTypes()
|
||||
{"description", std::make_shared<DataTypeString>()},
|
||||
{"min", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>())},
|
||||
{"max", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>())},
|
||||
{"readonly", std::make_shared<DataTypeUInt8>()}
|
||||
{"readonly", std::make_shared<DataTypeUInt8>()},
|
||||
{"type", std::make_shared<DataTypeString>()},
|
||||
};
|
||||
}
|
||||
|
||||
@ -59,6 +60,7 @@ void StorageSystemSettings::fillData(MutableColumns & res_columns, const Context
|
||||
res_columns[4]->insert(min);
|
||||
res_columns[5]->insert(max);
|
||||
res_columns[6]->insert(read_only);
|
||||
res_columns[7]->insert(setting.getType().toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -841,25 +841,42 @@ Columns:
|
||||
|
||||
- `name` (String) — Setting name.
|
||||
- `value` (String) — Setting value.
|
||||
- `description` (String) — Setting description.
|
||||
- `type` (String) — Setting type.
|
||||
- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed.
|
||||
- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [constraints](settings/constraints_on_settings.md#constraints-on-settings)).
|
||||
- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [constraints](settings/constraints_on_settings.md#constraints-on-settings)).
|
||||
- `readonly` (UInt8) — Can user change this setting (for more info, look into [constraints](settings/constraints_on_settings.md#constraints-on-settings)).
|
||||
|
||||
Example:
|
||||
|
||||
``` sql
|
||||
SELECT *
|
||||
SELECT name, value
|
||||
FROM system.settings
|
||||
WHERE changed
|
||||
```
|
||||
|
||||
``` text
|
||||
┌─name───────────────────┬─value───────┬─changed─┐
|
||||
│ max_threads │ 8 │ 1 │
|
||||
│ use_uncompressed_cache │ 0 │ 1 │
|
||||
│ load_balancing │ random │ 1 │
|
||||
│ max_memory_usage │ 10000000000 │ 1 │
|
||||
└────────────────────────┴─────────────┴─────────┘
|
||||
┌─name───────────────────┬─value───────┐
|
||||
│ max_threads │ 8 │
|
||||
│ use_uncompressed_cache │ 0 │
|
||||
│ load_balancing │ random │
|
||||
│ max_memory_usage │ 10000000000 │
|
||||
└────────────────────────┴─────────────┘
|
||||
```
|
||||
|
||||
## system.merge\_tree\_settings {#system-merge_tree_settings}
|
||||
|
||||
Contains information about settings for `MergeTree` tables.
|
||||
|
||||
Columns:
|
||||
|
||||
- `name` (String) — Setting name.
|
||||
- `value` (String) — Setting value.
|
||||
- `description` (String) — Setting description.
|
||||
- `type` (String) — Setting type.
|
||||
- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed.
|
||||
|
||||
## system.table\_engines {#system-table-engines}
|
||||
|
||||
Contains description of table engines supported by server and their feature support information.
|
||||
|
Loading…
Reference in New Issue
Block a user