mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 09:05:47 +08:00
Code review comments
Change-Id: Ib67ce254d8a2aeff3df12e8d57525f3383a3c344
This commit is contained in:
1 parent
e791893850
commit
316b8451f9
6 files changed
+13
-19
No files matched your search
@@ -166,6 +166,8 @@ else()
|
||||
message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif ()
|
||||
|
||||
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# Add common flags
|
||||
set(CMAKE_CXX_FLAGS "${CXX_COMMON_FLAGS} ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
|
||||
@@ -91,8 +91,7 @@ class HdfsAnyFileImpl {
|
||||
// Private implementation for read-only files
|
||||
class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl {
|
||||
public:
|
||||
explicit HdfsReadableFileImpl(MemoryPool* pool)
|
||||
: pool_(pool) {}
|
||||
explicit HdfsReadableFileImpl(MemoryPool* pool) : pool_(pool) {}
|
||||
|
||||
Status Close() {
|
||||
if (is_open_) {
|
||||
@@ -118,8 +117,7 @@ class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl {
|
||||
int64_t bytes_read = 0;
|
||||
RETURN_NOT_OK(ReadAt(position, nbytes, &bytes_read, buffer->mutable_data()));
|
||||
|
||||
// XXX: heuristic
|
||||
if (bytes_read < nbytes / 2) { RETURN_NOT_OK(buffer->Resize(bytes_read)); }
|
||||
if (bytes_read < nbytes) { RETURN_NOT_OK(buffer->Resize(bytes_read)); }
|
||||
|
||||
*out = buffer;
|
||||
return Status::OK();
|
||||
@@ -139,8 +137,7 @@ class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl {
|
||||
int64_t bytes_read = 0;
|
||||
RETURN_NOT_OK(Read(nbytes, &bytes_read, buffer->mutable_data()));
|
||||
|
||||
// XXX: heuristic
|
||||
if (bytes_read < nbytes / 2) { RETURN_NOT_OK(buffer->Resize(bytes_read)); }
|
||||
if (bytes_read < nbytes) { RETURN_NOT_OK(buffer->Resize(bytes_read)); }
|
||||
|
||||
*out = buffer;
|
||||
return Status::OK();
|
||||
@@ -155,18 +152,14 @@ class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
void set_memory_pool(MemoryPool* pool) {
|
||||
pool_ = pool;
|
||||
}
|
||||
void set_memory_pool(MemoryPool* pool) { pool_ = pool; }
|
||||
|
||||
private:
|
||||
MemoryPool* pool_;
|
||||
};
|
||||
|
||||
HdfsReadableFile::HdfsReadableFile(MemoryPool* pool) {
|
||||
if (pool == nullptr) {
|
||||
pool = default_memory_pool();
|
||||
}
|
||||
if (pool == nullptr) { pool = default_memory_pool(); }
|
||||
impl_.reset(new HdfsReadableFileImpl(pool));
|
||||
}
|
||||
|
||||
|
||||
@@ -101,8 +101,7 @@ class ARROW_EXPORT ReadableFileInterface : public InputStream, public Seekable {
|
||||
virtual Status ReadAt(
|
||||
int64_t position, int64_t nbytes, int64_t* bytes_read, uint8_t* out);
|
||||
|
||||
virtual Status ReadAt(
|
||||
int64_t position, int64_t nbytes, std::shared_ptr<Buffer>* out);
|
||||
virtual Status ReadAt(int64_t position, int64_t nbytes, std::shared_ptr<Buffer>* out);
|
||||
|
||||
protected:
|
||||
ReadableFileInterface();
|
||||
|
||||
@@ -241,7 +241,7 @@ Status BufferOutputStream::Reserve(int64_t nbytes) {
|
||||
// In-memory buffer reader
|
||||
|
||||
BufferReader::BufferReader(const uint8_t* buffer, int buffer_size)
|
||||
: buffer_(buffer), buffer_size_(buffer_size), position_(0) {}
|
||||
: buffer_(buffer), buffer_size_(buffer_size), position_(0) {}
|
||||
|
||||
BufferReader::~BufferReader() {}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
#include "pyarrow/io.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
#include <arrow/io/memory.h>
|
||||
#include <arrow/util/memory-pool.h>
|
||||
|
||||
@@ -48,7 +48,7 @@ class PythonFile {
|
||||
class PYARROW_EXPORT PyReadableFile : public arrow::io::ReadableFileInterface {
|
||||
public:
|
||||
explicit PyReadableFile(PyObject* file);
|
||||
~PyReadableFile();
|
||||
virtual ~PyReadableFile();
|
||||
|
||||
arrow::Status Close() override;
|
||||
|
||||
@@ -70,7 +70,7 @@ class PYARROW_EXPORT PyReadableFile : public arrow::io::ReadableFileInterface {
|
||||
class PYARROW_EXPORT PyOutputStream : public arrow::io::OutputStream {
|
||||
public:
|
||||
explicit PyOutputStream(PyObject* file);
|
||||
~PyOutputStream();
|
||||
virtual ~PyOutputStream();
|
||||
|
||||
arrow::Status Close() override;
|
||||
arrow::Status Tell(int64_t* position) override;
|
||||
@@ -84,7 +84,7 @@ class PYARROW_EXPORT PyOutputStream : public arrow::io::OutputStream {
|
||||
class PYARROW_EXPORT PyBytesReader : public arrow::io::BufferReader {
|
||||
public:
|
||||
explicit PyBytesReader(PyObject* obj);
|
||||
~PyBytesReader();
|
||||
virtual ~PyBytesReader();
|
||||
|
||||
private:
|
||||
PyObject* obj_;
|
||||
|
||||
Reference in new issue
Block a user