villebro commented on code in PR #21163:
URL: https://github.com/apache/superset/pull/21163#discussion_r961412641


##########
superset-frontend/packages/superset-ui-chart-controls/src/sections/sections.tsx:
##########
@@ -38,6 +38,19 @@ export const legacyTimeseriesTime: ControlPanelSectionConfig 
= {
   ],
 };
 
+export const echartsTimeseriesTime: ControlPanelSectionConfig = {

Review Comment:
   Would it make to call this `genericTime` or `genericTimeSection`? Just to 
decouple it more from the ECharts plugin.



##########
superset/utils/core.py:
##########
@@ -1263,6 +1263,17 @@ def is_adhoc_column(column: Column) -> 
TypeGuard[AdhocColumn]:
     return isinstance(column, dict)
 
 
+def get_axis_column(columns: Optional[List[Column]]) -> Optional[AdhocColumn]:

Review Comment:
   Should probably be renamed if we go with `BASE_AXIS`



##########
superset-frontend/packages/superset-ui-core/src/query/normalizeTimeColumn.ts:
##########
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import omit from 'lodash/omit';
+
+import {
+  AdhocColumn,
+  isAdhocColumn,
+  isPhysicalColumn,
+  QueryFormColumn,
+  QueryFormData,
+  QueryObject,
+} from './types';
+import { FeatureFlag, isFeatureEnabled } from '../utils';
+
+export function normalizeTimeColumn(
+  formData: QueryFormData,
+  queryObject: QueryObject,
+): QueryObject {
+  if (!isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)) {
+    return queryObject;
+  }
+  if (isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) && !formData.x_axis) {
+    return queryObject;
+  }
+
+  const mutatedColumns: QueryFormColumn[] = [...(queryObject.columns || [])];
+  const axisIdx = queryObject.columns?.findIndex(

Review Comment:
   This can be very subjective and different for different people, but in 
general I find narrower and longer code snippets more readable than wider and 
shorter. In this case I find @michael-s-molina 's destructuring approach more 
readable. Having said that I'm ok with both approaches, as long as the 
function/file follows a similar pattern throughout.



##########
superset/connectors/sqla/utils.py:
##########
@@ -137,7 +139,7 @@ def get_virtual_table_metadata(dataset: "SqlaTable") -> 
List[ResultSetColumnType
     try:
         with closing(engine.raw_connection()) as conn:
             cursor = conn.cursor()
-            query = dataset.database.apply_limit_to_sql(statements[0])
+            query = dataset.database.apply_limit_to_sql(statements[0], limit=1)

Review Comment:
   Nice improvement 👍 



##########
superset-frontend/packages/superset-ui-core/src/query/types/Column.ts:
##########
@@ -27,6 +27,8 @@ export interface AdhocColumn {
   optionName?: string;
   sqlExpression: string;
   expressionType: 'SQL';
+  columnType?: 'AXIS' | 'SERIES';

Review Comment:
   To be more explicit, I think `BASE_AXIS` could be more clear, as `AXIS` 
could refer to the either axis (it could be argued that `SERIES` is on the 
`VALUE_AXIS` or similar).
   ```suggestion
     columnType?: 'BASE_AXIS' | 'SERIES';
   ```



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