Conversation
|
Ah, this will not work. If we want to remove cc @pitrou |
Well, ARROW_HDFS=ON could imply ARROW_FILESYSTEM=ON. I don't think that's a problem.
Yes, indeed. |
|
OK, I will then move |
e95f3f3 to
287cb9b
Compare
1bd3f43 to
8e26730
Compare
There was a problem hiding this comment.
Are all these declarations actually needed by PyArrow?
There was a problem hiding this comment.
No, most of them aren't and are copied from libarrow.pxd. I can remove the unused ones - but am not sure if some external application can actually use them?
There was a problem hiding this comment.
Don't we need to link to arrow::hadoop as was done above? cc @kou for advice
There was a problem hiding this comment.
Hm, yeah. I will add a link as above as it makes sense.
There was a problem hiding this comment.
Ah, it is there already (that explains why nothing failed =) )
arrow/cpp/src/arrow/CMakeLists.txt
Lines 857 to 861 in 53ef438
Not sure if the line with CMAKE_DL_LIBS is also needed here then?
There was a problem hiding this comment.
Ok, but we don't want to keep those two unofficial FileSystem and HadoopFileSystem classes which create confusion with the other (public) filesystem classes.
Ideally, those two classes disappear and their implementation code gets folded into the public HadoopFileSystem class.
If that's too annoying, we should at least merge those two classes and give them a less ambiguous name, for example HdfsClient.
There was a problem hiding this comment.
Ok, will go with the disappearing =)
IIUC hdfs_io.h will be removed altogether:
FileSystemandHadoopFileSystemwill go intohdfs.cc, folded into the publicHadoopFileSystemHdfsConnectionConfigwill also go intohdfs.cc- declarations that are left will go into
hdfs_internal.cc
There was a problem hiding this comment.
Most of these declarations should IMHO go into the arrow::filesystem::internal namespace, except for HdfsConnectionConfig which can go into arrow::filesystem.
|
Hi @pitrou, could you please take a quick look at the changes when you have a moment? I've done my best to implement the suggested changes, but am sure there's still room for improvement.
The Python and MATLAB test failures are not related. |
|
Hi @AlenkaF
I think you're misreading the output, the test is actually skipped when the driver fails unloading, which is normal: https://github.com/apache/arrow/actions/runs/15109276550/job/42464862030?pr=45998#step:7:3277 The problem is in the other tests, because it seems a destructor crashes: https://github.com/apache/arrow/actions/runs/15109276550/job/42464862030?pr=45998#step:7:3281 |
Hmm, rather than trying to find the exact explanation, a simple solution would be to change these functions into static methods, for example this: ARROW_EXPORT Status MakeReadableFile(const std::string& path, int32_t buffer_size,
const io::IOContext& io_context, LibHdfsShim* driver,
hdfsFS fs, hdfsFile file,
std::shared_ptr<HdfsReadableFile>* out);would become: class ARROW_EXPORT HdfsReadableFile : public RandomAccessFile {
public:
(...)
static Result<std::shared_ptr<HdfsReadableFile>> Make(
const std::string& path, int32_t buffer_size,
const io::IOContext& io_context, LibHdfsShim* driver,
hdfsFS fs, hdfsFile file); |
|
Aha, I see! Thanks, will look into it. |
|
@pitrou I cleaned up the CI failures (others are not related) and am hoping this changes will not be too bad to review :) |
72eae6e to
7810940
Compare
benibus
left a comment
There was a problem hiding this comment.
Thanks! This looks pretty good to me. Just a few comments.
c7beefc to
281b51a
Compare
|
@pitrou gentle ping. Would I be too optimistic to try to get it into 21.0.0? |
|
@github-actions crossbow submit test-hdfs |
|
There was a problem hiding this comment.
🔵 Needs a closer look
The refactor introduces a deletion-path bug (URI vs in-filesystem paths) and a couple of build/API issues that should be corrected before merge.
Review details
Suppressed comments (3)
Previously missed (2) — in code that hasn't changed since the last review.
cpp/src/arrow/filesystem/hdfs_internal.cc:39
- hdfs_internal.cc uses std::min and std::numeric_limits (in the newly added HdfsReadableFile/HdfsOutputStream code) but doesn't include or . This relies on transitive includes and can break builds as headers change.
cpp/src/arrow/filesystem/hdfs.cc:340 - GetChildren() returns the raw HDFS entry name (an absolute "hdfs://..." URI per StatSelector's comment), but DeleteDirContents() later passes those strings to Delete(). This contradicts the earlier guard that in-filesystem APIs must not be passed URIs and can lead to incorrect behavior when deleting directory contents.
cpp/src/arrow/filesystem/hdfs.h:58
- HdfsOptions::extra_conf() returns the unordered_map by value, which forces an extra copy on each call (including in HadoopFileSystem::Impl::Init and in the Python bindings). Returning a const reference avoids the copy but would also require updating the Cython declaration in python/pyarrow/includes/libarrow_fs.pxd.
const std::string& host() const { return host_; }
int port() const { return port_; }
const std::string& user() const { return user_; }
const std::string& kerb_ticket() const { return kerb_ticket_; }
std::unordered_map<std::string, std::string> extra_conf() const { return extra_conf_; }
- Files reviewed: 19/19 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
@github-actions crossbow submit test-hdfs |
|
Revision: 0625e9e Submitted crossbow builds: ursacomputing/crossbow @ actions-0d69c54052
|
…he extra_conf situation
|
I added a fix for the 3rd item in last comment from Copilot, connected to (1st and 2nd items seem like they are dealing with an existing behavior and can be fixed as a follow-up in a separate PR) |
|
@github-actions crossbow submit test-hdfs |
|
Revision: 2741e3f Submitted crossbow builds: ursacomputing/crossbow @ actions-aab95289e3
|
There was a problem hiding this comment.
🟡 Changes recommended
There are build-breaking issues in the updated bindings/implementation (Cython signature typo and missing standard headers for newly moved C++ code).
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
cpp/src/arrow/filesystem/hdfs_internal.cc:34
hdfs_internal.ccnow contains code usingstd::numeric_limitsandstd::min(in the moved HdfsReadableFile/HdfsOutputStream implementations), but it doesn't include<limits>/<algorithm>. This can break compilation depending on transitive includes.
- Files reviewed: 19/19 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
There is a compile-breaking namespace/lookup issue in cpp/src/arrow/filesystem/hdfs_internal.cc (and related header hygiene) that must be fixed before merging.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
cpp/src/arrow/filesystem/hdfs_internal.cc:37
- This file uses
std::min/std::numeric_limitsin the newly added HDFS file implementations but doesn't include<algorithm>/<limits>directly. Relying on transitive includes is fragile and can break under different standard library/IWYU configurations; add the missing standard headers here.
cpp/src/arrow/filesystem/hdfs_internal.cc:674
GetPathInfoFailedis defined in an anonymous namespace insidearrow::fs::internal, so it isn't reachable asinternal::GetPathInfoFailedfromnamespace arrow::fs. This should fail to compile (no such symbol). Inline theIOErrorFromErrnocall here (or move the helper intoarrow::fs::internalwith external linkage).
- Files reviewed: 19/19 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
OK, this is ready. CI and
|
Rationale for this change
ObjectTypeandFileStatisticsin io/hdfs.h have been deprecated for a while and can be removed.What changes are included in this PR?
ObjectTypeandFileStatisticsstructs are removed and instead FileSystem API inarrow::fsis used. Together with this change, the hdfs connected code is moved fromcpp/src/arrow/iotocpp/src/arrow/filesystemmergingFileSystemandHadoopFileSystemclasses fromarrow::iointo the publicHadoopFileSystemclass.Are these changes tested?
Existing tests should pass.
Are there any user-facing changes?
Deprecated structs are removed and all hdfs related code is now a part of the filesystem module.
Also closes: #22457 (not sure about
io/interfaces.h?)