Skip to content

Add constant folding and lookup function to transform plugin - #1002

Open
timggggggg wants to merge 1 commit into
masterfrom
999-transform-field-mapping-function
Open

Add constant folding and lookup function to transform plugin#1002
timggggggg wants to merge 1 commit into
masterfrom
999-transform-field-mapping-function

Conversation

@timggggggg

Copy link
Copy Markdown
Collaborator

Description

  • add lookup(value, table, default:) — translates a value through an
    object table; keys match by string form, so 0 and "0" are the same key.
    A miss returns the value unchanged unless default: is given.
  • fold constant call arguments and assignment values into core.ConstExpr
    during the validation walk, so a table literal is built once at startup
    instead of per event (70 entries: 7347 -> 1248 ns/op, 88 -> 14 allocs).
    An expression that fails to evaluate is never folded and keeps failing
    at runtime.
  • fix equality against event fields: JSONNodeValue compared String()
    forms, so .obj == {a: 1} could never match. == and != now resolve both
    operands like every other operator. Equality is now type-aware:
    .num == "1" is false where it used to be true.
  • sort object keys in DumpAST

Fixes #999

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.

Feature: transform plugin — translate field values via a configured mapping

2 participants