mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Start writing tests
This commit is contained in:
parent
3925a3bd13
commit
c880e00ffa
@ -57,10 +57,11 @@ CheckResults FileChecker::check() const
|
||||
|
||||
for (const auto & name_size : local_map)
|
||||
{
|
||||
Poco::File file(Poco::Path(files_info_path).parent().toString() + "/" + name_size.first);
|
||||
Poco::Path path = Poco::Path(files_info_path).parent().toString() + "/" + name_size.first;
|
||||
Poco::File file(path);
|
||||
if (!file.exists())
|
||||
{
|
||||
results.emplace_back(file.path(), false, "File " + file.path() + " doesn't exist");
|
||||
results.emplace_back(path.getFileName(), false, "File " + file.path() + " doesn't exist");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -68,10 +69,10 @@ CheckResults FileChecker::check() const
|
||||
size_t real_size = file.getSize();
|
||||
if (real_size != name_size.second)
|
||||
{
|
||||
results.emplace_back(file.path(), false, "Size of " + file.path() + " is wrong. Size is " + toString(real_size) + " but should be " + toString(name_size.second));
|
||||
results.emplace_back(path.getFileName(), false, "Size of " + file.path() + " is wrong. Size is " + toString(real_size) + " but should be " + toString(name_size.second));
|
||||
break;
|
||||
}
|
||||
results.emplace_back(file.path(), true, "");
|
||||
results.emplace_back(path.getFileName(), true, "");
|
||||
}
|
||||
|
||||
return results;
|
||||
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <Parsers/ASTQueryWithTableAndOutput.h>
|
||||
#include <Parsers/ASTPartition.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -22,7 +24,7 @@ struct ASTCheckQuery : public ASTQueryWithTableAndOutput
|
||||
}
|
||||
|
||||
protected:
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked frame) const override
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
|
||||
{
|
||||
std::string nl_or_nothing = settings.one_line ? "" : "\n";
|
||||
|
||||
@ -40,6 +42,12 @@ protected:
|
||||
}
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << indent_str << backQuoteIfNeed(table) << (settings.hilite ? hilite_none : "");
|
||||
}
|
||||
|
||||
if (partition)
|
||||
{
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << indent_str << " PARTITION " << (settings.hilite ? hilite_none : "");
|
||||
partition->formatImpl(settings, state, frame);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include <Parsers/ExpressionElementParsers.h>
|
||||
#include <Parsers/ASTCheckQuery.h>
|
||||
#include <Parsers/ParserPartition.h>
|
||||
#include <iostream>
|
||||
#include <common/StringRef.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
|
@ -13,6 +13,9 @@
|
||||
#include <Parsers/ParserOptimizeQuery.h>
|
||||
#include <Parsers/ParserSetQuery.h>
|
||||
#include <Parsers/ASTExplainQuery.h>
|
||||
#include <iostream>
|
||||
#include <common/StringRef.h>
|
||||
|
||||
|
||||
|
||||
namespace DB
|
||||
|
@ -10,16 +10,17 @@ try
|
||||
{
|
||||
using namespace DB;
|
||||
|
||||
std::string input =
|
||||
" SELECT 18446744073709551615, f(1), '\\\\', [a, b, c], (a, b, c), 1 + 2 * -3, a = b OR c > d.1 + 2 * -g[0] AND NOT e < f * (x + y)"
|
||||
" FROM default.hits"
|
||||
" WHERE CounterID = 101500 AND UniqID % 3 = 0"
|
||||
" GROUP BY UniqID"
|
||||
" HAVING SUM(Refresh) > 100"
|
||||
" ORDER BY Visits, PageViews"
|
||||
" LIMIT LENGTH('STRING OF 20 SYMBOLS') - 20 + 1000, 10.05 / 5.025 * 5"
|
||||
" INTO OUTFILE 'test.out'"
|
||||
" FORMAT TabSeparated";
|
||||
//std::string input =
|
||||
// " SELECT 18446744073709551615, f(1), '\\\\', [a, b, c], (a, b, c), 1 + 2 * -3, a = b OR c > d.1 + 2 * -g[0] AND NOT e < f * (x + y)"
|
||||
// " FROM default.hits"
|
||||
// " WHERE CounterID = 101500 AND UniqID % 3 = 0"
|
||||
// " GROUP BY UniqID"
|
||||
// " HAVING SUM(Refresh) > 100"
|
||||
// " ORDER BY Visits, PageViews"
|
||||
// " LIMIT LENGTH('STRING OF 20 SYMBOLS') - 20 + 1000, 10.05 / 5.025 * 5"
|
||||
// " INTO OUTFILE 'test.out'"
|
||||
// " FORMAT TabSeparated";
|
||||
std::string input = "CHECK TABLE txxx PARTITION 201910";
|
||||
|
||||
ParserQueryWithOutput parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
@ -1,3 +1,4 @@
|
||||
<yandex>
|
||||
<insert_format_max_block_size>100000</insert_format_max_block_size>
|
||||
</yandex>
|
||||
HELLO
|
||||
|
Loading…
Reference in New Issue
Block a user