bito-code-review[bot] commented on code in PR #39257:
URL: https://github.com/apache/superset/pull/39257#discussion_r4130964396
##########
superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx:
##########
@@ -561,32 +589,29 @@ function ColumnCollectionTable({
filterTerm,
filterFields,
}: ColumnCollectionTableProps): JSX.Element {
+ const tableColumns = isFeatureEnabled(FeatureFlag.EnableAdvancedDataTypes)
+ ? [
+ 'column_name',
+ ...(showExpression ? ['expression'] : []),
+ 'advanced_data_type',
+ 'type',
+ 'is_dttm',
+ 'filterable',
+ 'groupby',
+ ]
+ : [
+ 'column_name',
+ ...(showExpression ? ['expression'] : []),
+ 'type',
+ 'is_dttm',
+ 'filterable',
+ 'groupby',
+ ];
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Duplicated column list</b></div>
<div id="fix">
The `tableColumns` array is duplicated in both branches of the
`isFeatureEnabled` ternary, differing only by `advanced_data_type`. Compose the
list once (e.g. spread a base array and conditionally add `advanced_data_type`)
to avoid drift.
</div>
</div>
<small><i>Code Review Run #80ced2</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx:
##########
@@ -769,6 +800,18 @@ function ColumnCollectionTable({
),
type: d => (d ? <Label>{String(d)}</Label> : null),
advanced_data_type: d => <Label>{d as string}</Label>,
+ expression: (v, onChange) => (
+ <TextAreaControl
+ initialValue={v as string}
+ onChange={onChange}
+ className="datasource-sql-expression"
+ language="sql"
+ offerEditInModal={false}
+ minLines={5}
+ textAreaStyles={{ minWidth: '100%', maxWidth: 'none' }}
+ resize="both"
+ />
+ ),
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Duplicated expression renderer</b></div>
<div id="fix">
The `expression` TextAreaControl renderer is duplicated verbatim in both
branches of the `isFeatureEnabled` ternary (lines 803-814 and 843-854). Extract
it to one shared renderer to avoid divergence when the SQL editor props change.
</div>
</div>
<small><i>Code Review Run #80ced2</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]