bito-code-review[bot] commented on code in PR #39257:
URL: https://github.com/apache/superset/pull/39257#discussion_r4140359746


##########
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:
   <!-- Bito Reply -->
   The suggestion provided by the reviewer is appropriate as it simplifies the 
code by removing duplication and improving maintainability. Applying this 
change is recommended as it correctly implements the requested refactoring.
   
   
**superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx**
   ```
   const tableColumns = [
       'column_name',
       ...(showExpression ? ['expression'] : []),
       ...(isFeatureEnabled(FeatureFlag.EnableAdvancedDataTypes) ? 
['advanced_data_type'] : []),
       'type',
       'is_dttm',
       'filterable',
       'groupby',
     ];
   ```



##########
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:
   <!-- Bito Reply -->
   The change to consolidate the expression renderer into a single 
`renderExpressionCell` function is a positive improvement. It effectively 
addresses the duplication issue by centralizing the logic, which simplifies 
maintenance and ensures consistency when the SQL editor props are updated.



-- 
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]

Reply via email to