-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: rename 'expression' for clarity #26
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
base: main
Are you sure you want to change the base?
Conversation
8f5350c to
9023ebf
Compare
| * { date: { relative: { offset: 0, unit: "month", boundary: "start" } } } | ||
| */ | ||
| export type DateOperand = | ||
| export type DateExpression = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's rename the parent folder to be expression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, I was leaving the folder rename for later to minimize diffs
| { model: string, expression: Expression } | ||
| | // unary expression | ||
| { operator: UnaryOperator, operand: Operand } | ||
| { operator: UnaryOperator, operand: Expression|Expression[] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we rename operand to expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think it's ok
| export type Audience = { | ||
| schema_version: Version, | ||
| audience: Expression | ||
| audience: Condition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit semantically awkward in my brain. I wonder if we should rename the attribute something like filter: Condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
condition: Condition ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't bother me. The root audience key is the entry point into defining the criteria for an audience, which is a Condition
| "expressions": [ | ||
| "conditions": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be expression still? In my mind, condition is a filter operation. Likely only relevant to aggregate operations. I would say:
- Expression == thing the operator is acting on
- Condition == expression that determines which things are operated on (aka, filters the input)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My vote is to leave it as is. In my mind logical condition can only contain conditions and Condition == expression that returns boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, Condition applies everywhere, not just aggregate operations. The root expression for an audience evaluates to a boolean to determine membership, e.g.
{
"operator": "and",
"conditions": [
{ .. condition 1 .. },
{ .. condition 2 .. },
]
}
is itself a Condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The root expression for an audience evaluates to a boolean to determine membership
I didn't notice this was directly on the audience, but I agree the top level should be a condition. Not a fan of the current syntax, honestly - I would do:
"audience" : {
"condition": { some bool expression },
}That way the top level isn't forced to follow the expression syntax, which is more flexible for the future.
I think the other expressions should only use condition as a filter though - so any nested and/or would NOT use condition since they aren't checking a condition, just evaluating an expression. Condition implies check to me, but there are only two checks currently, on aggregates and at the base query.
Instructions
developmentSummary
ExpressiontoConditionOperandtoExpressionExpressionsthat didn't cleanly fit. For example DateExpression, "Represents an expression that evaluates to a date or date-based condition". Fairly certain these are not being usedgroup_bytogroup_by_modelper prior discussionsTesting Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)