Skip to content

Commit c892708

Browse files
committed
review: some meaningful improvements (no)
1 parent d26637e commit c892708

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

include/core/batch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Batch {
1111

1212
Batch(Schema schema) : schema_(std::move(schema)) {
1313
columns_.reserve(schema_.FieldsCount());
14-
for(auto& field : schema_.GetFields()) {
14+
for (auto& field : schema_.GetFields()) {
1515
columns_.emplace_back(MakeColumn(field.type, field.nullable));
1616
}
1717
}

include/core/columns/bool_column.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class BoolColumn : public Column {
6666
if (nullable_) {
6767
AppendBit(is_null_, true);
6868
}
69+
++size_;
6970
}
7071

7172
std::unique_ptr<Column> CloneEmpty() const override {

include/csv/csv_row_reader.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class CSVRowReader {
8181
in_quotes = true;
8282
was_quoted = true;
8383
} else if (c == '\n') {
84-
row.emplace_back(std::move(field), was_quoted);
84+
row.emplace_back(Field{std::move(field), was_quoted});
8585
return row;
8686
} else {
8787
field += c;
@@ -90,7 +90,10 @@ class CSVRowReader {
9090
}
9191

9292
if (!field.empty() || !row.empty()) {
93-
row.emplace_back(std::move(field), was_quoted);
93+
if (in_quotes) {
94+
THROW_RUNTIME_ERROR("Got EOF inside the quotes");
95+
}
96+
row.emplace_back(Field{std::move(field), was_quoted});
9497
return row;
9598
}
9699
return std::nullopt;

include/csv/schema_reader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SchemaManager {
4141
}
4242

4343
static void WriteToStream(std::ostream& os, const core::Schema& schema) {
44-
for (auto& field : schema.GetFields()) {
44+
for (const auto& field : schema.GetFields()) {
4545
os << field.name << "," << core::DataTypeToString(field.type);
4646
if (field.nullable) {
4747
os << ",nullable";

0 commit comments

Comments
 (0)