-
Notifications
You must be signed in to change notification settings - Fork 262
Add lua binding #237
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
karminski
wants to merge
2
commits into
asg017:main
Choose a base branch
from
karminski:main
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
Add lua binding #237
Conversation
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
Comment on lines
+16
to
+17
| echo "Error: lsqlite3 module is not installed" | ||
| echo "Install it with: luarocks install lsqlite3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to print errors to stderr:
Suggested change
| echo "Error: lsqlite3 module is not installed" | |
| echo "Install it with: luarocks install lsqlite3" | |
| echo "Error: lsqlite3 module is not installed" >&2 | |
| echo "Help: luarocks install lsqlite3" >&2 |
|
Great contribution, I hope it gets reviewed ❤️ Would a small unit test be possible? |
vlasky
added a commit
to vlasky/sqlite-vec
that referenced
this pull request
Jan 4, 2026
/examples/simple-lua/ contains a demo script and runner. Incorporates upstream PR asg017#237 with the following bugfixes: Extension loading: - Fix return value check: lsqlite3's load_extension returns true on success, not sqlite3.OK (which is 0). Changed from `if ok then` to `if ok and result then` to properly detect successful loads. - Add vec0 naming paths alongside sqlite-vec paths for this fork. IEEE 754 float serialization (float_to_bytes): - Switch from half-round-up to round-half-to-even (banker's rounding) for IEEE 754 compliance. This prevents systematic bias when processing large datasets where half-values accumulate. - Handle special cases: NaN, Inf, -Inf, and -0.0 which the original implementation did not support. - Fix subnormal number encoding: corrected formula from 2^(exp+126) to 2^(exp+127) so minimum subnormal 2^(-149) encodes correctly. - Add mantissa overflow carry: when rounding causes mantissa >= 2^23, carry into exponent field. - Add exponent overflow handling: values too large now return ±Inf instead of producing corrupted output. - Use epsilon comparison (1e-9) for 0.5 tie detection to handle floating-point precision issues. JSON serialization (serialize_json): - Error on NaN and Infinity values which are not valid JSON. - Convert -0.0 to 0.0 for JSON compatibility. Co-Authored-By: asr1 <noreply@users.noreply.github.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@karminski I've made a tweak to your PR and incorporated it into version v0.2.4-alpha of my fork. |
vlasky
added a commit
to vlasky/sqlite-vec
that referenced
this pull request
Jan 4, 2026
/examples/simple-lua/ contains a demo script and runner. Incorporates upstream PR asg017#237 with the following bugfixes: Extension loading: - Fix return value check: lsqlite3's load_extension returns true on success, not sqlite3.OK (which is 0). Changed from `if ok then` to `if ok and result then` to properly detect successful loads. - Add vec0 naming paths alongside sqlite-vec paths for this fork. IEEE 754 float serialization (float_to_bytes): - Switch from half-round-up to round-half-to-even (banker's rounding) for IEEE 754 compliance. This prevents systematic bias when processing large datasets where half-values accumulate. - Handle special cases: NaN, Inf, -Inf, and -0.0 which the original implementation did not support. - Fix subnormal number encoding: corrected formula from 2^(exp+126) to 2^(exp+127) so minimum subnormal 2^(-149) encodes correctly. - Add mantissa overflow carry: when rounding causes mantissa >= 2^23, carry into exponent field. - Add exponent overflow handling: values too large now return ±Inf instead of producing corrupted output. - Use epsilon comparison (1e-9) for 0.5 tie detection to handle floating-point precision issues. JSON serialization (serialize_json): - Error on NaN and Infinity values which are not valid JSON. - Convert -0.0 to 0.0 for JSON compatibility. Co-Authored-By: karminski <code.karminski@outlook.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
mceachen
pushed a commit
to mceachen/sqlite-vec
that referenced
this pull request
Jan 4, 2026
/examples/simple-lua/ contains a demo script and runner. Incorporates upstream PR asg017#237 with the following bugfixes: Extension loading: - Fix return value check: lsqlite3's load_extension returns true on success, not sqlite3.OK (which is 0). Changed from `if ok then` to `if ok and result then` to properly detect successful loads. - Add vec0 naming paths alongside sqlite-vec paths for this fork. IEEE 754 float serialization (float_to_bytes): - Switch from half-round-up to round-half-to-even (banker's rounding) for IEEE 754 compliance. This prevents systematic bias when processing large datasets where half-values accumulate. - Handle special cases: NaN, Inf, -Inf, and -0.0 which the original implementation did not support. - Fix subnormal number encoding: corrected formula from 2^(exp+126) to 2^(exp+127) so minimum subnormal 2^(-149) encodes correctly. - Add mantissa overflow carry: when rounding causes mantissa >= 2^23, carry into exponent field. - Add exponent overflow handling: values too large now return ±Inf instead of producing corrupted output. - Use epsilon comparison (1e-9) for 0.5 tie detection to handle floating-point precision issues. JSON serialization (serialize_json): - Error on NaN and Infinity values which are not valid JSON. - Convert -0.0 to 0.0 for JSON compatibility. Co-Authored-By: karminski <code.karminski@outlook.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add lua binding and examples/simple-lua as demo.