Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ And the following operating systems:
The following packages are required:

- CMake 3.23.0+
- Clang 17.0.0+ under Linux or AppleClang 14.0.0+ under MacOS
- Clang 17.0.0+
- Rust
- Python 3.0+
- Ninja-Build or GNU Make
Expand Down Expand Up @@ -123,11 +123,7 @@ xcode-select --install

# Install other dependencies
brew install ninja cmake [email protected] ccache
```

If your MacOS is higher or equal to 13.0 (Ventura), it should work out of the box because by default Xcode 14.3 provides Apple clang 14.0.0. But if your MacOS is lower than 13.0, you should install llvm clang manually.

```shell
brew install llvm@17

# check llvm version
Expand Down Expand Up @@ -163,17 +159,17 @@ In MacOS, if you install llvm clang, you need to explicitly specify to use llvm

Add the following lines to your shell environment, e.g. `~/.bash_profile`.
```shell
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export CC="/opt/homebrew/opt/llvm/bin/clang"
export CXX="/opt/homebrew/opt/llvm/bin/clang++"
export PATH="$(brew --prefix)/opt/llvm/bin:$PATH"
export CC="$(brew --prefix)/opt/llvm/bin/clang"
export CXX="$(brew --prefix)/opt/llvm/bin/clang++"
```

Or use `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER` to specify the compiler, like this:
```shell
mkdir cmake-build-debug
cd cmake-build-debug

cmake .. -GNinja -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++
cmake .. -GNinja -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER="$(brew --prefix)/opt/llvm/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix)/opt/llvm/bin/clang++"

ninja tiflash
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ std::tuple<Block, size_t> DMFileWithVectorIndexBlockInputStream::readByIndexRead

auto begin = std::lower_bound(sorted_results.cbegin(), sorted_results.cend(), block_start_row_id);
auto end = std::lower_bound(begin, sorted_results.cend(), index_reader_next_row_id);
const std::span<const VectorIndexViewer::Key> block_selected_rows{
&*begin,
static_cast<size_t>(std::distance(begin, end))};
const std::span block_selected_rows{begin, end};
vec_index_reader->read(vec_column, block_selected_rows, block_start_row_id, read_rows);

block.insert(ColumnWithTypeAndName{std::move(vec_column), vec_cd.type, vec_cd.name, vec_cd.id});
Expand Down Expand Up @@ -200,9 +198,7 @@ std::tuple<Block, size_t> DMFileWithVectorIndexBlockInputStream::readByFollowing
// Then read from vector index for the same pack.
auto begin = std::lower_bound(sorted_results.cbegin(), sorted_results.cend(), block_others.startOffset());
auto end = std::lower_bound(begin, sorted_results.cend(), block_others.startOffset() + read_rows);
const std::span<const VectorIndexViewer::Key> block_selected_rows{
&*begin,
static_cast<size_t>(std::distance(begin, end))};
const std::span block_selected_rows{begin, end};
vec_index_reader->read(vec_column, block_selected_rows, block_others.startOffset(), read_rows);

// Re-assemble block using the same layout as header.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ std::vector<VectorIndexViewer::SearchResult> VectorIndexHNSWViewer::searchWithDi
{
const auto rowid = result[i].member.key;
if (valid_rows[rowid])
search_results.push_back({rowid, result[i].distance});
search_results.emplace_back(rowid, result[i].distance);
}
return search_results;
}
Expand Down
6 changes: 6 additions & 0 deletions release-darwin/build/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ if [ -d "$install_dir" ]; then rm -rf "${install_dir:?}"/*; else mkdir -p "$inst
build_dir="$SRCPATH/release-darwin/build-release"
rm -rf $build_dir && mkdir -p $build_dir && cd $build_dir

# use llvm@17
export PATH="$(brew --prefix)/opt/llvm@17/bin:$PATH"
export CC="$(brew --prefix)/opt/llvm@17/bin/clang"
export CXX="$(brew --prefix)/opt/llvm@17/bin/clang++"

cmake "$SRCPATH" \
-GNinja \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-DUSE_INTERNAL_SSL_LIBRARY=ON \
-Wno-dev \
Expand Down
19 changes: 19 additions & 0 deletions release-darwin/prepare-environments/prepare-llvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Copyright 2023 PingCAP, Inc.
#
# 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.

set -ueox pipefail

brew install ninja
brew install llvm@17