You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by ji...@apache.org on 2017/02/08 18:08:46 UTC
[5/6] incubator-quickstep git commit: Style fixes for
TextScanOperator.
Style fixes for TextScanOperator.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/a9fe07d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/a9fe07d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/a9fe07d5
Branch: refs/heads/aggregate-on-left-outer-join
Commit: a9fe07d5b0885d08b4aac328aa7deea81d94bda7
Parents: aa7f6fe
Author: Zuyu Zhang <zu...@apache.org>
Authored: Wed Feb 8 01:57:23 2017 -0800
Committer: Zuyu Zhang <zu...@apache.org>
Committed: Wed Feb 8 01:57:23 2017 -0800
----------------------------------------------------------------------
relational_operators/TextScanOperator.cpp | 74 +++++++++++++-------------
relational_operators/TextScanOperator.hpp | 6 +--
2 files changed, 39 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a9fe07d5/relational_operators/TextScanOperator.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/TextScanOperator.cpp b/relational_operators/TextScanOperator.cpp
index 6650319..0a83a85 100644
--- a/relational_operators/TextScanOperator.cpp
+++ b/relational_operators/TextScanOperator.cpp
@@ -110,8 +110,6 @@ bool TextScanOperator::getAllWorkOrders(
if (blocking_dependencies_met_ && !work_generated_) {
for (const std::string &file : files) {
- // Use standard C libary to retrieve the file size.
-
#ifdef QUICKSTEP_HAVE_UNISTD
// Check file permissions before trying to open it.
const int access_result = access(file.c_str(), R_OK);
@@ -255,11 +253,11 @@ void TextScanWorkOrder::execute() {
} else {
vector_tuple_returned = parseRow(&row_ptr, relation, &is_faulty);
if (is_faulty) {
- // Skip faulty rows
- LOG(INFO) << "Faulty row found. Hence switching to next row.";
+ // Skip faulty rows
+ LOG(INFO) << "Faulty row found. Hence switching to next row.";
} else {
- // Convert vector returned to tuple only when a valid row is encountered.
- tuples.emplace_back(Tuple(std::move(vector_tuple_returned)));
+ // Convert vector returned to tuple only when a valid row is encountered.
+ tuples.emplace_back(Tuple(std::move(vector_tuple_returned)));
}
}
}
@@ -297,11 +295,11 @@ void TextScanWorkOrder::execute() {
vector_tuple_returned = parseRow(&row_ptr, relation, &is_faulty);
if (is_faulty) {
- // Skip the faulty row.
- LOG(INFO) << "Faulty row found. Hence switching to next row.";
+ // Skip the faulty row.
+ LOG(INFO) << "Faulty row found. Hence switching to next row.";
} else {
- // Convert vector returned to tuple only when a valid row is encountered.
- tuples.emplace_back(Tuple(std::move(vector_tuple_returned)));
+ // Convert vector returned to tuple only when a valid row is encountered.
+ tuples.emplace_back(Tuple(std::move(vector_tuple_returned)));
}
}
@@ -346,11 +344,11 @@ std::vector<TypedValue> TextScanWorkOrder::parseRow(const char **row_ptr,
std::string value_str;
for (const auto &attr : relation) {
if (has_reached_end_of_line) {
- // Do not abort if one of the row is faulty.
- // Set is_faulty to true and SKIP the current row.
- *is_faulty = true;
- LOG(INFO) << "Row has too few fields.";
- return attribute_values;
+ // Do not abort if one of the row is faulty.
+ // Set is_faulty to true and SKIP the current row.
+ *is_faulty = true;
+ LOG(INFO) << "Row has too few fields.";
+ return attribute_values;
}
value_str.clear();
@@ -363,46 +361,46 @@ std::vector<TypedValue> TextScanWorkOrder::parseRow(const char **row_ptr,
if (is_null_literal) {
// NULL literal.
if (!attr.getType().isNullable()) {
- *is_faulty = true;
- LOG(INFO) << "NULL literal '\\N' was specified for a column with a "
- "non-nullable Type.";
- skipFaultyRow(row_ptr);
- return attribute_values;
+ *is_faulty = true;
+ LOG(INFO) << "NULL literal '\\N' was specified for a column with a "
+ "non-nullable Type.";
+ skipFaultyRow(row_ptr);
+ return attribute_values;
}
attribute_values.emplace_back(attr.getType().makeNullValue());
} else {
attribute_values.emplace_back();
if (!attr.getType().parseValueFromString(value_str, &(attribute_values.back()))) {
- // Do not abort if one of the row is faulty.
- *is_faulty = true;
- LOG(INFO) << "Failed to parse value.";
- skipFaultyRow(row_ptr);
- return attribute_values;
+ // Do not abort if one of the row is faulty.
+ *is_faulty = true;
+ LOG(INFO) << "Failed to parse value.";
+ skipFaultyRow(row_ptr);
+ return attribute_values;
}
}
}
if (!has_reached_end_of_line) {
- // Do not abort if one of the row is faulty.
- // Set is_faulty to true and SKIP the current row.
- *is_faulty = true;
- LOG(INFO) << "Row has too many fields.";
- skipFaultyRow(row_ptr);
+ // Do not abort if one of the row is faulty.
+ // Set is_faulty to true and SKIP the current row.
+ *is_faulty = true;
+ LOG(INFO) << "Row has too many fields.";
+ skipFaultyRow(row_ptr);
}
return attribute_values;
}
void TextScanWorkOrder::skipFaultyRow(const char **field_ptr) const {
- const char *cur_ptr = *field_ptr;
- // Move row pointer to the end of faulty row.
- for (;; ++cur_ptr) {
- const char c = *cur_ptr;
- if (c == '\n') {
- break;
- }
+ const char *cur_ptr = *field_ptr;
+ // Move row pointer to the end of faulty row.
+ for (;; ++cur_ptr) {
+ const char c = *cur_ptr;
+ if (c == '\n') {
+ break;
}
- *field_ptr = cur_ptr + 1;
+ }
+ *field_ptr = cur_ptr + 1;
}
void TextScanWorkOrder::extractFieldString(const char **field_ptr,
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a9fe07d5/relational_operators/TextScanOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/TextScanOperator.hpp b/relational_operators/TextScanOperator.hpp
index 65863b3..eada190 100644
--- a/relational_operators/TextScanOperator.hpp
+++ b/relational_operators/TextScanOperator.hpp
@@ -264,9 +264,9 @@ class TextScanWorkOrder : public WorkOrder {
* @param is_faulty OUTPUT parameter. Set to true if the row is faulty,
* @return The tuple parsed from the char stream.
*/
-std::vector<TypedValue> parseRow(const char **row_ptr,
- const CatalogRelationSchema &relation,
- bool *is_faulty) const;
+ std::vector<TypedValue> parseRow(const char **row_ptr,
+ const CatalogRelationSchema &relation,
+ bool *is_faulty) const;
/**
* @brief Parse up to three octal digits (0-7) starting at \p *literal_ptr as