mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
dbms: development.
This commit is contained in:
parent
6ef3ffc267
commit
fb5ca4d182
@ -6,7 +6,6 @@
|
||||
|
||||
#include <DB/DataTypes/IDataTypeNumber.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -50,7 +49,7 @@ public:
|
||||
typename ColumnType::Container_t & x = dynamic_cast<ColumnType &>(column).getData();
|
||||
x.resize(limit);
|
||||
istr.read(reinterpret_cast<char*>(&x[0]), sizeof(typename ColumnType::value_type) * limit);
|
||||
x.resize(istr.gcount());
|
||||
x.resize(istr.gcount() / sizeof(typename ColumnType::value_type));
|
||||
}
|
||||
|
||||
SharedPtr<IColumn> createColumn() const
|
||||
|
@ -110,7 +110,7 @@ size_t Block::rows() const
|
||||
if (size == 0)
|
||||
throw Exception("Empty column in block.", ErrorCodes::EMPTY_COLUMN_IN_BLOCK);
|
||||
|
||||
if (size != 1 && res != 0 && size != res)
|
||||
if (res != 0 && size != res)
|
||||
throw Exception("Sizes of columns doesn't match.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||||
|
||||
res = size;
|
||||
|
@ -28,7 +28,8 @@ Block LogBlockInputStream::read()
|
||||
throw Exception("There is no column with name " + *it + " in table.",
|
||||
ErrorCodes::NO_SUCH_COLUMN_IN_TABLE);
|
||||
|
||||
streams.insert(std::make_pair(*it, new Poco::FileInputStream(storage.files[*it].path())));
|
||||
streams.insert(std::make_pair(*it,
|
||||
new Poco::FileInputStream(storage.files[*it].path(), std::ios::in | std::ios::binary)));
|
||||
}
|
||||
|
||||
for (ColumnNames::const_iterator it = column_names.begin(); it != column_names.end(); ++it)
|
||||
@ -61,7 +62,8 @@ void LogBlockOutputStream::write(const Block & block)
|
||||
throw Exception("There is no column with name " + name + " in table.",
|
||||
ErrorCodes::NO_SUCH_COLUMN_IN_TABLE);
|
||||
|
||||
streams.insert(std::make_pair(name, new Poco::FileOutputStream(storage.files[name].path())));
|
||||
streams.insert(std::make_pair(name,
|
||||
new Poco::FileOutputStream(storage.files[name].path(), std::ios::out | std::ios::ate | std::ios::binary)));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < block.columns(); ++i)
|
||||
|
@ -34,8 +34,9 @@ int main(int argc, char ** argv)
|
||||
column1.name = "a";
|
||||
column1.type = (*names_and_types)["a"];
|
||||
column1.column = column1.type->createColumn();
|
||||
DB::ColumnUInt64::Container_t vec1 = dynamic_cast<DB::ColumnUInt64&>(*column1.column).getData();
|
||||
DB::ColumnUInt64::Container_t & vec1 = dynamic_cast<DB::ColumnUInt64&>(*column1.column).getData();
|
||||
|
||||
vec1.resize(rows);
|
||||
for (size_t i = 0; i < rows; ++i)
|
||||
vec1[i] = i;
|
||||
|
||||
@ -45,8 +46,9 @@ int main(int argc, char ** argv)
|
||||
column2.name = "b";
|
||||
column2.type = (*names_and_types)["b"];
|
||||
column2.column = column2.type->createColumn();
|
||||
DB::ColumnUInt8::Container_t vec2 = dynamic_cast<DB::ColumnUInt8&>(*column2.column).getData();
|
||||
DB::ColumnUInt8::Container_t & vec2 = dynamic_cast<DB::ColumnUInt8&>(*column2.column).getData();
|
||||
|
||||
vec2.resize(rows);
|
||||
for (size_t i = 0; i < rows; ++i)
|
||||
vec2[i] = i;
|
||||
|
||||
@ -68,7 +70,7 @@ int main(int argc, char ** argv)
|
||||
data_types->push_back(new DB::DataTypeUInt64);
|
||||
data_types->push_back(new DB::DataTypeUInt8);
|
||||
|
||||
DB::LimitBlockInputStream in_limit(in, 10);
|
||||
DB::LimitBlockInputStream in_limit(in, 1000000);
|
||||
DB::TabSeparatedRowOutputStream output(std::cout, data_types);
|
||||
|
||||
DB::copyData(in_limit, output);
|
||||
|
Loading…
Reference in New Issue
Block a user