AP-23732: Change default for Sorter/Top-K for non-String and non-RowID columns#166
AP-23732: Change default for Sorter/Top-K for non-String and non-RowID columns#166
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Sorter/Top-K (and shared sorting utilities) to use a more suitable default “Compare as” mode for string-compatible non-String columns, and refreshes the UI wording to better explain the two comparison strategies.
Changes:
- Adjust default
StringComparisonbased on the selected column type (String/RowID → natural; otherwise → typed comparator). - Rename and re-describe the comparison modes in the dialog and node descriptions (“Compare as”).
- Update settings schema snapshot expectations to reflect the new labels/descriptions/defaults.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| org.knime.base/src/org/knime/base/node/util/preproc/SortingUtils.java | Implements type-dependent default for StringComparison and updates labels/widget text. |
| org.knime.base/src/org/knime/base/node/preproc/topk/TopKSelectorNodeFactory.java | Expands node description to document the new “Compare as” behavior. |
| org.knime.base/src/org/knime/base/node/preproc/sorter/SorterNodeFactory.java | Expands node description to document the new “Compare as” behavior. |
| org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.topk.TopKSelectorNodeSettingsTest1.snap | Updates schema snapshot titles/descriptions for comparison mode. |
| org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.topk.TopKSelectorNodeSettingsTest.snap | Updates schema snapshot titles/descriptions for comparison mode. |
| org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.sorter.SorterNodeSettingsTest3.snap | Updates schema snapshot titles/descriptions/default for comparison mode. |
| org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.sorter.SorterNodeSettingsTest2.snap | Updates schema snapshot titles/descriptions/default + default value instances. |
| org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.sorter.SorterNodeSettingsTest1.snap | Updates schema snapshot titles/descriptions/default + default value instances. |
| org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.sorter.SorterNodeSettingsTest.snap | Updates schema snapshot titles/descriptions/default + default value instances. |
| org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.rank.RankNodeSettingsTest1.snap | Updates schema snapshot titles/descriptions for comparison mode. |
| org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.rank.RankNodeSettingsTest.snap | Updates schema snapshot titles/descriptions for comparison mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ac7c6c4 to
782d828
Compare
d824b0e to
80183f3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (2)
org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.sorter.SorterNodeSettingsTest3.snap:143
StringComparisonSettingintroduces new predicates (IsActualStringOrRowId/IsOtherStringCompatible) and removes the oldisStringColumnflag fromSortingCriterionSettings. These snapshots still contain anisStringColumnproperty and UI rules referencing it, which will likely no longer match the generated schema—please regenerate/update snapshots (and any rules) to reflect the new predicate fields.
"rule" : {
"effect" : "SHOW",
"condition" : {
"scope" : "#/properties/isStringColumn",
"schema" : {
"const" : true
}
}
org.knime.base.tests/files/test_snapshots/org.knime.base.node.preproc.topk.TopKSelectorNodeSettingsTest.snap:181
- These snapshots still use an
isStringColumnstate field to control visibility of the comparison control. SinceSortingCriterionSettingsno longer definesisStringColumn(it now usesisActualStringOrRowId/isOtherStringCompatible), the snapshot schema/rules likely need to be regenerated to match the new dialog state fields.
"rule" : {
"effect" : "SHOW",
"condition" : {
"scope" : "#/properties/isStringColumn",
"schema" : {
"const" : true
}
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
80183f3 to
1950413
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1917e3c to
45ffaba
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
UIEXT-3099 (WebUI-Migration Binner (Dictionary))
…D columns Also separates String/String-compatible value sorting widgets. AP-23732 (Sorter/Top-K: change default of "comparison" mode for all string-compatible types (except String and RowID) and improve labels/description)
45ffaba to
04b1b02
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <config xmlns="http://www.knime.org/2008/09/XMLConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.knime.org/2008/09/XMLConfig http://www.knime.org/XMLConfig_2008_09.xsd" key="test"> | ||
| <entry key="valueColumnPort0" type="xstring" value="Universe_0_0"/> | ||
| <entry key="lowerBoundColumnPort1" type="xstring" value="Universe_1_0"/> | ||
| <entry key="upperBoundColumnPort1" type="xstring" value="Universe_1_1"/> | ||
| <entry key="lowerBoundInclusive" type="xboolean" value="false"/> | ||
| <entry key="upperBoundInclusive" type="xboolean" value="true"/> | ||
| <entry key="labelColumnPort1" type="xstring" value="Cluster Membership"/> | ||
| <entry key="failIfNoRuleMatches" type="xboolean" value="false"/> | ||
| <entry key="useBinarySearch" type="xboolean" value="false"/> | ||
| </config> |
There was a problem hiding this comment.
These newly added BinByDictionary snapshot baselines appear unrelated to AP-23732 (Sorter/Top-K string-comparison defaults and labels). If they’re just snapshot-regeneration side effects, they should be moved to a separate PR to keep scope focused and avoid mixing unrelated test-data changes with functional sorting changes.
| { | ||
| "data" : { | ||
| "model" : { | ||
| "valueColumnPort0" : "Universe_0_0", | ||
| "boundChoices" : { | ||
| "boundChoice" : "BOTH_BOUNDS", | ||
| "lowerColumn" : "Universe_1_0", | ||
| "upperColumn" : "Universe_1_1" | ||
| }, | ||
| "lowerBoundInclusive" : false, | ||
| "upperBoundInclusive" : true, | ||
| "labelColumnPort1" : "Cluster Membership", | ||
| "noRuleMatchBehavior" : "INSERT_MISSING", | ||
| "searchPattern" : "LINEAR" | ||
| } | ||
| }, | ||
| "schema" : { | ||
| "type" : "object", | ||
| "properties" : { | ||
| "model" : { |
There was a problem hiding this comment.
These newly added BinByDictionary snapshot baselines appear unrelated to AP-23732 (Sorter/Top-K string-comparison defaults and labels). If they’re just snapshot-regeneration side effects, they should be moved to a separate PR to keep scope focused and avoid mixing unrelated test-data changes with functional sorting changes.
| @Override | ||
| public void save(final StringComparisonSetting s, final NodeSettingsWO settings) { | ||
| if (s.m_isActualStringOrRowId) { | ||
| settings.addString(CONFIG_KEY, s.m_stringComparison.name()); | ||
| } else if (s.m_isOtherStringCompatible) { | ||
| settings.addString(CONFIG_KEY, s.m_typedStringComparison.toStringComparison().name()); | ||
| } | ||
| // for non-String-compatible columns, we don't persist anything, because it's not relevant |
There was a problem hiding this comment.
StringComparisonPersistor.save() decides whether to persist the legacy "stringComparison" key based on UI-only state flags (m_isActualStringOrRowId / m_isOtherStringCompatible). These flags are not persisted and may not be computed in headless settings serialization (e.g., when saving settings without opening the dialog), which can cause the stringComparison setting to be dropped from NodeSettings and change behavior / break backward compatibility. Persist the comparison deterministically (e.g., always write CONFIG_KEY based on a single canonical field, or keep m_stringComparison in sync with m_typedStringComparison so the persistor can always save m_stringComparison, or store an explicit persisted discriminator instead of relying on transient state-provider booleans).
| @Override | |
| public void save(final StringComparisonSetting s, final NodeSettingsWO settings) { | |
| if (s.m_isActualStringOrRowId) { | |
| settings.addString(CONFIG_KEY, s.m_stringComparison.name()); | |
| } else if (s.m_isOtherStringCompatible) { | |
| settings.addString(CONFIG_KEY, s.m_typedStringComparison.toStringComparison().name()); | |
| } | |
| // for non-String-compatible columns, we don't persist anything, because it's not relevant | |
| private static StringComparison getPersistedStringComparison(final StringComparisonSetting s) { | |
| if (s.m_stringComparison != null) { | |
| return s.m_stringComparison; | |
| } | |
| return s.m_typedStringComparison.toStringComparison(); | |
| } | |
| @Override | |
| public void save(final StringComparisonSetting s, final NodeSettingsWO settings) { | |
| settings.addString(CONFIG_KEY, getPersistedStringComparison(s).name()); |
| { | ||
| "data" : { | ||
| "model" : { | ||
| "valueColumnPort0" : "", | ||
| "boundChoices" : { | ||
| "boundChoice" : "BOTH_BOUNDS", | ||
| "lowerColumn" : "", | ||
| "upperColumn" : "" | ||
| }, | ||
| "lowerBoundInclusive" : false, | ||
| "upperBoundInclusive" : true, | ||
| "labelColumnPort1" : "", | ||
| "noRuleMatchBehavior" : "INSERT_MISSING", | ||
| "searchPattern" : "LINEAR" | ||
| } |
There was a problem hiding this comment.
These newly added BinByDictionary snapshot baselines appear unrelated to AP-23732 (Sorter/Top-K string-comparison defaults and labels). If they’re just snapshot-regeneration side effects, they should be moved to a separate PR to keep scope focused and avoid mixing unrelated test-data changes with functional sorting changes.
|


AP-23732 (Sorter node: change default of "comparison" mode for all string-compatible types (except String and RowID) and improve labels/description)