Commit c54a787a authored by starlord's avatar starlord
Browse files

format knowhere code


Former-commit-id: eb06e117c192b568d9da3a33d94faa127e7cf0b7
parent 5fb4c8b8
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -6,4 +6,3 @@
*easylogging++*
*SqliteMetaImpl.cpp
*src/grpc*
 No newline at end of file
*src/core*
 No newline at end of file
+13 −14
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@
// specific language governing permissions and limitations
// under the License.


#include "ArrowAdapter.h"
#include "knowhere/adapter/ArrowAdapter.h"

namespace zilliz {
namespace knowhere {
@@ -36,7 +35,8 @@ CopyArray(const ArrayPtr &origin) {
        DEFINE_TYPE(DECIMAL, Decimal128Array)
        DEFINE_TYPE(FLOAT, NumericArray<arrow::FloatType>)
        DEFINE_TYPE(INT64, NumericArray<arrow::Int64Type>)
        default:break;
        default:
            break;
    }
    return copy;
}
@@ -51,6 +51,5 @@ CopySchema(const SchemaPtr &origin) {
    return std::make_shared<Schema>(std::move(fields));
}


}  // namespace knowhere
}  // namespace zilliz
+6 −6
Original line number Diff line number Diff line
@@ -15,14 +15,14 @@
// specific language governing permissions and limitations
// under the License.


#pragma once

#include <memory>
#include <utility>
#include <vector>

#include "knowhere/common/Array.h"


namespace zilliz {
namespace knowhere {

+26 −33
Original line number Diff line number Diff line
@@ -15,15 +15,13 @@
// specific language governing permissions and limitations
// under the License.

#include "knowhere/adapter/SptagAdapter.h"
#include "knowhere/adapter/Structure.h"
#include "knowhere/index/vector_index/helpers/Definitions.h"
#include "SptagAdapter.h"
#include "Structure.h"


namespace zilliz {
namespace knowhere {


std::shared_ptr<SPTAG::MetadataSet>
ConvertToMetadataSet(const DatasetPtr& dataset) {
    auto array = dataset->array()[0];
@@ -31,14 +29,11 @@ ConvertToMetadataSet(const DatasetPtr &dataset) {

    auto p_data = array->data()->GetValues<int64_t>(1, 0);
    auto p_offset = (int64_t*)malloc(sizeof(int64_t) * elems);
    for (auto i = 0; i <= elems; ++i)
        p_offset[i] = i * 8;

    std::shared_ptr<SPTAG::MetadataSet> metaset(new SPTAG::MemMetadataSet(
        SPTAG::ByteArray((std::uint8_t *) p_data, elems * sizeof(int64_t), false),
        SPTAG::ByteArray((std::uint8_t *) p_offset, elems * sizeof(int64_t), true),
        elems));
    for (auto i = 0; i <= elems; ++i) p_offset[i] = i * 8;

    std::shared_ptr<SPTAG::MetadataSet> metaset(
        new SPTAG::MemMetadataSet(SPTAG::ByteArray((std::uint8_t*)p_data, elems * sizeof(int64_t), false),
                                  SPTAG::ByteArray((std::uint8_t*)p_offset, elems * sizeof(int64_t), true), elems));

    return metaset;
}
@@ -54,10 +49,8 @@ ConvertToVectorSet(const DatasetPtr &dataset) {

    SPTAG::ByteArray byte_array(p_data, num_bytes, false);

    auto vectorset = std::make_shared<SPTAG::BasicVectorSet>(byte_array,
                                                             SPTAG::VectorValueType::Float,
                                                             dimension,
                                                             rows);
    auto vectorset =
        std::make_shared<SPTAG::BasicVectorSet>(byte_array, SPTAG::VectorValueType::Float, dimension, rows);
    return vectorset;
}

+7 −8
Original line number Diff line number Diff line
@@ -15,12 +15,11 @@
// specific language governing permissions and limitations
// under the License.


#pragma once

#include <memory>

#include <SPTAG/AnnService/inc/Core/VectorIndex.h>
#include <memory>
#include <vector>

#include "knowhere/common/Dataset.h"

Loading