fixes for review CLICKHOUSE-3578

This commit is contained in:
chertus 2018-12-06 20:20:17 +03:00
parent 8500335ef5
commit 60dc8fcac2
7 changed files with 8 additions and 14 deletions

View File

@ -718,7 +718,7 @@ std::unique_ptr<Exception> Connection::receiveException()
std::vector<String> Connection::receiveMultistringMessage(UInt64 msg_type)
{
size_t num = Protocol::Server::wordsInMessage(msg_type);
size_t num = Protocol::Server::stringsInMessage(msg_type);
std::vector<String> out(num);
for (size_t i = 0; i < num; ++i)
readStringBinary(out[i], *in);

View File

@ -86,7 +86,7 @@ namespace Protocol
: "Unknown packet";
}
inline size_t wordsInMessage(UInt64 msg_type)
inline size_t stringsInMessage(UInt64 msg_type)
{
switch (msg_type)
{

View File

@ -118,12 +118,12 @@ void AddingDefaultsBlockInputStream::checkCalculated(const ColumnWithTypeAndName
size_t column_size = col_read.column->size();
if (column_size != col_defaults.column->size())
throw Exception("Mismach column sizes while adding defaults", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
throw Exception("Mismatch column sizes while adding defaults", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
if (column_size < defaults_needed)
throw Exception("Unexpected defaults count", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
if (col_read.type->getTypeId() != col_defaults.type->getTypeId())
if (!col_read.type->equals(*col_defaults.type))
throw Exception("Mismach column types while adding defaults", ErrorCodes::TYPE_MISMATCH);
}

View File

@ -23,7 +23,7 @@ public:
const ColumnDefaults & column_defaults_,
const Context & context_);
String getName() const override { return "AddingDefault"; }
String getName() const override { return "AddingMissed"; }
Block getHeader() const override { return header; }
private:

View File

@ -10,12 +10,11 @@
namespace DB
{
/// A way to set some extentions to read and return extra information too. IRowInputStream.extendedRead() output.
/// Contains extra information about read data.
struct RowReadExtension
{
/// IRowInputStream.extendedRead() output value.
/// Contains one bit per column in resently read row. IRowInputStream could leave it empty, or partialy set.
/// It should contain true for columns that actually read from the source and false for defaults.
/// IRowInputStream.read() output. It contains non zero for columns that actually read from the source and zero otherwise.
/// It's used to attach defaults for partially filled rows.
std::vector<UInt8> read_columns;
};

View File

@ -9,9 +9,6 @@
namespace DB
{
class Context;
class Block;
enum class ColumnDefaultKind
{
Default,

View File

@ -221,8 +221,6 @@ const ColumnsDescription * ColumnsDescription::loadFromContext(const Context & c
{
if (context.getSettingsRef().insert_sample_with_metadata)
{
auto db_and_table = context.getInsertionTable();
if (context.isTableExist(db, table))
{
StoragePtr storage = context.getTable(db, table);