Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: velox-sdk part of planbuilder #11479

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ option(VELOX_ENABLE_PARQUET "Enable Parquet support" OFF)
option(VELOX_ENABLE_ARROW "Enable Arrow support" OFF)
option(VELOX_ENABLE_REMOTE_FUNCTIONS "Enable remote function support" OFF)
option(VELOX_ENABLE_CCACHE "Use ccache if installed." ON)
option(VELOX_ENABLE_SDK "Enable SDK support." ON)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not immediately clear what we mean by "SDK" here. Maybe "VELOX_ENABLE_JNI_BINDINGS" could be more explicit?

Copy link
Contributor

Choose a reason for hiding this comment

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

we could use velox/jni as the base dir


option(VELOX_BUILD_TEST_UTILS "Builds Velox test utilities" OFF)
option(VELOX_BUILD_VECTOR_TEST_UTILS "Builds Velox vector test utilities" OFF)
Expand Down
4 changes: 4 additions & 0 deletions velox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ endif()
if(${VELOX_BUILD_TESTING})
add_subdirectory(tool)
endif()

if(${VELOX_ENABLE_SDK})
add_subdirectory(sdk)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: missing new line

5 changes: 3 additions & 2 deletions velox/common/memory/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ class MemoryManager {
const std::vector<std::shared_ptr<MemoryPool>>& testingSharedLeafPools() {
return sharedLeafPools_;
}

// Returns the shared references to all the alive memory pools in 'pools_'.
std::vector<std::shared_ptr<MemoryPool>> getAlivePools() const;

private:
std::shared_ptr<MemoryPoolImpl> createRootPool(
Expand All @@ -291,8 +294,6 @@ class MemoryManager {

void dropPool(MemoryPool* pool);

// Returns the shared references to all the alive memory pools in 'pools_'.
std::vector<std::shared_ptr<MemoryPool>> getAlivePools() const;

const std::shared_ptr<MemoryAllocator> allocator_;

Expand Down
51 changes: 51 additions & 0 deletions velox/sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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.


find_package(JNI REQUIRED)

if (VELOX_ENABLE_SDK_DEBUG)
add_definitions(-DVELOX_ENABLE_SDK_DEBUG)
endif ()
include_directories(${JNI_INCLUDE_DIRS})
Copy link
Collaborator

Choose a reason for hiding this comment

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

use targets


velox_add_library(sdk SHARED
cpp/jni/VeloxJniWrapper.cc
cpp/jni/JniErrors.cc
cpp/jni/JniUtil.cc
cpp/native/NativePlanBuilder.cc
cpp/native/NativeClass.cc
cpp/memory/MemoryManager.cpp
cpp/memory/NativeMemoryManger.cc
cpp/common/Global.cc
cpp/funcitons/RegistrationAllFunctions.cc
)

velox_link_libraries(sdk
velox_type
velox_vector
velox_exec
velox_exec_test_lib
velox_parse_expression
velox_hive_connector
velox_memory
velox_dwio_parquet_reader
velox_functions_prestosql_impl
velox_functions_spark
velox_aggregates
velox_functions_spark_aggregates
velox_window
velox_vector
velox_functions_spark_window
velox_exec_test_lib)
30 changes: 30 additions & 0 deletions velox/sdk/cpp/common/Global.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/

#include "gflags/gflags.h"
#ifndef GLOBAL_H
#define GLOBAL_H
DEFINE_int64(
max_root_memory_bytes,
10L * 1024L * 1024L * 1024L ,
"root memory size");

DEFINE_int64(
max_query_memory_bytes,
1L * 1024L * 1024L * 1024L,
"query memory size");
#endif //GLOBAL_H
26 changes: 26 additions & 0 deletions velox/sdk/cpp/common/Global.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/

#include "gflags/gflags.h"
#ifndef GLOBAL_H
#define GLOBAL_H
DECLARE_int64(
max_root_memory_bytes);

DECLARE_int64(
max_query_memory_bytes);
#endif //GLOBAL_H
Loading
Loading