2011-08-14 00:49:30 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
2011-09-04 21:23:19 +00:00
|
|
|
|
#include <DB/DataStreams/IProfilingBlockInputStream.h>
|
2011-08-14 00:49:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
2016-01-13 00:32:59 +00:00
|
|
|
|
class ExpressionActions;
|
2011-08-14 00:49:30 +00:00
|
|
|
|
|
|
|
|
|
/** Выполняет над блоком вычисление некоторого выражения.
|
|
|
|
|
* Выражение состоит из идентификаторов столбцов из блока, констант, обычных функций.
|
2015-04-16 06:12:35 +00:00
|
|
|
|
* Например: hits * 2 + 3, url LIKE '%yandex%'
|
2015-04-28 04:35:54 +00:00
|
|
|
|
* Выражение обрабатывает каждую строку независимо от других.
|
2011-08-14 00:49:30 +00:00
|
|
|
|
*/
|
2011-09-04 21:23:19 +00:00
|
|
|
|
class ExpressionBlockInputStream : public IProfilingBlockInputStream
|
2011-08-14 00:49:30 +00:00
|
|
|
|
{
|
2016-01-13 00:32:59 +00:00
|
|
|
|
private:
|
|
|
|
|
using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>;
|
2013-05-03 10:20:53 +00:00
|
|
|
|
|
2016-01-13 00:32:59 +00:00
|
|
|
|
public:
|
|
|
|
|
ExpressionBlockInputStream(BlockInputStreamPtr input_, ExpressionActionsPtr expression_);
|
2013-09-08 08:27:06 +00:00
|
|
|
|
|
2016-01-13 00:32:59 +00:00
|
|
|
|
String getName() const override;
|
|
|
|
|
String getID() const override;
|
|
|
|
|
const Block & getTotals() override;
|
2013-09-08 08:27:06 +00:00
|
|
|
|
|
2012-10-20 02:10:47 +00:00
|
|
|
|
protected:
|
2016-01-13 00:32:59 +00:00
|
|
|
|
Block readImpl() override;
|
2011-08-14 00:49:30 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2013-06-03 10:18:41 +00:00
|
|
|
|
ExpressionActionsPtr expression;
|
2011-08-14 00:49:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|