-
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
Dec 4, 2024
1 parent
86d6f33
commit 0c0f801
Showing
51 changed files
with
10,250 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
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::velox::optimizer { | ||
|
||
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 sizeClass = velox::bits::roundUp(size, kGranularity) / kGranularity; | ||
if (sizeClass < kMaxSize / kGranularity) { | ||
if (!allocated_[sizeClass].empty()) { | ||
void* result = allocated_[sizeClass].back(); | ||
allocated_[sizeClass].pop_back(); | ||
totalSize_ -= sizeClass; | ||
return result; | ||
} | ||
} | ||
return allocator_.allocate(sizeClass * kGranularity)->begin(); | ||
} | ||
|
||
void free(void* ptr) { | ||
auto header = velox::HashStringAllocator::headerOf(ptr); | ||
int32_t sizeClass = header->size() / kGranularity; | ||
if (sizeClass < kMaxSize / kGranularity) { | ||
totalSize_ += sizeClass; | ||
allocated_[sizeClass].push_back(ptr); | ||
return; | ||
} | ||
allocator_.free(header); | ||
} | ||
|
||
private: | ||
velox::HashStringAllocator& allocator_; | ||
std::vector<std::vector<void*>> allocated_; | ||
uint64_t totalSize_{0}; | ||
}; | ||
|
||
} // namespace facebook::velox::optimizer |
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,35 @@ | ||
# 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 | ||
PlanObject.cpp | ||
Schema.cpp | ||
QueryGraph.cpp | ||
QueryGraphContext.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.