2012-08-23 18:05:31 +00:00
# pragma once
2017-04-01 09:19:00 +00:00
# include <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 :
2017-09-08 03:47:27 +00:00
ColumnSet ( size_t s_ , const ConstSetPtr & data_ ) : IColumnDummy ( s_ ) , data ( data_ ) { }
2012-08-23 18:05:31 +00:00
2017-04-01 07:20:54 +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.
bool isConst ( ) const override { return false ; }
2014-10-31 22:15:17 +00:00
2017-04-01 07:20:54 +00:00
std : : string getName ( ) const override { return " ColumnSet " ; }
ColumnPtr cloneDummy ( size_t s_ ) const override { return std : : make_shared < ColumnSet > ( s_ , data ) ; }
2014-03-12 18:20:03 +00:00
2017-04-01 07:20:54 +00:00
ConstSetPtr getData ( ) const { return data ; }
2012-08-23 18:05:31 +00:00
private :
2017-04-01 07:20:54 +00:00
ConstSetPtr data ;
2012-08-23 18:05:31 +00:00
} ;
}