Skip to content

Expose table column usage in query context#135

Open
ei-grad wants to merge 1 commit into
osquery:masterfrom
ei-grad:expose-cols-used
Open

Expose table column usage in query context#135
ei-grad wants to merge 1 commit into
osquery:masterfrom
ei-grad:expose-cols-used

Conversation

@ei-grad
Copy link
Copy Markdown

@ei-grad ei-grad commented May 25, 2026

Summary

  • parse colsUsed and colsUsedBitset from table plugin query contexts
  • expose column-usage metadata on QueryContext
  • add helpers for conservative fallback behavior when column usage is absent
  • add tests for populated, empty, and absent column-usage metadata

Why

osquery core already serializes projection metadata for table plugins, but osquery-go discarded it. Go extension tables with large or expensive columns then have to emit complete rows even for aggregate queries that only need grouping columns. This can hit Thrift message limits before SQLite applies aggregation.

Fixes #134

Tests

  • go test -count=1 ./...
  • go vet ./...
  • git diff --check

Prepared with LM assistance — Codex CLI

Parse the colsUsed and colsUsedBitset fields that osquery core already
serializes into table plugin request contexts. Expose them on QueryContext
and add helpers so table generators can avoid populating expensive columns
when SQLite does not need them.

This keeps older contexts conservative by treating missing column-usage
metadata as all columns potentially used. It addresses aggregate queries
that only need grouping columns but previously forced Go extensions to emit
large complete rows before SQLite aggregation.

Refs: osquery#134

Co-Authored-By: Codex CLI <noreply@openai.com>
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 25, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: ei-grad / name: Andrew Grigorev (49479ac)

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.

Expose colsUsed in table QueryContext

1 participant