@@ -72,37 +72,37 @@ static inline void parse_line(
72
72
}
73
73
}
74
74
75
- // class Reader {
76
- // public:
77
- // virtual ~Reader() {}
78
- // virtual bool HasNext() = 0;
79
- // virtual void NextLine(std::string& line) = 0;
80
- // };
81
-
82
- class GzipReader {
75
+ class Reader {
76
+ public:
77
+ virtual ~Reader () {}
78
+ virtual bool HasNext () = 0;
79
+ virtual void NextLine (std::string* line) = 0;
80
+ };
81
+
82
+ class GzipReader : public Reader {
83
83
public:
84
84
explicit GzipReader (const std::string& file_name)
85
85
: gzstream_(file_name.c_str()) {}
86
86
87
87
~GzipReader () {}
88
88
89
- bool HasNext () { return gzstream_.peek () != EOF; }
89
+ bool HasNext () override { return gzstream_.peek () != EOF; }
90
90
91
- void NextLine (std::string* line) { std::getline (gzstream_, *line); }
91
+ void NextLine (std::string* line) override { std::getline (gzstream_, *line); }
92
92
93
93
private:
94
94
igzstream gzstream_;
95
95
};
96
96
97
- class MultiGzipReader {
97
+ class MultiGzipReader : public Reader {
98
98
public:
99
99
explicit MultiGzipReader (const std::vector<std::string>& file_list) {
100
100
for (auto & file : file_list) {
101
101
readers_.emplace_back (std::make_shared<GzipReader>(file));
102
102
}
103
103
}
104
104
105
- bool HasNext () {
105
+ bool HasNext () override {
106
106
if (current_reader_index_ >= readers_.size ()) {
107
107
return false ;
108
108
}
@@ -113,7 +113,7 @@ class MultiGzipReader {
113
113
return true ;
114
114
}
115
115
116
- void NextLine (std::string* line) {
116
+ void NextLine (std::string* line) override {
117
117
readers_[current_reader_index_]->NextLine (line);
118
118
}
119
119
@@ -151,6 +151,7 @@ void CTRReader::ReadThread(const std::vector<std::string>& file_list,
151
151
for (auto & slots_to_data : batch_data) {
152
152
std::vector<size_t > lod_data{0 };
153
153
std::vector<int64_t > batch_feasign;
154
+ std::vector<int64_t > batch_label;
154
155
155
156
auto & feasign = slots_to_data[slot];
156
157
0 commit comments