-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plan generation demo.
- Loading branch information
Orri Erling
committed
Nov 23, 2024
1 parent
bf3fba7
commit 883b71e
Showing
47 changed files
with
10,219 additions
and
29 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
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,63 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* 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 | ||
|
||
#include <vector> | ||
#include "velox/common/base/BitUtil.h" | ||
#include "velox/common/memory/HashStringAllocator.h" | ||
|
||
namespace facebook::verax { | ||
|
||
class ArenaCache { | ||
static constexpr int32_t kMaxSize = 512; | ||
static constexpr int32_t kGranularity = 16; | ||
|
||
public: | ||
explicit ArenaCache(velox::HashStringAllocator& allocator) | ||
: allocator_(allocator), allocated_(kMaxSize / kGranularity) {} | ||
|
||
void* allocate(size_t size) { | ||
auto roundedSize = velox::bits::roundUp(size, kGranularity) / kGranularity; | ||
if (roundedSize < kMaxSize / kGranularity) { | ||
if (!allocated_[roundedSize].empty()) { | ||
void* result = allocated_[roundedSize].back(); | ||
allocated_[roundedSize].pop_back(); | ||
totalSize_ -= roundedSize; | ||
return result; | ||
} | ||
} | ||
return allocator_.allocate(size)->begin(); | ||
} | ||
|
||
void free(void* ptr) { | ||
auto header = velox::HashStringAllocator::headerOf(ptr); | ||
int32_t size = header->size() / kGranularity; | ||
if (size < kMaxSize / kGranularity) { | ||
totalSize_ += size; | ||
allocated_[size].push_back(ptr); | ||
return; | ||
} | ||
allocator_.free(header); | ||
} | ||
|
||
private: | ||
velox::HashStringAllocator& allocator_; | ||
std::vector<std::vector<void*>> allocated_; | ||
uint64_t totalSize_{0}; | ||
}; | ||
|
||
} // namespace facebook::verax |
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 (c) Facebook, Inc. and its affiliates. | ||
# | ||
# 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. | ||
|
||
add_subdirectory(tests) | ||
|
||
add_library( | ||
velox_verax | ||
ToGraph.cpp | ||
Plan.cpp | ||
QueryGraph.cpp | ||
Filters.cpp | ||
Cost.cpp | ||
PlanUtils.cpp | ||
RelationOp.cpp | ||
ToVelox.cpp | ||
VeloxHistory.cpp) | ||
|
||
add_dependencies(velox_verax velox_hive_connector) | ||
|
||
target_link_libraries( | ||
velox_verax velox_core velox_hive_connector velox_dwio_dwrf_proto) |
Oops, something went wrong.