Navigation Menu

Skip to content

Commit

Permalink
Rename RowSet to RecordSet.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yata committed Jun 12, 2014
1 parent d1630e1 commit ef6cad9
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 30 deletions.
4 changes: 2 additions & 2 deletions new-interface/cursor.hpp
Expand Up @@ -21,10 +21,10 @@ class Cursor {
// 成功すれば移動量を返す.
// 失敗したときは *error にその内容を格納し, -1 を返す.
//
// カーソルの移動中に取得した行は *row_set の末尾に追加する.
// カーソルの移動中に取得した行は *record_set の末尾に追加する.
//
// 途中で終端に到達したときは count より小さい値を返す.
virtual int64_t read(Error *error, int64_t count, RowSet *row_set) = 0;
virtual int64_t read(Error *error, int64_t count, RecordSet *record_set) = 0;
};

} // namespace grnxx
Expand Down
8 changes: 4 additions & 4 deletions new-interface/expression.hpp
Expand Up @@ -37,14 +37,14 @@ class Expression {
// - NaN が発生する.
// - TODO: これらの取り扱いについては検討の余地がある.
virtual int64_t filter(Error *error,
RowSet *row_set,
RecordSet *record_set,
int64_t offset) = 0;

// スコアを調整する.
// 成功すれば true を返す.
// 失敗したときは *error にその内容を格納し, false を返す.
//
// 評価結果を *row_set に格納する.
// 評価結果を *record_set に格納する.
// 式の構築において _score を指定することにより,
// 既存のスコアを入力として使うこともできる.
//
Expand All @@ -60,7 +60,7 @@ class Expression {
// - NaN が発生する.
// - TODO: これらの取り扱いについては検討の余地がある.
virtual bool adjust(Error *error,
RowSet *row_set,
RecordSet *record_set,
int64_t offset) = 0;

// 行の一覧に対する評価結果を取得する.
Expand All @@ -75,7 +75,7 @@ class Expression {
// - TODO: これらの取り扱いについては検討の余地がある.
// - リソースが確保できない.
virtual bool evaluate(Error *error,
const RowSet &row_set,
const RecordSet &record_set,
int64_t offset,
int64_t limit,
Data *values) = 0;
Expand Down
2 changes: 1 addition & 1 deletion new-interface/group-set.hpp
Expand Up @@ -18,7 +18,7 @@ class GroupSet {
// 行数を取得する.
int64_t get_num_rows(int64_t i) const;
// 保存してある行の一覧を取得する.
RowSet *get_row_set(int64_t i) const;
RecordSet *get_record_set(int64_t i) const;

// 整列する.
// 成功すれば true を返す.
Expand Down
12 changes: 6 additions & 6 deletions new-interface/merger.hpp
Expand Up @@ -25,9 +25,9 @@ class Merger {
// 入力がまだ残っているときは MERGE_CONTINUE,
// 入力がもう残っていないときは MERGE_FINISH を指定する.
//
// lhs_row_set, rhs_row_set を入力として,
// 合成した結果を result_row_set に出力する.
// 合成に使用された行は lhs_row_set, rhs_row_set から取り除かれる.
// lhs_record_set, rhs_record_set を入力として,
// 合成した結果を result_record_set に出力する.
// 合成に使用された行は lhs_record_set, rhs_record_set から取り除かれる.
// そのため,空になった方の入力に行を補充することで合成を継続できる.
//
// 入力は行 ID 昇順もしくは降順になっているものとする.
Expand All @@ -37,9 +37,9 @@ class Merger {
// - スコアが合成によって不正な値になる.
// - リソースが確保できない.
virtual int64_t merge(Error *error,
RowSet *lhs_row_set,
RowSet *rhs_row_set,
RowSet *result_row_set,
RecordSet *lhs_record_set,
RecordSet *rhs_record_set,
RecordSet *result_record_set,
MergeStatus status) const = 0;
};

Expand Down
28 changes: 15 additions & 13 deletions new-interface/row-set.hpp → new-interface/record-set.hpp
@@ -1,24 +1,26 @@
#ifndef GRNXX_ROW_SET_HPP
#define GRNXX_ROW_SET_HPP
#ifndef GRNXX_RECORD_SET_HPP
#define GRNXX_RECORD_SET_HPP

#include "grnxx/types.hpp"

namespace grnxx {

class RowSet {
class RecordSet {
public:
RowSet();
~RowSet();
RecordSet();
~RecordSet();

// 所属するテーブルを取得する.
Table *table() const;
// 行数を取得する.
int64_t num_rows() const;
// レコード ID の最小値を取得する.
RecordID min_record_id() const;
// レコード ID の最大値を取得する.
RecordID max_record_id() const;

// 行 ID を取得する.
RowID get_row_id(int64_t i) const;
RowID get_row_id(RecordID record_id) const;
// スコアを取得する.
double get_score(int64_t i) const;
double get_score(RecordID record_id) const;

// スコアを正規化する.
// 成功すれば true を返す.
Expand All @@ -30,10 +32,10 @@ class RowSet {
// ほかにも何か必要な正規化があるかどうか.
//
// 失敗する状況としては,以下のようなものが挙げられる.
// - 最大値が 0.0, negative, infinity である
// - 最大値が 0.0, negative, infinity のいずれかである
bool normalize(Error *error, const NormalizeOptions &options);

// TODO: Sorter を使うより RowSet::sort() の方が良い?
// TODO: Sorter を使うより RecordSet::sort() の方が良い?

// 整列する.
// 成功すれば true を返す.
Expand All @@ -46,7 +48,7 @@ class RowSet {
// - 演算において例外が発生する.
bool sort(Error *error, const SortConditions &conditions);

// TODO: Grouper を使うより RowSet::group() の方が良い?
// TODO: Grouper を使うより RecordSet::group() の方が良い?

// グループ化する.
// 成功すれば true を返す.
Expand All @@ -63,4 +65,4 @@ class RowSet {

} // namespace grnxx

#endif // GRNXX_ROW_SET_HPP
#endif // GRNXX_RECORD_SET_HPP
2 changes: 1 addition & 1 deletion new-interface/sorter.hpp
Expand Up @@ -24,7 +24,7 @@ class Sorter {
// - 演算において例外が発生する.
// - リソースを確保できない.
virtual bool sort(Error *error,
RowSet *row_set,
RecordSet *record_set,
int64_t offset,
int64_t limit);
};
Expand Down
6 changes: 3 additions & 3 deletions new-interface/table.hpp
Expand Up @@ -343,9 +343,9 @@ class Table {
// - オプションが不正である.
// - リソースが確保できない.
virtual bool merge(Error *error,
RowSet *lhs,
RowSet *rhs,
RowSet *output,
RecordSet *lhs_record_set,
RecordSet *rhs_record_set,
RecordSet *result_record_set,
const MergerOptions &options);

protected:
Expand Down
1 change: 1 addition & 0 deletions new-interface/types.hpp
Expand Up @@ -31,6 +31,7 @@ using TableID = int64_t;
using ColumnID = int64_t;
using IndexID = int64_t;
using RowID = int64_t;
using RecordID = int64_t;

constexpr RowID NULL_ROW_ID = RowID(0);
constexpr RowID MIN_ROW_ID = RowID(1);
Expand Down

0 comments on commit ef6cad9

Please sign in to comment.