michellethomas commented on a change in pull request #16362:
URL: https://github.com/apache/superset/pull/16362#discussion_r696888750



##########
File path: 
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndMetricSelect.tsx
##########
@@ -176,7 +186,9 @@ export const DndMetricSelect = (props: any) => {
 
   const onNewMetric = useCallback(
     (newMetric: Metric) => {
-      const newValue = props.multi ? [...value, newMetric] : [newMetric];
+      const newValue = props.multi
+        ? [...value, newMetric.metric_name]
+        : [newMetric.metric_name];

Review comment:
       @ktmud I believe this introduced a bug with dragging columns into the 
metrics section and creating a `SIMPLE` expression for the column. When you 
drag a column into the metrics section the data looks like the data listed 
below and does not have a metric_name. This leads to an undefined option being 
returned and later errors:
   ```
   aggregate: "COUNT_DISTINCT"
   column: {column_name: "target"}
   expressionType: "SIMPLE"
   hasCustomLabel: false
   isNew: false
   label: "COUNT_DISTINCT(target)"
   optionName: "metric_1vo4t2m2tjl_0nhrga77x9pf"
   sqlExpression: null
   ```




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