Skip to content

[FSTORE-1998] Add HQSLocalClient for in-process query execution with Arrow Flight f…#871

Open
jimdowling wants to merge 3 commits into
logicalclocks:mainfrom
jimdowling:hqs_as_library
Open

[FSTORE-1998] Add HQSLocalClient for in-process query execution with Arrow Flight f…#871
jimdowling wants to merge 3 commits into
logicalclocks:mainfrom
jimdowling:hqs_as_library

Conversation

@jimdowling
Copy link
Copy Markdown
Contributor

…allback

When the hqs library is installed and running inside Hopsworks (internal client), queries are executed in-process via hqs.HQSClient, skipping the Arrow Flight network hop. Cross-project queries (identified by hqs_payload_signature) are forwarded to the Arrow Flight server which has the private key and superuser HDFS access for decrypting connectors.

  • Add _should_use_local_hqs() detection (checks hqs importable + internal)
  • Add HQSLocalClient with hybrid routing (local vs Arrow Flight fallback)
  • Lazy ArrowFlightClient initialization (only on first signed query)
  • Fix bug in _disable_feature_query_service_client (was calling method on None)

This PR adds/fixes/changes...

  • please summarize your changes to the code
  • and make sure to include all changes to user-facing APIs

JIRA Issue: -

Priority for Review: -

Related PRs: -

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Tests on VM

Checklist For The Assigned Reviewer:

- [ ] Checked if merge conflicts with master exist
- [ ] Checked if stylechecks for Java and Python pass
- [ ] Checked if all docstrings were added and/or updated appropriately
- [ ] Ran spellcheck on docstring
- [ ] Checked if guides & concepts need to be updated
- [ ] Checked if naming conventions for parameters and variables were followed
- [ ] Checked if private methods are properly declared and used
- [ ] Checked if hard-to-understand areas of code are commented
- [ ] Checked if tests are effective
- [ ] Built and deployed changes on dev VM and tested manually
- [x] (Checked if all type annotations were added and/or updated appropriately)

jimdowling and others added 2 commits March 16, 2026 14:20
…allback

When the hqs library is installed and running inside Hopsworks (internal
client), queries are executed in-process via hqs.HQSClient, skipping
the Arrow Flight network hop. Cross-project queries (identified by
hqs_payload_signature) are forwarded to the Arrow Flight server which
has the private key and superuser HDFS access for decrypting connectors.

- Add _should_use_local_hqs() detection (checks hqs importable + internal)
- Add HQSLocalClient with hybrid routing (local vs Arrow Flight fallback)
- Lazy ArrowFlightClient initialization (only on first signed query)
- Fix bug in _disable_feature_query_service_client (was calling method on None)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  python/hsfs/core
  arrow_flight_client.py 63-66, 73, 86-90, 632, 647-658, 662-667, 670, 675, 678, 682-698, 704-720, 728-752, 758, 762, 766, 770, 774, 778, 782, 786
Project Total  

This report was generated by python-coverage-comment-action

pyproject.toml: add `hqs` extra that pulls hopsworks[python] plus
hqs[snowflake,bigquery,postgres,mysql,oracle,redshift,delta-gcs] for
parity with the flyingduck Flight server image.

arrow_flight_client.py:
- Replace find_spec("hqs") activation heuristic with an explicit gate
  that checks _is_external(), the cluster's enable_flyingduck flag, and
  importability of both hqs and duckdb. Mere presence of hqs in the
  install set is no longer sufficient.
- get_instance() now constructs ArrowFlightClient first to read the
  cluster flag, then conditionally swaps to HQSLocalClient and passes
  the remote instance as a fallback (no lazy reconstruction).
- HQSLocalClient uses HQSClient.from_pod_environment to derive a 50%
  cgroup memory cap so a heavy join does not OOM the pod.
- Read through the public hqs_client.hopsfs property instead of
  reaching into _engine.
- Drop blanket Exception catches that were swallowing FeatureStoreException.
- Drop dead no-op setters for host_url / timeout / health_check_timeout.
- _disable_for_session now clears _flight_fallback and sets
  _disabled_for_session so a stale handle cannot resurrect routing.

tests/core/test_arrow_flight_client.py: add 12 tests covering the
activation gate (external, cluster-disabled, hqs missing, duckdb
missing, all gates pass), get_instance routing (external returns
ArrowFlightClient; internal+gates+local hqs swaps to HQSLocalClient
with fallback wired), and HQSLocalClient methods (unsigned executes
locally, signed forwards to fallback, _disable_for_session drops
fallback, __init__ uses from_pod_environment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant