codeant-ai-for-open-source[bot] commented on code in PR #42620:
URL: https://github.com/apache/superset/pull/42620#discussion_r3692076434
##########
superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx:
##########
@@ -321,12 +352,18 @@ export const SaveDatasetModal = ({
};
const loadDatasetOverwriteOptions = useCallback(async (input = '') => {
+ // Only the table part can be filtered server-side — `database` is a
+ // relationship the list endpoint cannot match on by name. Sending the
+ // whole search as a `table_name` filter matches nothing once the user
+ // types a separator; filterAutocompleteOption narrows the qualifiers.
+ const { tableSearch } = parseQualifiedSearch(input);
+
const queryParams = rison.encode({
filters: [
{
col: 'table_name',
opr: 'ct',
- value: input,
+ value: tableSearch,
Review Comment:
**Suggestion:** When the input contains a separator, only the table-name
suffix is sent to the API and qualifier filtering is deferred to the browser.
The async select receives only the first API page, so if more than one page of
editable datasets shares that table-name suffix, a matching database/schema
dataset on a later page is never loaded and cannot be selected. Apply the
qualifier filters server-side, or request and merge all relevant pages before
client-side filtering. [logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Large table-name result sets hide editable datasets.
- ❌ Users cannot overwrite matching datasets beyond page one.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b65a4ec1b11e4522a532d744857eaf26&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b65a4ec1b11e4522a532d744857eaf26&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx
**Line:** 366:366
**Comment:**
*Logic Error: When the input contains a separator, only the table-name
suffix is sent to the API and qualifier filtering is deferred to the browser.
The async select receives only the first API page, so if more than one page of
editable datasets shares that table-name suffix, a matching database/schema
dataset on a later page is never loaded and cannot be selected. Apply the
qualifier filters server-side, or request and merge all relevant pages before
client-side filtering.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42620&comment_hash=d30a27020387323c6d15ea2a456e47691cac18f0c639071ffb2f8148551814af&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42620&comment_hash=d30a27020387323c6d15ea2a456e47691cac18f0c639071ffb2f8148551814af&reaction=dislike'>👎</a>
##########
superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx:
##########
@@ -424,7 +470,14 @@ export const SaveDatasetModal = ({
const filterAutocompleteOption = (
inputValue: string,
option: DatasetOverwriteOption,
- ) => option.value.toLowerCase().includes(inputValue.toLowerCase());
+ ) => {
+ const label = option.label.toLowerCase();
+ // Position-independent: a dataset may or may not have a catalog, and a
+ // search skipping a part (`examples.sales`) should still match.
+ return parseQualifiedSearch(inputValue.toLowerCase()).parts.every(part =>
+ label.includes(part),
+ );
Review Comment:
**Suggestion:** The client-side filter treats every qualified-search
component as an unordered substring, so a search such as `foo.bar` can match a
dataset whose label contains `bar.foo` or where one component merely occurs
inside another value. This can present unrelated datasets and make the
selection ambiguous. Match the qualified components in their actual
database/catalog/schema/table order, or use structured fields for filtering.
[incorrect condition logic]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Qualified searches can show unrelated datasets.
- ⚠️ SQL Lab overwrite selection remains ambiguous.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=34b9f28052e7401f8087c5ff5db57c4a&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=34b9f28052e7401f8087c5ff5db57c4a&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx
**Line:** 477:479
**Comment:**
*Incorrect Condition Logic: The client-side filter treats every
qualified-search component as an unordered substring, so a search such as
`foo.bar` can match a dataset whose label contains `bar.foo` or where one
component merely occurs inside another value. This can present unrelated
datasets and make the selection ambiguous. Match the qualified components in
their actual database/catalog/schema/table order, or use structured fields for
filtering.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42620&comment_hash=33d7b75202adc0df77e191f4d2074a20a3eb064be4beac74c33bfeb3e14394c6&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42620&comment_hash=33d7b75202adc0df77e191f4d2074a20a3eb064be4beac74c33bfeb3e14394c6&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]