-
Notifications
You must be signed in to change notification settings - Fork 22
Add changes for compatibility with WASM components and collocated UDF servers #121
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
Open
kesmit13
wants to merge
33
commits into
main
Choose a base branch
from
wasm-compat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
9aa0901
Add WASM compatibility for componentize-py builds
kesmit13 73dcaad
Add WIT interface definition for WASM UDF components
kesmit13 49521d1
Add type annotations to WASM numpy stub and UDF handler
kesmit13 5d1e9e6
Add code generation for UDF handler function registration
kesmit13 aed95df
Replace top-level optional imports with lazy import helpers
kesmit13 24df239
Fix Python 3.10+ union syntax in udf_handler type annotation
kesmit13 5eef5fd
feat: add call_function_accel C function to accel.c
kesmit13 0e4bb40
Add WASM build script for wasm32-wasip2 target
kesmit13 a18eb52
Remove WASM numpy_stub, now unnecessary with lazy imports
kesmit13 248f897
Add collocated Python UDF server with pre-fork process mode
kesmit13 e4d8627
Fix @@register propagation in collocated server process mode
kesmit13 1b90ab6
Fix broken pipe in collocated UDF server under concurrent load
kesmit13 c732dff
Guard np.dtype check in normalize_dtype for environments without numpy
kesmit13 1b62a6c
Guard WASI-incompatible POSIX APIs in accel.c with #ifndef __wasi__
kesmit13 c65793a
Call setup_logging() in FunctionHandler.initialize() for WASM handler
kesmit13 b66653a
Add WASI stubs for mmap_read/mmap_write/recv_exact and fix accel logging
kesmit13 34e2452
Address PR #121 review comments: memory safety, correctness, hardening
kesmit13 fe1d8ad
Fix recv_exact protocol desync and unchecked PyObject_Length returns
kesmit13 548edcc
Fix _iquery DataFrame conversion for non-tuple results_type
kesmit13 2753f6e
Fix MYSQL_TYPE_NULL data pointer advancement in call_function_rowdat_1
kesmit13 8aa88c0
Fix missing PyErr_Occurred checks in call_function_accel
kesmit13 a7fb74d
Add decimal, datetime, date, and time type support across all UDF paths
kesmit13 f3d069a
Lazy-load IPython in singlestoredb.utils.events
kesmit13 5dfacae
Fix refcount leak, unaligned reads, and YEAR type mismatch in accel.c
kesmit13 a22fc43
Enable VECTOR type with element type validation in dtypes
kesmit13 4c7fb60
Add JSON wire format type conversions for UDF data types
kesmit13 87e9253
Restore socket timeout after partial-read recovery in _recv_exact_py
kesmit13 5de453c
Rename collocated UDF package to plugin
kesmit13 14d5e83
Update docs and plugin/ terminology after collocated→plugin rename
kesmit13 3043c59
Add missing -MYSQL_TYPE_BLOB case in numpy sizing pass
kesmit13 d810823
Add NULL-type bounds checks, fix rowdat_1 null handling, and expand t…
kesmit13 13d769e
Consolidate duplicated rowdat_1 type dispatch logic in accel.c
kesmit13 0f5e5d1
Remove redundant under2camel in ShowAccessor._iquery
kesmit13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,41 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -eou pipefail | ||
|
|
||
| # CPYTHON_ROOT must contain a build of cpython for wasm32-wasip2 | ||
|
|
||
| TARGET="wasm32-wasip2" | ||
| CROSS_BUILD="${CPYTHON_ROOT}/cross-build/${TARGET}" | ||
| WASI_SDK_PATH=${WASI_SDK_PATH:-/opt/wasi-sdk} | ||
| PYTHON_VERSION=$(grep '^VERSION=' "${CROSS_BUILD}/Makefile" | sed 's/VERSION=[[:space:]]*//') | ||
|
|
||
| if [ ! -e wasm_venv ]; then | ||
| uv venv --python ${PYTHON_VERSION} wasm_venv | ||
| fi | ||
|
|
||
| . wasm_venv/bin/activate | ||
|
|
||
| HOST_PYTHON=$(which python3) | ||
|
|
||
| uv pip install build wheel cython setuptools | ||
|
|
||
| ARCH_TRIPLET=_wasi_wasm32-wasi | ||
|
|
||
| export CC="${WASI_SDK_PATH}/bin/clang" | ||
| export CXX="${WASI_SDK_PATH}/bin/clang++" | ||
|
|
||
| export PYTHONPATH="${CROSS_BUILD}/build/lib.wasi-wasm32-${PYTHON_VERSION}" | ||
|
|
||
| export CFLAGS="--target=${TARGET} -fPIC -I${CROSS_BUILD}/install/include/python${PYTHON_VERSION} -D__EMSCRIPTEN__=1" | ||
| export CXXFLAGS="--target=${TARGET} -fPIC -I${CROSS_BUILD}/install/include/python${PYTHON_VERSION}" | ||
| export LDSHARED=${CC} | ||
| export AR="${WASI_SDK_PATH}/bin/ar" | ||
| export RANLIB=true | ||
| export LDFLAGS="--target=${TARGET} -shared -Wl,--allow-undefined" | ||
| export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__wasi_wasm32-wasi | ||
| export _PYTHON_HOST_PLATFORM=wasm32-wasi | ||
|
|
||
| python3 -m build -n -w | ||
| wheel unpack --dest build dist/*.whl | ||
|
|
||
| rm -rf ./wasm_venv |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| """High-performance collocated Python UDF server for SingleStoreDB.""" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.