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

[NU-1977] Key variable change in window components #7553

Open
wants to merge 7 commits into
base: staging
Choose a base branch
from

Conversation

ForrestFairy
Copy link
Contributor

@ForrestFairy ForrestFairy commented Feb 11, 2025

Describe your changes

key variable was created in window components by taking values from groupBy and parsing them to a list in string. Now it will be passed as a value which was provided, eg.

for id = 1
Before -> groupBy: id -> key: "[1]"
After -> groupBy: id -> key: 1

For old scenarios users would need to go into aggregation components and edit groupBy field for it to take effect. Otherwise it will still create key variable as string

Checklist before merge

  • Related issue ID is placed at the beginning of PR title in [brackets] (can be GH issue or Nu Jira issue)
  • Code is cleaned from temporary changes and commented out lines
  • Parts of the code that are not easy to understand are documented in the code
  • Changes are covered by automated tests
  • Showcase in dev-application.conf added to demonstrate the feature
  • Documentation added or updated
  • Added entry in Changelog.md describing the change from the perspective of a public distribution user
  • Added MigrationGuide.md entry in the appropriate subcategory if introducing a breaking change
  • Verify that PR will be squashed during merge

@github-actions github-actions bot added client client main fe ui labels Feb 11, 2025
@ForrestFairy ForrestFairy force-pushed the key-var-change branch 3 times, most recently from 6ef97d7 to 230bc1b Compare February 12, 2025 14:22
@github-actions github-actions bot added the docs label Feb 13, 2025
@ForrestFairy ForrestFairy marked this pull request as ready for review February 14, 2025 08:52
@@ -92,6 +92,7 @@
* Kafka source has "offset reset strategy" parameter that controls starting point for reading events.
* Configuration entry `kafkaEspProperties.forceLatestRead` is replaced with `kafkaEspProperties.defaultOffsetResetStrategy`
* [#7545](https://github.com/TouK/nussknacker/pull/7545) Added `useMiniClusterForDeployment` option allowing to run Flink scenarios on Flink MiniCluster
* [#7553](https://github.com/TouK/nussknacker/pull/7553) Key variable created in window component doesn't have to be string
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's write what it is now, and add a little note to the migration guide.

@@ -46,7 +46,7 @@ export function useGroupByParamsSerializer(): [(text: string) => string[], (para

switch (paramName) {
case "groupBy":
return `{ ${content} }.toString`;
return `${content}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should wrap keys in list if there is more than one key (now the widget works odd if we put multiple key)

Copy link
Contributor

Choose a reason for hiding this comment

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

Screenshot 2025-02-21 at 14 24 12

ctx.withVariable(VariableConstants.KeyVariableName, key)

def contextTransformation(ctx: ValidationContext)(
implicit nodeId: NodeId
): ValidatedNel[ProcessCompilationError, ValidationContext] =
ctx.withVariableOverriden(VariableConstants.KeyVariableName, Typed[String], None)
ctx.withVariableOverriden(VariableConstants.KeyVariableName, Unknown, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we type the key output variable according to type put in groupBy parameter? e.g. String or List[String].

Copy link
Contributor

Choose a reason for hiding this comment

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

Screenshot 2025-02-21 at 14 25 54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client main fe docs ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants