susumu.yata
null+****@clear*****
Thu Dec 25 16:36:21 JST 2014
susumu.yata 2014-12-25 16:36:21 +0900 (Thu, 25 Dec 2014) New Revision: 7427da23551ea6d20a5ace42e29f31929a9450c5 https://github.com/groonga/grnxx/commit/7427da23551ea6d20a5ace42e29f31929a9450c5 Message: Update Column::contains() to use Index::num_entries(). (#135) Modified files: lib/grnxx/impl/column/scalar/float.cpp lib/grnxx/impl/column/scalar/int.cpp lib/grnxx/impl/column/scalar/text.cpp Modified: lib/grnxx/impl/column/scalar/float.cpp (+5 -1) =================================================================== --- lib/grnxx/impl/column/scalar/float.cpp 2014-12-25 16:35:41 +0900 (a149281) +++ lib/grnxx/impl/column/scalar/float.cpp 2014-12-25 16:36:21 +0900 (dd92ed3) @@ -60,10 +60,14 @@ void Column<Float>::get(Int row_id, Datum *datum) const { bool Column<Float>::contains(const Datum &datum) const { // TODO: Choose the best index. + Float value = parse_datum(datum); if (!indexes_.is_empty()) { + if (value.is_na()) { + return table_->num_rows() != indexes_[0]->num_entries(); + } return indexes_[0]->contains(datum); } - return !scan(parse_datum(datum)).is_na(); + return !scan(value).is_na(); } Int Column<Float>::find_one(const Datum &datum) const { Modified: lib/grnxx/impl/column/scalar/int.cpp (+5 -1) =================================================================== --- lib/grnxx/impl/column/scalar/int.cpp 2014-12-25 16:35:41 +0900 (4f077c7) +++ lib/grnxx/impl/column/scalar/int.cpp 2014-12-25 16:36:21 +0900 (2a4d1cf) @@ -99,10 +99,14 @@ void Column<Int>::get(Int row_id, Datum *datum) const { bool Column<Int>::contains(const Datum &datum) const { // TODO: Choose the best index. + Int value = parse_datum(datum); if (!indexes_.is_empty()) { + if (value.is_na()) { + return table_->num_rows() != indexes_[0]->num_entries(); + } return indexes_[0]->contains(datum); } - return !scan(parse_datum(datum)).is_na(); + return !scan(value).is_na(); } Int Column<Int>::find_one(const Datum &datum) const { Modified: lib/grnxx/impl/column/scalar/text.cpp (+4 -1) =================================================================== --- lib/grnxx/impl/column/scalar/text.cpp 2014-12-25 16:35:41 +0900 (e3894e5) +++ lib/grnxx/impl/column/scalar/text.cpp 2014-12-25 16:36:21 +0900 (2524567) @@ -144,10 +144,13 @@ void Column<Text>::get(Int row_id, Datum *datum) const { bool Column<Text>::contains(const Datum &datum) const { // TODO: Choose the best index. + Text value = parse_datum(datum); if (!indexes_.is_empty()) { + if (value.is_na()) { + return table_->num_rows() != indexes_[0]->num_entries(); + } return indexes_[0]->contains(datum); } - Text value = parse_datum(datum); size_t valid_size = get_valid_size(); if (value.is_na()) { for (size_t i = 0; i < valid_size; ++i) { -------------- next part -------------- HTML����������������������������... 下载