-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ted Xu <ted.xu@zilliz.com>
- Loading branch information
Showing
16 changed files
with
375 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2023 Zilliz | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <arrow/c/abi.h> | ||
|
||
typedef void* CReader; | ||
typedef void* CStatus; | ||
typedef void* CRecordBatch; | ||
typedef void* CFileSystem; | ||
|
||
int Open(const char* path, struct ArrowSchema* schema, const int64_t buffer_size, struct ArrowArrayStream* out); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@ | ||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ | ||
|
||
Name: Milvus Storage | ||
Description: Milvus Storage | ||
Version: @PROJECT_VERSION@ | ||
|
||
Libs: -L${libdir} -lstorage | ||
Cflags: -I${includedir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2023 Zilliz | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "packed/reader_c.h" | ||
#include "common/log.h" | ||
#include "packed/reader.h" | ||
#include "filesystem/fs.h" | ||
#include "common/config.h" | ||
|
||
#include <arrow/c/bridge.h> | ||
#include <arrow/filesystem/filesystem.h> | ||
#include <arrow/status.h> | ||
#include <iostream> | ||
#include <memory> | ||
|
||
int Open(const char* path, struct ArrowSchema* schema, const int64_t buffer_size, struct ArrowArrayStream* out) { | ||
auto truePath = std::string(path); | ||
auto factory = std::make_shared<milvus_storage::FileSystemFactory>(); | ||
auto conf = milvus_storage::StorageConfig(); | ||
conf.uri = "file:///tmp/"; | ||
auto r = factory->BuildFileSystem(conf, &truePath); | ||
if (!r.ok()) { | ||
LOG_STORAGE_ERROR_ << "Error building filesystem: " << path; | ||
return -2; | ||
} | ||
auto trueFs = r.value(); | ||
auto trueSchema = arrow::ImportSchema(schema).ValueOrDie(); | ||
auto reader = std::make_shared<milvus_storage::PackedRecordBatchReader>(*trueFs, path, trueSchema, buffer_size); | ||
auto status = ExportRecordBatchReader(reader, out); | ||
LOG_STORAGE_ERROR_ << "read export done"; | ||
if (!status.ok()) { | ||
LOG_STORAGE_ERROR_ << "Error exporting record batch reader" << status.ToString(); | ||
return static_cast<int>(status.code()); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.