From 3beb7a5f5455b928d6c9f712e11c958b3fb651c5 Mon Sep 17 00:00:00 2001 From: Yoon-Min Nam Date: Fri, 30 Nov 2018 11:44:56 +0900 Subject: [PATCH 1/3] Fix CSV scanner for handling filter predicate on a VARCHAR column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CSV scan does not care about delimiter in a CSV file, but query processor should care the end of each column value, i.e., ‘\0’. Because query parser parses each selection predicate by adding ‘\0’ at the end of the predicate value, query processor cannot handle the query correctly if we ignore the existence of delimiter in a raw tuple in CSV file. This simple solution fix the case by replacing delimiter to ‘\0’, and thus StringCompare in type/type_util.h works correctly. --- src/codegen/util/csv_scanner.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/codegen/util/csv_scanner.cpp b/src/codegen/util/csv_scanner.cpp index 5f09349f973..62aaf28f855 100644 --- a/src/codegen/util/csv_scanner.cpp +++ b/src/codegen/util/csv_scanner.cpp @@ -362,6 +362,9 @@ void CSVScanner::ProduceCSV(char *line) { cols_[col_idx].len = static_cast(col_end - col_begin); cols_[col_idx].is_null = (cols_[col_idx].len == 0); + // Yoon-Min: replace delimiter to '\0' to fix a bug while comparing + // filter condition in a query and column value of VARCHAR type + *iter = 0; // Eat delimiter, moving to next column iter++; } @@ -372,4 +375,4 @@ void CSVScanner::ProduceCSV(char *line) { } // namespace util } // namespace codegen -} // namespace peloton \ No newline at end of file +} // namespace peloton From b6fb7f41a48994d7d04c9cb9575ac0112f292730 Mon Sep 17 00:00:00 2001 From: Yoon-Min Nam Date: Fri, 30 Nov 2018 13:12:57 +0900 Subject: [PATCH 2/3] Avoid uninitialized value error during compile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ----------------------------------------------------------------- /data/system/dev/peloton/src/util/file.cpp: In member function ‘void peloton::util::File::Open(const string&, peloton::util::File::AccessMode)’: /data/system/dev/peloton/src/util/file.cpp:41:36: error: ‘flags’ may be used uninitialized in this function [-Werror=maybe-uninitialized] int fd = open(name.c_str(), flags); ^ At global scope: cc1plus: error: unrecognized command line option ‘-Wno-implicit-fallthrough’ [-Werror] --- src/util/file.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/file.cpp b/src/util/file.cpp index 275d3848418..2bacd9c7e0b 100644 --- a/src/util/file.cpp +++ b/src/util/file.cpp @@ -35,6 +35,10 @@ void File::Open(const std::string &name, File::AccessMode access_mode) { flags = O_RDWR; break; } + default: { + flags = O_RDWR; + break; + } } // Open From cc7a20b05fa868c4a6da51558ee9cdbbbce5e953 Mon Sep 17 00:00:00 2001 From: Yoon-Min Nam Date: Fri, 30 Nov 2018 15:10:50 +0900 Subject: [PATCH 3/3] Undo merge (sorry for mistake) --- src/util/file.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/util/file.cpp b/src/util/file.cpp index 2bacd9c7e0b..275d3848418 100644 --- a/src/util/file.cpp +++ b/src/util/file.cpp @@ -35,10 +35,6 @@ void File::Open(const std::string &name, File::AccessMode access_mode) { flags = O_RDWR; break; } - default: { - flags = O_RDWR; - break; - } } // Open