2012-08-23 18:05:31 +00:00
# pragma once
2013-05-08 09:52:02 +00:00
# include <DB/Columns/IColumnDummy.h>
2012-08-23 18:05:31 +00:00
namespace DB
{
2017-01-14 09:00:19 +00:00
class Set ;
using ConstSetPtr = std : : shared_ptr < const Set > ;
2017-03-09 04:18:41 +00:00
/** A column containing multiple values in the `IN` section.
2017-03-09 00:56:38 +00:00
* Behaves like a constant - column ( because the set is one , not its own for each line ) .
* This column has a nonstandard value , so it can not be obtained via a normal interface .
2012-08-23 18:05:31 +00:00
*/
2014-06-04 01:00:09 +00:00
class ColumnSet final : public IColumnDummy
2012-08-23 18:05:31 +00:00
{
public :
2015-11-02 19:19:29 +00:00
ColumnSet ( size_t s_ , ConstSetPtr data_ ) : IColumnDummy ( s_ ) , data ( data_ ) { }
2012-08-23 18:05:31 +00:00
2017-03-09 04:26:17 +00:00
/// The column is not a constant. Otherwise, the column will be used in calculations in ExpressionActions::prepare, when a set from subquery is not ready yet.
2014-10-31 22:15:17 +00:00
bool isConst ( ) const override { return false ; }
std : : string getName ( ) const override { return " ColumnSet " ; }
2016-05-28 05:31:36 +00:00
ColumnPtr cloneDummy ( size_t s_ ) const override { return std : : make_shared < ColumnSet > ( s_ , data ) ; }
2014-03-12 18:20:03 +00:00
2015-11-02 19:19:29 +00:00
ConstSetPtr getData ( ) const { return data ; }
2012-08-23 18:05:31 +00:00
private :
2015-11-02 19:19:29 +00:00
ConstSetPtr data ;
2012-08-23 18:05:31 +00:00
} ;
}