Removing refreshes [#METR-11408].

This commit is contained in:
Alexey Milovidov 2014-07-01 03:46:22 +04:00
parent 310df87971
commit cbab5fb193
6 changed files with 15 additions and 21 deletions

View File

@ -45,7 +45,6 @@ int main(int argc, char ** argv)
("UserAgent", new DB::DataTypeUInt8) ("UserAgent", new DB::DataTypeUInt8)
("URL", new DB::DataTypeString) ("URL", new DB::DataTypeString)
("Referer", new DB::DataTypeString) ("Referer", new DB::DataTypeString)
("Refresh", new DB::DataTypeUInt8)
("ResolutionWidth", new DB::DataTypeUInt16) ("ResolutionWidth", new DB::DataTypeUInt16)
("ResolutionHeight", new DB::DataTypeUInt16) ("ResolutionHeight", new DB::DataTypeUInt16)
("ResolutionDepth", new DB::DataTypeUInt8) ("ResolutionDepth", new DB::DataTypeUInt8)
@ -77,7 +76,7 @@ int main(int argc, char ** argv)
("SilverlightVersion3", new DB::DataTypeUInt32) ("SilverlightVersion3", new DB::DataTypeUInt32)
("SilverlightVersion4", new DB::DataTypeUInt16) ("SilverlightVersion4", new DB::DataTypeUInt16)
("PageCharset", new DB::DataTypeString) ("PageCharset", new DB::DataTypeString)
("CodeVersion", new DB::DataTypeUInt32) ("CodeVersion", new DB::DataTypeUInt32)
("IsLink", new DB::DataTypeUInt8) ("IsLink", new DB::DataTypeUInt8)
("IsDownload", new DB::DataTypeUInt8) ("IsDownload", new DB::DataTypeUInt8)
("IsNotBounce", new DB::DataTypeUInt8) ("IsNotBounce", new DB::DataTypeUInt8)
@ -107,12 +106,12 @@ int main(int argc, char ** argv)
elem.column = elem.type->createColumn(); elem.column = elem.type->createColumn();
sample.insert(elem); sample.insert(elem);
} }
/// читаем данные из строчного tsv файла и одновременно пишем в блочный tsv файл /// читаем данные из строчного tsv файла и одновременно пишем в блочный tsv файл
{ {
DB::ReadBufferFromIStream in_buf(std::cin); DB::ReadBufferFromIStream in_buf(std::cin);
DB::WriteBufferFromOStream out_buf(std::cout); DB::WriteBufferFromOStream out_buf(std::cout);
DB::RowInputStreamPtr row_in = new DB::TabSeparatedRowInputStream(in_buf, sample); DB::RowInputStreamPtr row_in = new DB::TabSeparatedRowInputStream(in_buf, sample);
DB::BlockInputStreamFromRowInputStream in(row_in, sample); DB::BlockInputStreamFromRowInputStream in(row_in, sample);
DB::TabSeparatedBlockOutputStream out(out_buf); DB::TabSeparatedBlockOutputStream out(out_buf);

View File

@ -34,7 +34,7 @@ using Poco::SharedPtr;
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
using namespace DB; using namespace DB;
try try
{ {
NamesAndTypesListPtr names_and_types_list = new NamesAndTypesList; NamesAndTypesListPtr names_and_types_list = new NamesAndTypesList;
@ -53,7 +53,6 @@ int main(int argc, char ** argv)
("UserAgent", new DataTypeUInt8) ("UserAgent", new DataTypeUInt8)
("URL", new DataTypeString) ("URL", new DataTypeString)
("Referer", new DataTypeString) ("Referer", new DataTypeString)
("Refresh", new DataTypeUInt8)
("ResolutionWidth", new DataTypeUInt16) ("ResolutionWidth", new DataTypeUInt16)
("ResolutionHeight", new DataTypeUInt16) ("ResolutionHeight", new DataTypeUInt16)
("ResolutionDepth", new DataTypeUInt8) ("ResolutionDepth", new DataTypeUInt8)
@ -150,7 +149,7 @@ int main(int argc, char ** argv)
in = new ExpressionBlockInputStream(in, expression); in = new ExpressionBlockInputStream(in, expression);
in = new FilterBlockInputStream(in, 4); in = new FilterBlockInputStream(in, 4);
//in = new LimitBlockInputStream(in, 10); //in = new LimitBlockInputStream(in, 10);
WriteBufferFromOStream ob(std::cout); WriteBufferFromOStream ob(std::cout);
RowOutputStreamPtr out_ = new TabSeparatedRowOutputStream(ob, expression->getSampleBlock()); RowOutputStreamPtr out_ = new TabSeparatedRowOutputStream(ob, expression->getSampleBlock());
BlockOutputStreamFromRowOutputStream out(out_); BlockOutputStreamFromRowOutputStream out(out_);

View File

@ -27,7 +27,7 @@
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
using Poco::SharedPtr; using Poco::SharedPtr;
try try
{ {
DB::NamesAndTypesListPtr names_and_types_list = new DB::NamesAndTypesList; DB::NamesAndTypesListPtr names_and_types_list = new DB::NamesAndTypesList;
@ -46,7 +46,6 @@ int main(int argc, char ** argv)
("UserAgent", new DB::DataTypeUInt8) ("UserAgent", new DB::DataTypeUInt8)
("URL", new DB::DataTypeString) ("URL", new DB::DataTypeString)
("Referer", new DB::DataTypeString) ("Referer", new DB::DataTypeString)
("Refresh", new DB::DataTypeUInt8)
("ResolutionWidth", new DB::DataTypeUInt16) ("ResolutionWidth", new DB::DataTypeUInt16)
("ResolutionHeight", new DB::DataTypeUInt16) ("ResolutionHeight", new DB::DataTypeUInt16)
("ResolutionDepth", new DB::DataTypeUInt8) ("ResolutionDepth", new DB::DataTypeUInt8)
@ -116,7 +115,7 @@ int main(int argc, char ** argv)
if (argc == 2 && 0 == strcmp(argv[1], "write")) if (argc == 2 && 0 == strcmp(argv[1], "write"))
{ {
DB::DataTypeFactory factory; DB::DataTypeFactory factory;
DB::ReadBufferFromIStream in1(std::cin); DB::ReadBufferFromIStream in1(std::cin);
DB::CompressedReadBuffer in2(in1); DB::CompressedReadBuffer in2(in1);
DB::NativeBlockInputStream in3(in2, factory); DB::NativeBlockInputStream in3(in2, factory);

View File

@ -34,7 +34,7 @@ using Poco::SharedPtr;
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
using namespace DB; using namespace DB;
try try
{ {
NamesAndTypesListPtr names_and_types_list = new NamesAndTypesList; NamesAndTypesListPtr names_and_types_list = new NamesAndTypesList;
@ -53,7 +53,6 @@ int main(int argc, char ** argv)
("UserAgent", new DataTypeUInt8) ("UserAgent", new DataTypeUInt8)
("URL", new DataTypeString) ("URL", new DataTypeString)
("Referer", new DataTypeString) ("Referer", new DataTypeString)
("Refresh", new DataTypeUInt8)
("ResolutionWidth", new DataTypeUInt16) ("ResolutionWidth", new DataTypeUInt16)
("ResolutionHeight", new DataTypeUInt16) ("ResolutionHeight", new DataTypeUInt16)
("ResolutionDepth", new DataTypeUInt8) ("ResolutionDepth", new DataTypeUInt8)
@ -162,7 +161,7 @@ int main(int argc, char ** argv)
sort_columns.push_back(SortColumnDescription(3, 1)); sort_columns.push_back(SortColumnDescription(3, 1));
QueryProcessingStage::Enum stage; QueryProcessingStage::Enum stage;
Poco::SharedPtr<IBlockInputStream> in = table->read(column_names, 0, Settings(), stage, argc == 2 ? atoi(argv[1]) : 1048576)[0]; Poco::SharedPtr<IBlockInputStream> in = table->read(column_names, 0, Settings(), stage, argc == 2 ? atoi(argv[1]) : 1048576)[0];
in = new PartialSortingBlockInputStream(in, sort_columns); in = new PartialSortingBlockInputStream(in, sort_columns);
in = new MergeSortingBlockInputStream(in, sort_columns); in = new MergeSortingBlockInputStream(in, sort_columns);

View File

@ -10,7 +10,7 @@
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
using namespace DB; using namespace DB;
try try
{ {
ParserCreateQuery parser; ParserCreateQuery parser;
@ -29,7 +29,6 @@ int main(int argc, char ** argv)
"UserAgent UInt8,\n" "UserAgent UInt8,\n"
"URL String,\n" "URL String,\n"
"Referer String,\n" "Referer String,\n"
"Refresh UInt8,\n"
"ResolutionWidth UInt16,\n" "ResolutionWidth UInt16,\n"
"ResolutionHeight UInt16,\n" "ResolutionHeight UInt16,\n"
"ResolutionDepth UInt8,\n" "ResolutionDepth UInt8,\n"

View File

@ -46,7 +46,6 @@ int main(int argc, char ** argv)
("UserAgent", new DB::DataTypeUInt8) ("UserAgent", new DB::DataTypeUInt8)
("URL", new DB::DataTypeString) ("URL", new DB::DataTypeString)
("Referer", new DB::DataTypeString) ("Referer", new DB::DataTypeString)
("Refresh", new DB::DataTypeUInt8)
("ResolutionWidth", new DB::DataTypeUInt16) ("ResolutionWidth", new DB::DataTypeUInt16)
("ResolutionHeight", new DB::DataTypeUInt16) ("ResolutionHeight", new DB::DataTypeUInt16)
("ResolutionDepth", new DB::DataTypeUInt8) ("ResolutionDepth", new DB::DataTypeUInt8)
@ -78,7 +77,7 @@ int main(int argc, char ** argv)
("SilverlightVersion3", new DB::DataTypeUInt32) ("SilverlightVersion3", new DB::DataTypeUInt32)
("SilverlightVersion4", new DB::DataTypeUInt16) ("SilverlightVersion4", new DB::DataTypeUInt16)
("PageCharset", new DB::DataTypeString) ("PageCharset", new DB::DataTypeString)
("CodeVersion", new DB::DataTypeUInt32) ("CodeVersion", new DB::DataTypeUInt32)
("IsLink", new DB::DataTypeUInt8) ("IsLink", new DB::DataTypeUInt8)
("IsDownload", new DB::DataTypeUInt8) ("IsDownload", new DB::DataTypeUInt8)
("IsNotBounce", new DB::DataTypeUInt8) ("IsNotBounce", new DB::DataTypeUInt8)
@ -94,7 +93,7 @@ int main(int argc, char ** argv)
SharedPtr<DB::DataTypes> data_types = new DB::DataTypes; SharedPtr<DB::DataTypes> data_types = new DB::DataTypes;
DB::Names column_names; DB::Names column_names;
for (DB::NamesAndTypesList::const_iterator it = names_and_types_list->begin(); it != names_and_types_list->end(); ++it) for (DB::NamesAndTypesList::const_iterator it = names_and_types_list->begin(); it != names_and_types_list->end(); ++it)
{ {
data_types->push_back(it->second); data_types->push_back(it->second);
@ -102,7 +101,7 @@ int main(int argc, char ** argv)
} }
/// создаём таблицу хит лога /// создаём таблицу хит лога
DB::StoragePtr table = DB::StorageLog::create("./", "HitLog", names_and_types_list); DB::StoragePtr table = DB::StorageLog::create("./", "HitLog", names_and_types_list);
/// создаём описание, как читать данные из tab separated дампа /// создаём описание, как читать данные из tab separated дампа
@ -116,12 +115,12 @@ int main(int argc, char ** argv)
elem.column = elem.type->createColumn(); elem.column = elem.type->createColumn();
sample.insert(elem); sample.insert(elem);
} }
/// читаем данные из tsv файла и одновременно пишем в таблицу /// читаем данные из tsv файла и одновременно пишем в таблицу
if (argc == 2 && 0 == strcmp(argv[1], "write")) if (argc == 2 && 0 == strcmp(argv[1], "write"))
{ {
DB::ReadBufferFromIStream in_buf(std::cin); DB::ReadBufferFromIStream in_buf(std::cin);
DB::RowInputStreamPtr in_ = new DB::TabSeparatedRowInputStream(in_buf, sample); DB::RowInputStreamPtr in_ = new DB::TabSeparatedRowInputStream(in_buf, sample);
DB::BlockInputStreamFromRowInputStream in(in_, sample); DB::BlockInputStreamFromRowInputStream in(in_, sample);
DB::BlockOutputStreamPtr out = table->write(0); DB::BlockOutputStreamPtr out = table->write(0);