[Groonga-commit] groonga/grnxx at b9d1d1e [new_data_types] Add Expression::is_row_id() and Expression::is_score(). (#119)

Back to archive index

susumu.yata null+****@clear*****
Wed Nov 26 17:38:29 JST 2014


susumu.yata	2014-11-26 17:38:29 +0900 (Wed, 26 Nov 2014)

  New Revision: b9d1d1e919baacf5b7816a711d152f6ce6ea80b3
  https://github.com/groonga/grnxx/commit/b9d1d1e919baacf5b7816a711d152f6ce6ea80b3

  Message:
    Add Expression::is_row_id() and Expression::is_score(). (#119)

  Modified files:
    include/grnxx/expression.hpp
    lib/grnxx/impl/expression.cpp
    lib/grnxx/impl/expression.hpp

  Modified: include/grnxx/expression.hpp (+4 -0)
===================================================================
--- include/grnxx/expression.hpp    2014-11-26 17:23:50 +0900 (ba90ced)
+++ include/grnxx/expression.hpp    2014-11-26 17:38:29 +0900 (bf37d06)
@@ -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;
 

  Modified: lib/grnxx/impl/expression.cpp (+8 -0)
===================================================================
--- lib/grnxx/impl/expression.cpp    2014-11-26 17:23:50 +0900 (211927c)
+++ lib/grnxx/impl/expression.cpp    2014-11-26 17:38:29 +0900 (4c465df)
@@ -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,

  Modified: lib/grnxx/impl/expression.hpp (+2 -0)
===================================================================
--- lib/grnxx/impl/expression.hpp    2014-11-26 17:23:50 +0900 (7b33aed)
+++ lib/grnxx/impl/expression.hpp    2014-11-26 17:38:29 +0900 (d75829c)
@@ -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_;
   }
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index