Skip to content

Dr 92 add lookup function to athena and big query#651

Merged
rathko merged 4 commits intodevelopfrom
DR-92-add-lookup-function-to-athena-and-big-query
Apr 21, 2026
Merged

Dr 92 add lookup function to athena and big query#651
rathko merged 4 commits intodevelopfrom
DR-92-add-lookup-function-to-athena-and-big-query

Conversation

@mirkan1
Copy link
Copy Markdown
Contributor

@mirkan1 mirkan1 commented Jan 10, 2026

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • New Query Runner (Data Source)
  • New Alert Destination
  • Other

Description

How is this tested?

  • Unit tests (pytest, jest)
  • E2E Tests (Cypress)
  • Manually
  • N/A

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support in the Plywood SQL dialect layer to express “lookup”-style operations for BigQuery and AWS Athena, and introduces Turnilo dimension examples/tests for advanced formulas.

Changes:

  • Added lookupExpression (and related helpers) to BigQuery and Athena dialects.
  • Added new Turnilo fixtures and a Mocha test suite covering parsing/serialization of advanced dimension formulas (lookup, extract, boolean, chained).
  • Minor prop-passing change in the Turnilo table visualization (SplitRows color prop).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
plywood/client/src/dialect/bigQueryDialect.ts Adds lookupExpression, searchExpression, and overrides logExpression/constants.
plywood/client/src/dialect/awsAthenaDialect.ts Adds searchExpression and lookupExpression.
client/app/components/TurniloComponent/common/models/dimension/advanced-formulas.mocha.ts New Mocha tests for parsing/round-tripping advanced dimension formulas.
client/app/components/TurniloComponent/common/models/dimension/advanced-formula.fixtures.ts New fixture examples for lookup/extract/boolean/chained formulas.
client/app/components/TurniloComponent/client/visualizations/table/table.tsx Adjusts how colorText is passed to SplitRows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +249 to +256
if (base === "e") {
return `LN(${operand})`;
} else if (base === "10") {
return `LOG10(${operand})`;
} else if (base === "2") {
return `LOG2(${operand})`;
} else {
return `LOG(${this.escapeLiteral(base)}, ${operand})`;
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

logExpression is comparing base to the string "e", but LogExpression passes the SQL for the base expression (e.g. 2.718281828459045 for Math.E), so this branch will never be taken. Also, the fallback LOG(${this.escapeLiteral(base)}, ${operand}) incorrectly quotes the base (turning it into a STRING literal) even though base is a numeric SQL expression; it should be used as-is (and, for BigQuery, likely via LN(operand)/LN(base) or the correct LOG argument order).

Suggested change
if (base === "e") {
return `LN(${operand})`;
} else if (base === "10") {
return `LOG10(${operand})`;
} else if (base === "2") {
return `LOG2(${operand})`;
} else {
return `LOG(${this.escapeLiteral(base)}, ${operand})`;
const normalizedBase = base.trim();
if (normalizedBase === "2.718281828459045") {
return `LN(${operand})`;
} else if (normalizedBase === "10") {
return `LOG10(${operand})`;
} else if (normalizedBase === "2") {
return `LOG2(${operand})`;
} else {
return `LN(${operand}) / LN(${normalizedBase})`;

Copilot uses AI. Check for mistakes.
Comment thread plywood/client/src/dialect/bigQueryDialect.ts
Comment thread plywood/client/src/dialect/awsAthenaDialect.ts
Comment thread plywood/client/src/dialect/awsAthenaDialect.ts
…into DR-92-add-lookup-function-to-athena-and-big-query
@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
. 77%
authentication 65%
cli 67%
destinations 64%
gcloud 100%
handlers 73%
metrics 94%
models 88%
plywood 74%
plywood.handlers 69%
plywood.objects 86%
plywood.parsers 76%
query_runner 52%
serializers 73%
services 92%
settings 96%
tasks 66%
tasks.queries 80%
tasks.reports 19%
templates._includes 100%
utils 72%
Summary 66% (11081 / 16818)

Minimum allowed line rate is 60%

@rathko rathko merged commit 7939416 into develop Apr 21, 2026
9 checks passed
@rathko rathko deleted the DR-92-add-lookup-function-to-athena-and-big-query branch April 21, 2026 18:09
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.

3 participants