Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine/bsql_engine/io/cio.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ cdef extern from "../include/io/io.h" nogil:
bool useDefaultAdcJsonFile
string adcJsonFile


vector[string] list_files(string path) except +
pair[bool, string] registerFileSystemHDFS(HDFS hdfs, string root, string authority) except +raiseRegisterFileSystemHDFSError
pair[bool, string] registerFileSystemGCS( GCS gcs, string root, string authority) except +raiseRegisterFileSystemGCSError
pair[bool, string] registerFileSystemS3( S3 s3, string root, string authority) except +raiseRegisterFileSystemS3Error
Expand Down
10 changes: 10 additions & 0 deletions engine/bsql_engine/io/io.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,16 @@ cdef class PyBlazingCache:
df._rename_columns(decoded_names)
return df, metadata_py



cpdef list_files_caller(path):
cdef vector[string] files = cio.list_files(path.encode())
decoded_names = []
for i in range(files.size()):
decoded_names.append(files[i].decode('utf-8'))
return decoded_names


cpdef initializeCaller(int ralId, string worker_id, int gpuId, string network_iface_name, int ralCommunicationPort, vector[NodeMetaDataUCP] workers_ucp_info,
bool singleNode, map[string,string] config_options, string allocation_mode, size_t initial_pool_size, size_t maximum_pool_size, bool enable_logging):
init_output = initializePython( ralId, worker_id, gpuId, network_iface_name, ralCommunicationPort, workers_ucp_info, singleNode, config_options,
Expand Down
2 changes: 2 additions & 0 deletions engine/include/io/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,6 @@ std::pair<std::pair<bool, std::string>, error_code_t> registerFileSystemGCS_C(GC
std::pair<std::pair<bool, std::string>, error_code_t> registerFileSystemS3_C(S3 s3, std::string root, std::string authority);
std::pair<std::pair<bool, std::string>, error_code_t> registerFileSystemLocal_C(std::string root, std::string authority);

std::vector<std::string> list_files(std::string path);

} // extern "C"
9 changes: 9 additions & 0 deletions engine/src/cython/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,12 @@ std::pair<std::pair<bool, std::string>, error_code_t> registerFileSystemLocal_C(
return std::make_pair(result, E_EXCEPTION);
}
}

std::vector<std::string> list_files(std::string path){
auto uri = Uri(path);
auto files = BlazingContext::getInstance()->getFileSystemManager()->listResourceNames(uri);
for(auto file : files){
std::cout<<file<<std::endl;
}
return files;
}
4 changes: 2 additions & 2 deletions io/src/FileSystem/private/LocalFileSystem_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ std::vector<std::string> LocalFileSystem::Private::listResourceNames(
if(skip) {
continue;
}

const bool pass = WildcardFilter::match(name, finalWildcard);
const Path listedPath = uriWithRoot.getPath() + name;
const bool pass = WildcardFilter::match(listedPath.toString(), finalWildcard);

if(pass) {
response.push_back(name);
Expand Down