Skip to content

Commit

Permalink
Add Expression::is_row_id() and Expression::is_score(). (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yata committed Nov 26, 2014
1 parent 7f5951e commit b9d1d1e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/grnxx/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ class Expression {
virtual const Table *table() const = 0;
// Return the result data type.
virtual DataType data_type() const = 0;
// Return whether "*this" is equal to RowID or not.
virtual bool is_row_id() const = 0;
// Return whether "*this" is equal to Score or not.
virtual bool is_score() const = 0;
// Return the evaluation block size.
virtual size_t block_size() const = 0;

Expand Down
8 changes: 8 additions & 0 deletions lib/grnxx/impl/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,14 @@ DataType Expression::data_type() const {
return root_->data_type();
}

bool Expression::is_row_id() const {
return root_->node_type() == ROW_ID_NODE;
}

bool Expression::is_score() const {
return root_->node_type() == SCORE_NODE;
}

void Expression::filter(Array<Record> *records,
size_t input_offset,
size_t output_offset,
Expand Down
2 changes: 2 additions & 0 deletions lib/grnxx/impl/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class Expression : public ExpressionInterface {
return table_;
}
DataType data_type() const;
bool is_row_id() const;
bool is_score() const;
size_t block_size() const {
return block_size_;
}
Expand Down

0 comments on commit b9d1d1e

Please sign in to comment.