Skip to content

Support none type - #553

Merged
deniszh merged 5 commits into
bookingcom:masterfrom
Anandbrewery:support-none-type
Oct 16, 2026
Merged

deniszh merged 5 commits into
bookingcom:masterfrom
Anandbrewery:support-none-type

Conversation

@Anandbrewery

@Anandbrewery Anandbrewery commented Feb 6, 2026 •

Copy link
Copy Markdown

What issue is this change attempting to solve?

PR is dedicated to resolve None type issue faced below
Fixes #295

How does this change solve the problem? Why is this the best approach?

  • EtNil constant is introduced in interface.go
  • By intercepting "None" (case-insensitive) in parser.go and assigning it EtNil, we provide a type-safe way for functions to handle null arguments. This follows the existing architecture for constants and strings.

How can we be sure this works as expected?

  • Added unit tests in parser_test.go for standalone None and nested function calls.
  • All 46 TestParseExpr cases passed on running-> (go test -v ./pkg/parser/... -run TestParseExpr)

@Anandbrewery

Anandbrewery commented Feb 8, 2026 •

Copy link
Copy Markdown
Author

hi @deniszh @grzkv @azhiltsov @timtofan @emadolsky should i submit this PR with single commit or multi commit for each change is fine.

@Anandbrewery

Copy link
Copy Markdown
Author

hi @deniszh @grzkv could please let me know is there any issue with this PR

deniszh
deniszh previously approved these changes Oct 15, 2026
@deniszh

deniszh commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Sorry, @Anandbrewery , could you please rebase with current master?

@Anandbrewery

Copy link
Copy Markdown
Author

@deniszh rebased it with master please do let me know if there is still any blocker from my side to close this PR

@deniszh
deniszh requested a balanced review from Copilot and removed request for azhiltsov October 15, 2026 17:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Explicit nulls still fail in evaluation and named arguments, while string coercion can silently discard results.

3 open findings
What changed in this PR

Adds parser support for explicit None arguments, laying groundwork for the asPercent behavior requested in #295.

Changes:

  • Introduces EtNil and case-insensitive None parsing.
  • Updates numeric and string argument handling.
  • Adds standalone and function-argument parsing tests.
File Description
pkg/​parser/​parser.go Recognizes None as EtNil.
pkg/​parser/​parser_test.go Tests standalone and positional None parsing.
pkg/​parser/​internal.go Adds null handling to argument accessors.
pkg/​parser/​interface.go Defines the EtNil expression type.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/parser/internal.go Outdated
Comment thread pkg/parser/parser.go
Comment thread pkg/parser/parser.go
- Keep string/float arg accessors strict: None no longer silently
  becomes an empty string (e.g. exclude(metric, None) matched everything)
- Accept None as a named argument value (func(metric, key=None))
- asPercent: total=None sums the input series, per group when nodes
  are given, matching graphite-web (fixes bookingcom#295)
- Sum the group's own total series when several totals share a key
- Add evaluation tests for asPercent with None and a named-arg parser test

@Anandbrewery Anandbrewery left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

completed

@Anandbrewery

Anandbrewery commented Oct 16, 2026 •

Copy link
Copy Markdown
Author

@deniszh @timtofan pls review and merge it

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused changes have relevant test coverage and no unresolved findings; tests were not executed in this environment.

0 open findings

3 resolved since last review

🧠 Review effort: Balanced

@deniszh
deniszh merged commit f938cde into bookingcom:master Oct 16, 2026
6 checks passed
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.

parser does not support explicit None arguments for functions

3 participants