Repository navigation
fix(query): replace Marshal.to_string dedup keys with typed hash tables - #44
Merged
Merged
Conversation
Marshal.* externals are not polyfilled by Melange, so every q call crashed when compiled to JS (logseq/logseq CI). Use the existing typed Hashtbl.Make tables in query_api.ml (query_value_hash, query_result_hash, query_result list) instead of marshaled string keys — same dedup semantics, faster, and Melange-safe.
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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
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.
Summary
Marshal.*externals are not polyfilled by Melange, so everyqcall threw at runtime in JS bundles (caml_output_value_to_string not polyfilled by Melange yet). This broke logseq/logseq CI ondevin/ocaml-db-worker(CLI E2Egraph-export-edn-options-partial, ocaml-e2edatascript_queryeditor case).Replace the four marshaled-key hash tables in
impl/datascript.mlwith typedHashtbl.Maketables exported byimpl/query_api.ml:Query_value_table—valuekeys (compare_query_value/query_value_hash)Query_result_table—query_resultkeys (compare_query_result/query_result_hash)List_row_table—query_result listrow keysSame dedup semantics (first occurrence wins), faster than marshal + structural string compare, and Melange-safe since it uses no native-only externals.
Verified: all 29 native test executables pass on this branch.
Link to Devin session: https://app.devin.ai/sessions/39cf217367ca4dd388a4828e90a301c2
Open in Devin Desktop: https://app.devin.ai/desktop/session/39cf217367ca4dd388a4828e90a301c2?variant=devin
Requested by: @tiensonqin