Skip to content

Commit

Permalink
Formats: better modularity (development) #2447
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-milovidov committed Jun 9, 2018
1 parent c4e6434 commit e3a445a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
10 changes: 3 additions & 7 deletions dbms/src/DataStreams/tests/expression_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#include <DataStreams/LimitBlockInputStream.h>
#include <DataStreams/ExpressionBlockInputStream.h>
#include <DataStreams/TabSeparatedRowOutputStream.h>
#include <DataStreams/BlockOutputStreamFromRowOutputStream.h>
#include <Formats/FormatFactory.h>
#include <DataStreams/copyData.h>

#include <DataTypes/DataTypesNumber.h>
Expand Down Expand Up @@ -55,17 +54,14 @@ try
in = std::make_shared<ExpressionBlockInputStream>(in, expression);
in = std::make_shared<LimitBlockInputStream>(in, 10, std::max(static_cast<Int64>(0), static_cast<Int64>(n) - 10));

FormatSettings format_settings;

WriteBufferFromOStream out1(std::cout);
RowOutputStreamPtr out2 = std::make_shared<TabSeparatedRowOutputStream>(out1, expression->getSampleBlock(), false, false, format_settings);
BlockOutputStreamFromRowOutputStream out(out2, expression->getSampleBlock());
BlockOutputStreamPtr out = FormatFactory::instance().getOutput("TabSeparated", out1, expression->getSampleBlock(), context);

{
Stopwatch stopwatch;
stopwatch.start();

copyData(*in, out);
copyData(*in, *out);

stopwatch.stop();
std::cout << std::fixed << std::setprecision(2)
Expand Down
5 changes: 2 additions & 3 deletions dbms/src/Interpreters/tests/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ int main(int argc, char ** argv)
auto is = std::make_shared<OneBlockInputStream>(block);
LimitBlockInputStream lis(is, 20, std::max(0, static_cast<int>(n) - 20));
WriteBufferFromOStream out_buf(std::cout);
RowOutputStreamPtr os_ = std::make_shared<TabSeparatedRowOutputStream>(out_buf, block, false, false, FormatSettings());
BlockOutputStreamFromRowOutputStream os(os_, is->getHeader());
BlockOutputStreamPtr out = FormatFactory::instance().getOutput("TabSeparated", out_buf, block, context);

copyData(lis, os);
copyData(lis, *out);
}
catch (const Exception & e)
{
Expand Down
5 changes: 2 additions & 3 deletions dbms/src/Storages/tests/system_numbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ try
QueryProcessingStage::Enum stage;

LimitBlockInputStream input(table->read(column_names, {}, Context::createGlobal(), stage, 10, 1)[0], 10, 96);
RowOutputStreamPtr output_ = std::make_shared<TabSeparatedRowOutputStream>(out_buf, sample, false, false, FormatSettings());
BlockOutputStreamFromRowOutputStream output(output_, sample);
BlockOutputStreamPtr out = FormatFactory::instance().getOutput("TabSeparated", out_buf, sample, context);

copyData(input, output);
copyData(input, *out);

return 0;
}
Expand Down

0 comments on commit e3a445a

Please sign in to comment.