Merge pull request #44342 from ClickHouse/add-test-29883

Add a test for #29883
This commit is contained in:
Alexey Milovidov 2022-12-27 14:55:14 +03:00 committed by GitHub
commit 1b21cc018e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 3 deletions

View File

@ -0,0 +1 @@
../../../tests/config/config.d/graphite.xml

View File

@ -332,8 +332,7 @@ std::string buildTaggedRegex(std::string regexp_str)
* </default>
* </graphite_rollup>
*/
static const Pattern &
appendGraphitePattern(
static const Pattern & appendGraphitePattern(
const Poco::Util::AbstractConfiguration & config,
const String & config_element, Patterns & patterns,
bool default_rule,

View File

@ -9,6 +9,12 @@
namespace DB
{
namespace ErrorCodes
{
extern const int BAD_ARGUMENTS;
}
static GraphiteRollupSortedAlgorithm::ColumnsDefinition defineColumns(
const Block & header, const Graphite::Params & params)
{
@ -26,6 +32,9 @@ static GraphiteRollupSortedAlgorithm::ColumnsDefinition defineColumns(
if (i != def.time_column_num && i != def.value_column_num && i != def.version_column_num)
def.unmodified_column_numbers.push_back(i);
if (!WhichDataType(header.getByPosition(def.value_column_num).type).isFloat64())
throw Exception("Only `Float64` data type is allowed for the value column of GraphiteMergeTree", ErrorCodes::BAD_ARGUMENTS);
return def;
}

View File

@ -476,7 +476,7 @@ static StoragePtr create(const StorageFactory::Arguments & args)
{
String graphite_config_name;
String error_msg
= "Last parameter of GraphiteMergeTree must be name (in single quotes) of element in configuration file with Graphite options";
= "Last parameter of GraphiteMergeTree must be the name (in single quotes) of the element in configuration file with the Graphite options";
error_msg += getMergeTreeVerboseHelp(is_extended_storage_def);
if (const auto * ast = engine_args[arg_cnt - 1]->as<ASTLiteral>())

View File

@ -0,0 +1,6 @@
DROP TABLE IF EXISTS test_graphite;
create table test_graphite (key UInt32, Path String, Time DateTime('UTC'), Value UInt8, Version UInt32, col UInt64)
engine = GraphiteMergeTree('graphite_rollup') order by key;
INSERT INTO test_graphite (key) VALUES (0); -- { serverError BAD_ARGUMENTS }
DROP TABLE test_graphite;