Skip to content
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

feat(experiments): ExperimentQueryRunner iteration 1 #28353

Merged
merged 7 commits into from
Feb 6, 2025

Conversation

danielbachhuber
Copy link
Contributor

Merges into #28347

Changes

  • First pass at data warehouse support
  • Adds tests for internal filters, both against events and data warehouse.
  • Adds query snapshots for each test.
  • Stubs ExperimentQuery.
  • Adds skipped test for a complex join from fix(hogql): Allow chaining for lazy tables #28253

How did you test this code?

Tests should pass.

@danielbachhuber danielbachhuber requested a review from a team February 5, 2025 21:29
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces data warehouse support and test account filtering to the ExperimentQueryRunner, with significant test coverage and query snapshots.

  • Added data warehouse support in experiment_query_runner.py with dynamic metric value extraction based on query type
  • Implemented test account filtering with comprehensive test coverage across multiple filter types (person, event, cohort, etc.)
  • Added new ExperimentQuery Pydantic model in schema.py to handle both trends and data warehouse queries
  • Added cleanup mechanism in tests to properly handle S3/object storage test data
  • Enhanced query construction to support both regular events and data warehouse tables with proper joins

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 116 to +119
metric_property = self.query.count_query.series[0].math_property
metric_value = f"toFloat(JSONExtractRaw(properties, '{metric_property}'))"
if is_data_warehouse_query:
metric_value = f"toFloat('{metric_property}')"
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Potential SQL injection vulnerability in metric_property interpolation. Should use parameterized queries or proper escaping.

@danielbachhuber danielbachhuber changed the title ExperimentQueryRunner iteration 1 feat(experiments): ExperimentQueryRunner iteration 1 Feb 5, 2025
Copy link
Contributor

@andehen andehen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 👍

@andehen andehen merged commit 4c2e54e into init-new-experiment-query-runner Feb 6, 2025
91 of 92 checks passed
@andehen andehen deleted the query-runner-more-tests branch February 6, 2025 05:40
andehen pushed a commit that referenced this pull request Feb 6, 2025
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
danielbachhuber added a commit that referenced this pull request Feb 11, 2025
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants