pitrou commented on a change in pull request #12426:
URL: https://github.com/apache/arrow/pull/12426#discussion_r812037255
##########
File path: cpp/src/arrow/csv/options.cc
##########
@@ -73,6 +73,12 @@ Status ReadOptions::Validate() const {
WriteOptions WriteOptions::Defaults() { return WriteOptions(); }
Status WriteOptions::Validate() const {
+ if (ARROW_PREDICT_FALSE(delimiter == '\n' || delimiter == '\r' || delimiter
== '"' ||
+ std::string(1, delimiter) == eol)) {
Review comment:
You should look for `delimiter` in `eol` instead, so for example
`eol.find(delimiter) != std::string::npos`.
##########
File path: cpp/src/arrow/csv/writer.cc
##########
@@ -234,7 +235,7 @@ class UnquotedColumnPopulator : public ColumnPopulator {
while (offset < buffer_size) {
// error happened or remaining bytes to check
const char c = static_cast<char>(data[offset]);
- if (c == '\n' || c == '\r' || c == ',' || c == '"') {
+ if (c == '\n' || c == '\r' || c == ',' || c == '"' || c == delimiter) {
Review comment:
The comma can be removed here:
```suggestion
if (c == '\n' || c == '\r' || c == '"' || c == delimiter) {
```
##########
File path: python/pyarrow/includes/libarrow.pxd
##########
@@ -1713,6 +1713,7 @@ cdef extern from "arrow/csv/api.h" namespace "arrow::csv"
nogil:
cdef cppclass CCSVWriteOptions" arrow::csv::WriteOptions":
c_bool include_header
int32_t batch_size
+ char delimiter
Review comment:
Here as well.
##########
File path: python/pyarrow/includes/libarrow.pxd
##########
@@ -1651,7 +1651,7 @@ cdef extern from "arrow/python/csv.h" namespace
"arrow::py::csv":
cdef extern from "arrow/csv/api.h" namespace "arrow::csv" nogil:
cdef cppclass CCSVParseOptions" arrow::csv::ParseOptions":
- unsigned char delimiter
+ char delimiter
Review comment:
Character numbers in Python are unsigned, so IMHO you should keep this
unsigned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]