29 namespace CUDF_EXPORT
cudf {
39 class expression_parser;
40 class expression_transformer;
64 virtual std::reference_wrapper<expression const>
accept(
65 detail::expression_transformer& visitor)
const = 0;
76 return may_evaluate_null(left, left, stream);
116 template <
typename T>
117 __device__ T
const value() const noexcept
119 if constexpr (std::is_same_v<T, cudf::string_view>) {
120 return string_view(
static_cast<char const*
>(_data), _size);
122 return *
static_cast<T const*
>(_data);
129 template <
typename T>
139 template <
typename T>
149 template <
typename T>
177 :
cudf::detail::scalar_device_view_base(type,
is_valid), _data(data)
190 :
cudf::detail::scalar_device_view_base(type,
is_valid), _data(data), _size(size)
206 template <
typename T>
217 template <
typename T>
228 template <
typename T>
269 std::reference_wrapper<expression const>
accept(
270 detail::expression_transformer& visitor)
const override;
309 : column_index(column_index), table_source(table_source)
335 return table.column(get_column_index()).type();
348 auto const table = [&] {
349 if (get_table_source() == table_reference::LEFT) {
351 }
else if (get_table_source() == table_reference::RIGHT) {
354 CUDF_FAIL(
"Column reference data type cannot be determined from unknown table.");
357 return table.column(get_column_index()).type();
368 std::reference_wrapper<expression const>
accept(
369 detail::expression_transformer& visitor)
const override;
375 return (table_source == table_reference::LEFT ? left : right).column(column_index).has_nulls();
424 [[nodiscard]] std::vector<std::reference_wrapper<expression const>>
const&
get_operands()
const
437 std::reference_wrapper<expression const>
accept(
438 detail::expression_transformer& visitor)
const override;
446 std::vector<std::reference_wrapper<expression const>> operands;
477 std::reference_wrapper<expression const>
accept(
478 detail::expression_transformer& visitor)
const override;
488 std::string column_name;
517 tree& operator=(
tree const&) =
delete;
524 template <
typename Expr,
typename... Args>
525 std::enable_if_t<std::is_base_of_v<expression, Expr>, Expr
const&>
emplace(Args&&... args)
527 auto expr = std::make_unique<Expr>(std::forward<Args>(args)...);
528 Expr
const& expr_ref = *expr;
529 expressions.emplace_back(std::move(expr));
538 template <
typename Expr>
539 decltype(
auto) push(Expr expr)
541 return emplace<Expr>(std::move(expr));
560 [[nodiscard]]
size_t size()
const {
return expressions.size(); }
579 std::vector<std::unique_ptr<expression>> expressions;
A expression referring to data from a column in a table.
cudf::size_type accept(detail::expression_parser &visitor) const override
Accepts a visitor class.
bool may_evaluate_null(table_view const &left, table_view const &right, rmm::cuda_stream_view stream) const override
Returns true if the expression may evaluate to null.
std::string get_column_name() const
Get the column name.
std::reference_wrapper< expression const > accept(detail::expression_transformer &visitor) const override
Accepts a visitor class.
column_name_reference(std::string column_name)
Construct a new column name reference object.
A expression referring to data from a column in a table.
bool may_evaluate_null(table_view const &left, table_view const &right, rmm::cuda_stream_view stream) const override
Returns true if the expression may evaluate to null.
cudf::data_type get_data_type(table_view const &left_table, table_view const &right_table) const
Get the data type.
cudf::size_type accept(detail::expression_parser &visitor) const override
Accepts a visitor class.
cudf::data_type get_data_type(table_view const &table) const
Get the data type.
std::reference_wrapper< expression const > accept(detail::expression_transformer &visitor) const override
Accepts a visitor class.
table_reference get_table_source() const
Get the table source.
column_reference(cudf::size_type column_index, table_reference table_source=table_reference::LEFT)
Construct a new column reference object.
cudf::size_type get_column_index() const
Get the column index.
A type-erased scalar_device_view where the value is a fixed width type or a string.
generic_scalar_device_view(duration_scalar< T > &s)
Construct a new generic scalar device view object from a duration scalar.
generic_scalar_device_view(data_type type, void const *data, bool *is_valid)
Construct a new fixed width scalar device view object.
generic_scalar_device_view(string_scalar &s)
Construct a new generic scalar device view object from a string scalar.
generic_scalar_device_view(timestamp_scalar< T > &s)
Construct a new generic scalar device view object from a timestamp scalar.
generic_scalar_device_view(data_type type, void const *data, bool *is_valid, size_type size)
Construct a new string scalar device view object.
T const value() const noexcept
Returns the stored value.
generic_scalar_device_view(numeric_scalar< T > &s)
Construct a new generic scalar device view object from a numeric scalar.
A literal value used in an abstract syntax tree.
literal(cudf::numeric_scalar< T > &value)
Construct a new literal object.
cudf::size_type accept(detail::expression_parser &visitor) const override
Accepts a visitor class.
generic_scalar_device_view get_value() const
Get the value object.
cudf::data_type get_data_type() const
Get the data type.
literal(cudf::string_scalar &value)
Construct a new literal object.
cudf::scalar const & get_scalar() const
Get the scalar.
literal(cudf::duration_scalar< T > &value)
Construct a new literal object.
bool is_valid(rmm::cuda_stream_view stream) const
Check if the underlying scalar is valid.
std::reference_wrapper< expression const > accept(detail::expression_transformer &visitor) const override
Accepts a visitor class.
bool may_evaluate_null(table_view const &left, table_view const &right, rmm::cuda_stream_view stream) const override
Returns true if the expression may evaluate to null.
literal(cudf::timestamp_scalar< T > &value)
Construct a new literal object.
An operation expression holds an operator and zero or more operands.
bool may_evaluate_null(table_view const &left, table_view const &right, rmm::cuda_stream_view stream) const override
Returns true if the expression may evaluate to null.
std::vector< std::reference_wrapper< expression const > > const & get_operands() const
Get the operands.
ast_operator get_operator() const
Get the operator.
operation(ast_operator op, expression const &left, expression const &right)
Construct a new binary operation object.
std::reference_wrapper< expression const > accept(detail::expression_transformer &visitor) const override
Accepts a visitor class.
operation(ast_operator op, expression const &input)
Construct a new unary operation object.
cudf::size_type accept(detail::expression_parser &visitor) const override
Accepts a visitor class.
An AST expression tree. It owns and contains multiple dependent expressions. All the expressions are ...
tree(tree &&)=default
Moves the ast tree.
tree & operator=(tree &&)=default
move-assigns the AST tree
size_t size() const
get the number of expressions added to the tree
std::enable_if_t< std::is_base_of_v< expression, Expr >, Expr const & > emplace(Args &&... args)
Add an expression to the AST tree.
tree()=default
construct an empty ast tree
expression const & front() const
get the first expression in the tree
expression const & at(size_t index)
get the expression at an index in the tree. Index is checked.
expression const & back() const
get the last expression in the tree
expression const & operator[](size_t index) const
get the expression at an index in the tree. Index is unchecked.
Indicator for the logical data type of an element in a column.
A non-owning view of scalar from device that is trivially copyable and usable in CUDA device code.
An owning class to represent a duration value in device memory.
An owning class to represent a numerical value in device memory.
An owning class to represent a singular value.
bool is_valid(rmm::cuda_stream_view stream=cudf::get_default_stream()) const
Indicates whether the scalar contains a valid value.
An owning class to represent a string in device memory.
A non-owning, immutable view of device data that is a variable length char array representing a UTF-8...
A set of cudf::column_view's of the same size.
A set of cudf::column's of the same size.
An owning class to represent a timestamp value in device memory.
table_reference
Enum of table references.
ast_operator
Enum of supported operators.
@ RIGHT
Column index in the right table.
@ OUTPUT
Column index in the output table.
@ LEFT
Column index in the left table.
#define CUDF_FAIL(...)
Indicates that an erroneous code path has been taken.
int32_t size_type
Row index type for columns and tables.
Class definitions for cudf::scalar.
Scalar device view class definitions.
A generic expression that can be evaluated to return a value.
bool may_evaluate_null(table_view const &left, rmm::cuda_stream_view stream) const
Returns true if the expression may evaluate to null.
virtual cudf::size_type accept(detail::expression_parser &visitor) const =0
Accepts a visitor class.
virtual std::reference_wrapper< expression const > accept(detail::expression_transformer &visitor) const =0
Accepts a visitor class.
virtual bool may_evaluate_null(table_view const &left, table_view const &right, rmm::cuda_stream_view stream) const =0
Returns true if the expression may evaluate to null.
Class definitions for (mutable)_table_view
Type declarations for libcudf.