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

[pkg/ottl] Update Parser to understand solo conditions #14918

Conversation

TylerHelmuth
Copy link
Member

No description provided.

@kovrus
Copy link
Member

kovrus commented Oct 13, 2022

It looks good! @TylerHelmuth thanks for playing around with it.

One comment that is not related to the essence of this PR: As mentioned before #14783 (comment) the transform processor can now parse both conditionStatement and transformationStatement; it should not be allowed since using conditionStatement doesn't make much sense there. Shall we pass smth that would verify what statement types are supported in the given context, for example, when creating an instance of ottl.Parser we can do the following:

... = NewParser(
         statements,
         WithFunctions(functions),
         WithSettings(settings),
         WithSupportedStatements(Statement.TRANSFORMATION), 
      )

@TylerHelmuth
Copy link
Member Author

Yes we could add something like that in the future and use it during validation, but I think it could be added later in its own PR.

condition: expression,
}, nil
}

var parser = newParser()

func parseStatement(raw string) (*parsedStatement, error) {
Copy link
Member

@kovrus kovrus Oct 13, 2022

Choose a reason for hiding this comment

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

We can probably inline this method and in tests it should be ok to use parser.ParseString("", raw)

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Oct 28, 2022
@kovrus
Copy link
Member

kovrus commented Oct 31, 2022

Can I somehow help to move this idea forward?

@TylerHelmuth
Copy link
Member Author

@kovrus I've been unable to make this work a priority as I've been working on other things. Are you able to take over?

@github-actions github-actions bot removed the Stale label Nov 1, 2022
@kovrus
Copy link
Member

kovrus commented Nov 1, 2022

@kovrus I've been unable to make this work a priority as I've been working on other things. Are you able to take over?

@TylerHelmuth I can try! I'll take a look at it the next week.

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Nov 16, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants