Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 5 additions & 3 deletions presto-native-execution/presto_cpp/main/PrestoServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ void PrestoServer::run() {
<< "': threads: " << pGlobalIOExecutor->numActiveThreads() << "/"
<< pGlobalIOExecutor->numThreads();
}

PRESTO_SHUTDOWN_LOG(INFO) << "Release resources in AsyncDataCache";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PRESTO_SHUTDOWN_LOG(INFO) << "Shutdown AsyncDataCache";

cache_->prepareShutdown();
}

void PrestoServer::yieldTasks() {
Expand Down Expand Up @@ -492,9 +495,8 @@ void PrestoServer::initializeVeloxMemory() {
asyncCacheSsdCheckpointGb << 30,
asyncCacheSsdDisableFileCow);
}
cache_ = std::make_shared<cache::AsyncDataCache>(
allocator_, memoryBytes, std::move(ssd));
allocator_ = cache_;
cache_ = cache::AsyncDataCache::create(allocator_.get(), std::move(ssd));
cache::AsyncDataCache::setInstance(cache_.get());
} else {
VELOX_CHECK_EQ(
systemConfig->asyncCacheSsdGb(),
Expand Down
11 changes: 3 additions & 8 deletions presto-native-execution/presto_cpp/main/PrestoServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,12 @@ class PrestoServer {
// Executor for exchange data over http.
std::shared_ptr<folly::IOThreadPoolExecutor> exchangeExecutor_;

// If not null, the instance of AsyncDataCache used for in-memory file cache.
std::shared_ptr<velox::cache::AsyncDataCache> cache_;

// Instance of MemoryAllocator used for all query memory allocations.
//
// NOTE: AsyncDataCache implements MemoryAllocator interface and wraps on top
// of a real memory allocator for the actual memory allocation. So if 'cache_'
// has been set, 'allocator_' is also set to 'cache_'. It provides memory
// allocations for both file cache and query memory.
std::shared_ptr<velox::memory::MemoryAllocator> allocator_;

// If not null, the instance of AsyncDataCache used for in-memory file cache.
std::shared_ptr<velox::cache::AsyncDataCache> cache_;

std::unique_ptr<http::HttpServer> httpServer_;
std::unique_ptr<SignalHandler> signalHandler_;
std::unique_ptr<Announcer> announcer_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ std::shared_ptr<core::QueryCtx> QueryContextManager::findOrCreateQueryCtx(
executor().get(),
std::move(configStrings),
connectorConfigs,
memory::MemoryAllocator::getInstance(),
cache::AsyncDataCache::getInstance(),
std::move(pool),
spillExecutor(),
queryId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2574,9 +2574,9 @@ core::PlanFragment VeloxQueryPlanConverterBase::toVeloxQueryPlan(
planFragment.planNode =
std::make_shared<core::PartitionedOutputNode>(
"root",
core::PartitionedOutputNode::Kind::kPartitioned,
partitioningKeys,
numPartitions,
core::PartitionedOutputNode::Kind::kPartitioned,
partitioningScheme.replicateNullsAndAny,
std::make_shared<RoundRobinPartitionFunctionSpec>(),
outputType,
Expand All @@ -2594,9 +2594,9 @@ core::PlanFragment VeloxQueryPlanConverterBase::toVeloxQueryPlan(
planFragment.planNode =
std::make_shared<core::PartitionedOutputNode>(
"root",
core::PartitionedOutputNode::Kind::kPartitioned,
partitioningKeys,
numPartitions,
core::PartitionedOutputNode::Kind::kPartitioned,
partitioningScheme.replicateNullsAndAny,
std::make_shared<HashPartitionFunctionSpec>(
inputType, keyChannels, constValues),
Expand Down Expand Up @@ -2642,9 +2642,9 @@ core::PlanFragment VeloxQueryPlanConverterBase::toVeloxQueryPlan(

planFragment.planNode = std::make_shared<core::PartitionedOutputNode>(
"root",
core::PartitionedOutputNode::Kind::kPartitioned,
partitioningKeys,
numPartitions,
core::PartitionedOutputNode::Kind::kPartitioned,
partitioningScheme.replicateNullsAndAny,
std::make_shared<HivePartitionFunctionSpec>(
hivePartitioningHandle->bucketCount,
Expand Down
2 changes: 1 addition & 1 deletion presto-native-execution/velox
Submodule velox updated 84 files
+1 −1 build/deps/github_hashes/facebook/folly-rev.txt
+1 −1 scripts/setup-macos.sh
+8 −4 velox/benchmarks/basic/CastBenchmark.cpp
+14 −10 velox/benchmarks/tpch/TpchBenchmark.cpp
+41 −57 velox/common/caching/AsyncDataCache.cpp
+67 −112 velox/common/caching/AsyncDataCache.h
+15 −10 velox/common/caching/tests/AsyncDataCacheTest.cpp
+4 −2 velox/common/caching/tests/SsdFileTest.cpp
+36 −0 velox/common/compression/Compression.cpp
+5 −0 velox/common/compression/Compression.h
+13 −1 velox/common/compression/tests/CompressionTest.cpp
+25 −4 velox/common/memory/MallocAllocator.cpp
+31 −34 velox/common/memory/MallocAllocator.h
+67 −0 velox/common/memory/MemoryAllocator.cpp
+82 −23 velox/common/memory/MemoryAllocator.h
+27 −5 velox/common/memory/MmapAllocator.cpp
+42 −41 velox/common/memory/MmapAllocator.h
+7 −6 velox/common/memory/tests/MemoryPoolTest.cpp
+1 −1 velox/common/memory/tests/SharedArbitratorTest.cpp
+6 −7 velox/connectors/Connector.h
+4 −3 velox/connectors/hive/HiveConnector.h
+8 −6 velox/connectors/hive/HiveDataSource.cpp
+2 −3 velox/connectors/hive/HiveDataSource.h
+1 −0 velox/core/CMakeLists.txt
+23 −18 velox/core/PlanNode.cpp
+59 −11 velox/core/PlanNode.h
+4 −4 velox/core/QueryCtx.cpp
+6 −8 velox/core/QueryCtx.h
+2 −2 velox/docs/configs.rst
+5 −0 velox/docs/functions/presto/math.rst
+2 −0 velox/docs/functions/spark/string.rst
+3 −2 velox/dwio/common/CachedBufferedInput.cpp
+7 −5 velox/dwio/dwrf/test/CacheInputTest.cpp
+41 −0 velox/dwio/parquet/tests/reader/ParquetTableScanTest.cpp
+2 −2 velox/examples/CMakeLists.txt
+11 −2 velox/exec/AggregateWindow.cpp
+0 −3 velox/exec/GroupingSet.cpp
+1 −1 velox/exec/Operator.cpp
+7 −4 velox/exec/PartitionedOutput.cpp
+7 −7 velox/exec/PartitionedOutput.h
+15 −6 velox/exec/PartitionedOutputBufferManager.cpp
+19 −10 velox/exec/RowNumber.cpp
+1 −0 velox/exec/RowNumber.h
+3 −1 velox/exec/Spill.cpp
+27 −22 velox/exec/tests/PartitionedOutputBufferManagerTest.cpp
+21 −0 velox/exec/tests/PlanNodeSerdeTest.cpp
+34 −0 velox/exec/tests/PlanNodeToStringTest.cpp
+66 −3 velox/exec/tests/RowNumberTest.cpp
+40 −31 velox/exec/tests/StreamingAggregationTest.cpp
+1 −2 velox/exec/tests/TableScanTest.cpp
+1 −1 velox/exec/tests/ThreadDebugInfoTest.cpp
+1 −1 velox/exec/tests/utils/AssertQueryBuilder.cpp
+1 −1 velox/exec/tests/utils/Cursor.cpp
+16 −14 velox/exec/tests/utils/OperatorTestBase.cpp
+7 −2 velox/exec/tests/utils/OperatorTestBase.h
+12 −3 velox/exec/tests/utils/PlanBuilder.cpp
+2 −1 velox/exec/tests/utils/PlanBuilder.h
+322 −0 velox/expression/CastExpr-inl.h
+135 −303 velox/expression/CastExpr.cpp
+108 −3 velox/expression/CastExpr.h
+17 −0 velox/expression/EvalCtx.cpp
+7 −0 velox/expression/EvalCtx.h
+5 −7 velox/expression/ExprCompiler.cpp
+1 −0 velox/expression/FunctionCallToSpecialForm.cpp
+179 −15 velox/expression/tests/CastExprTest.cpp
+18 −1 velox/expression/tests/ExpressionVerifier.cpp
+3 −0 velox/functions/lib/RowsTranslationUtil.h
+0 −31 velox/functions/prestosql/ArrayFunctions.h
+14 −0 velox/functions/prestosql/Probability.h
+50 −0 velox/functions/prestosql/SIMDJsonFunctions.h
+47 −0 velox/functions/prestosql/benchmarks/JsonExprBenchmark.cpp
+2 −0 velox/functions/prestosql/registration/ArithmeticFunctionsRegistration.cpp
+0 −5 velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp
+2 −2 velox/functions/prestosql/registration/JsonFunctionsRegistration.cpp
+15 −0 velox/functions/prestosql/tests/ProbabilityTest.cpp
+16 −5 velox/functions/sparksql/String.h
+9 −4 velox/functions/sparksql/tests/StringTest.cpp
+15 −13 velox/row/CompactRow.cpp
+216 −157 velox/row/benchmark/UnsafeRowSerializeBenchmark.cpp
+12 −10 velox/row/tests/CompactRowTest.cpp
+1 −1 velox/serializers/CMakeLists.txt
+145 −26 velox/serializers/PrestoSerializer.cpp
+11 −2 velox/serializers/PrestoSerializer.h
+67 −32 velox/serializers/tests/PrestoSerializerTest.cpp