From 3fe31693ec16285ccc64a99a077126dea5753e02 Mon Sep 17 00:00:00 2001 From: Yingfeng Zhang Date: Thu, 21 Dec 2023 17:13:46 +0800 Subject: [PATCH 1/2] Several minor updates --- .../fulltext/fulltext_import_benchmark.cpp | 7 +++-- src/parser/type/complex/embedding_type.h | 30 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/benchmark/local_infinity/fulltext/fulltext_import_benchmark.cpp b/benchmark/local_infinity/fulltext/fulltext_import_benchmark.cpp index 52bd05519b..15a6e033c0 100644 --- a/benchmark/local_infinity/fulltext/fulltext_import_benchmark.cpp +++ b/benchmark/local_infinity/fulltext/fulltext_import_benchmark.cpp @@ -102,9 +102,10 @@ int main() { } auto r = table->CreateIndex(index_name, index_info_list, CreateIndexOptions()); - if (!r.IsOk()) { - std::cout << "Create index failed: " << r.ToString() << std::endl; - return 1; + if (r.IsOk()) { + r = infinity->Flush(); + } else { + std::cout << "Fail to create index." << r.ToString() << std::endl; } std::cout << "Create index cost: " << profiler.ElapsedToString(); profiler.End(); diff --git a/src/parser/type/complex/embedding_type.h b/src/parser/type/complex/embedding_type.h index 9b95f2a794..6b54c9d570 100644 --- a/src/parser/type/complex/embedding_type.h +++ b/src/parser/type/complex/embedding_type.h @@ -142,22 +142,20 @@ struct EmbeddingType { return ss.str(); } -// template <> -// inline std::string Embedding2StringInternal(const EmbeddingType &embedding, size_t dimension) { -// char buf[6 * dimension * 2]; -// std::stringstream ss(buf, std::ios::in | std::ios::out | std::ios::binary); -// for (size_t i = 0; i < dimension - 1; ++i) { -// char buffer[20]; -// auto [ptr, ec] = std::to_chars(buffer, buffer + sizeof(buffer), ((float *)(embedding.ptr))[i], std::chars_format::general, 6); -// ss.write((const char *)buffer, ptr - buffer); -// ss.put(','); -// } -// char buffer[20]; -// auto [ptr, ec] = std::to_chars(buffer, buffer + sizeof(buffer), ((float *)(embedding.ptr))[dimension - 1], std::chars_format::general, 6); -// ss.write((const char *)buffer, ptr - buffer); -// return ss.str(); - -// } + template <> + inline std::string Embedding2StringInternal(const EmbeddingType &embedding, size_t dimension) { + std::stringstream ss; + for (size_t i = 0; i < dimension - 1; ++i) { + char buffer[20]; + auto [ptr, ec] = std::to_chars(buffer, buffer + sizeof(buffer), ((float *)(embedding.ptr))[i], std::chars_format::general, 6); + ss.write((const char *)buffer, ptr - buffer); + ss.put(','); + } + char buffer[20]; + auto [ptr, ec] = std::to_chars(buffer, buffer + sizeof(buffer), ((float *)(embedding.ptr))[dimension - 1], std::chars_format::general, 6); + ss.write((const char *)buffer, ptr - buffer); + return ss.str(); + } [[nodiscard]] static inline std::string BitmapEmbedding2StringInternal(const EmbeddingType &embedding, size_t dimension) { // TODO: This is for bitmap, and high-performance implementation is needed here. From b8d02933264e918cba71f88282ec64ed2a889718 Mon Sep 17 00:00:00 2001 From: Yingfeng Zhang Date: Mon, 25 Dec 2023 11:31:46 +0800 Subject: [PATCH 2/2] Add some templates --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 10 ++++++++++ .github/ISSUE_TEMPLATE/subtask.md | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/subtask.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index af5e813030..24d2cea47d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug report about: Create a report to help us improve -title: '' +title: '[Bug]: ' labels: '' assignees: '' diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..250b354741 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,10 @@ +--- +name: Feature request +title: '[Feature Request]: ' +about: Suggest an idea for Infinity +labels: '' +--- + +**Summary** + +Description for this feature. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/subtask.md b/.github/ISSUE_TEMPLATE/subtask.md new file mode 100644 index 0000000000..3d7ef50367 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/subtask.md @@ -0,0 +1,10 @@ +--- +name: Subtask +title: '[Subtask]: ' +about: Subtask of an issue +labels: '' +--- + +**Summary** + +Description for this subtask. \ No newline at end of file