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

Add WithoutNormalize Compiler Option #274

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add WithoutNormalize Compiler Option #274

wants to merge 1 commit into from

Conversation

joa
Copy link

@joa joa commented Mar 3, 2025

This PR adds a WithoutNormalize compile option to the gojq compiler. When the option has been specified, data given to gojq won't be normalized, and therefore modified.

I ran into this issue when running many queries concurrent against a single set of data. It's not useful to normalize the data over and over again and also the only other to options are to either (a) hold a lock while running gojq or (b) creating copies of the data. I understand it makes sense to have this as a default but adding this option gives greater control over how, when and if the given data should be modified.

This additional option makes to run gojq code concurrent against the
same data without requiring a mutex. gojq won't try to write and
modify the given data if the new option is specified. However one
needs to manually normalize the data or make sure it has the right
format.
@joa
Copy link
Author

joa commented Mar 3, 2025

See also #212, #235 and #236. PR #237 offers an alternative approach.

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