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

1 simple painless script in terms aggregation #1196

Merged
merged 5 commits into from
Jan 26, 2025
Merged

Conversation

trzysiek
Copy link
Member

First PR fine-tuning Quesma for the new customer

@trzysiek trzysiek changed the title 1 simple painless script in 'terms' aggregation 1 simple painless script in terms aggregation Jan 19, 2025
@trzysiek trzysiek force-pushed the painful-script-in-terms branch from 9199b88 to a887f57 Compare January 19, 2025 23:43
@trzysiek trzysiek marked this pull request as ready for review January 19, 2025 23:44
@trzysiek trzysiek requested a review from a team as a code owner January 19, 2025 23:44
Copy link

cloudflare-workers-and-pages bot commented Jan 23, 2025

Deploying quesma with  Cloudflare Pages  Cloudflare Pages

Latest commit: e75aaa9
Status: ✅  Deploy successful!
Preview URL: https://63b24787.quesma.pages.dev
Branch Preview URL: https://painful-script-in-terms.quesma.pages.dev

View logs

wantedRegex := regexp.MustCompile(`^doc\['(\w+)']\.value\.(?:getHour\(\)|hourOfDay)$`)
matches := wantedRegex.FindStringSubmatch(source)
if len(matches) == 2 {
return model.NewFunction("toHour", model.NewColumnRef(matches[1])), true
}

// b) source: "if (doc['field_name_1'].value == doc['field_name_2'].value") { return 1; } else { return 0; }"
wantedRegex = regexp.MustCompile(`^if \(doc\['(.*)\.value']\.value == doc\['(.*)\.value'].value\) \{ \n return 1; \n} else \{ \n return 0; \n}$`)
Copy link
Contributor

Choose a reason for hiding this comment

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

We eventually need to unify this with rest of painless parsing, but good for now.

@trzysiek trzysiek enabled auto-merge January 26, 2025 15:56
@trzysiek trzysiek added this pull request to the merge queue Jan 26, 2025
Merged via the queue into main with commit b0d8343 Jan 26, 2025
5 checks passed
@trzysiek trzysiek deleted the painful-script-in-terms branch January 26, 2025 16:02
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