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


##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/forecast.ts:
##########
@@ -26,6 +26,41 @@ import {
 } from '../types';
 import { sanitizeHtml } from './series';
 
+/**
+ * Enriches the verbose map by creating human-readable versions of compound 
field names.
+ *
+ * @param label_map — a mapping of compound keys to arrays of component labels 
(e.g., { "revenue_total_usd": ["revenue", "total", "usd"] })
+ * @param verboseMap — the existing mapping of field names to their display 
labels
+ * @returns an updated verbose map that includes human-readable versions of 
the compound keys
+ */
+export const addLabelMapToVerboseMap = (
+  label_map: Record<string, string[]>,
+  verboseMap: Record<string, string> = {},
+): Record<string, string> => {
+  /**
+   * Logic:
+   * 1. Iterates through each entry in label_map
+   * 2. For each compound key and its component labels, filters to only labels 
that have verbose mappings
+   * 3. Replaces each component label in the key with its verbose name from 
verboseMap
+   * 4. Stores the transformed key in a new map
+   * 5. Returns the original verboseMap merged with the new transformed entries
+   */
+  const newVerboseMap: Record<string, string> = {};
+
+  Object.entries(label_map).forEach(([key, labels]) => {
+    if (labels) {
+      labels
+        .filter(l => verboseMap[l])
+        .forEach(l => {
+          const newKey = key.replaceAll(l, verboseMap[l]);
+          newVerboseMap[key] = newKey;
+        });
+    }
+  });

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Logic Error in Label Replacement</b></div>
   <div id="fix">
   
   The replacement logic doesn't accumulate changes for multiple labels in a 
key, as each replaceAll starts from the original key. This could produce 
incorrect human-readable labels when multiple component labels need 
substitution, potentially affecting chart display names in forecast 
visualizations.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
     Object.entries(label_map).forEach(([key, labels]) => {
       if (labels) {
         let newKey = key;
         labels
           .filter(l => verboseMap[l])
           .forEach(l => {
             newKey = newKey.replaceAll(l, verboseMap[l]);
           });
         newVerboseMap[key] = newKey;
       }
     });
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #d67806</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/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.test.ts:
##########
@@ -0,0 +1,586 @@
+/**
+ * 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 { DatasourceType } from '@superset-ui/core';
+import transformProps from './transformProps';
+import {
+  EchartsTimeseriesChartProps,
+  EchartsTimeseriesSeriesType,
+  LegendOrientation,
+  LegendType,
+  OrientationType,
+} from '../types';
+import { EchartsMixedTimeseriesProps } from './types';
+
+const mockedProps = {
+  // Chart dimensions
+  width: 787,
+  height: 190.1953125,
+
+  // Datasource metadata
+  datasource: {
+    id: 1,
+    name: 'test_datasource',
+    type: DatasourceType.Table,
+    columns: [
+      {
+        column_name: 'ds',
+        type: 'TIMESTAMP',
+        type_generic: 2,
+        verbose_name: null,
+      },
+      {
+        column_name: 'metric_col',
+        type: 'DOUBLE PRECISION',
+        type_generic: 0,
+        verbose_name: null,
+      },
+    ],
+    metrics: [
+      {
+        certification_details: null,
+        certified_by: null,
+        currency: null,
+        d3format: null,
+        description: null,
+        expression: 'COUNT(*)',
+        id: 34,
+        is_certified: false,
+        metric_name: 'testing_count',
+        uuid: '8ec0dc91-e0ef-43e9-b74d-3b4dc3688295',
+        verbose_name: 'Testing count',
+        warning_markdown: null,
+        warning_text: null,
+      },
+      {
+        certification_details: null,
+        certified_by: null,
+        currency: null,
+        d3format: null,
+        description: null,
+        expression: 'COUNT(*)',
+        id: 17,
+        is_certified: false,
+        metric_name: 'count',
+        uuid: 'd8fc38ce-8938-4ae4-a032-8b3723f5fbd3',
+        verbose_name: 'COUNT(*)',
+        warning_markdown: '',
+        warning_text: null,
+      },
+    ],
+    columnFormats: {},
+    currencyFormats: {},
+    verboseMap: {
+      ID: 'ID',
+      __timestamp: 'Time',
+      age: 'age',
+      bootcamp_attend: 'bootcamp_attend',
+      bootcamp_finished: 'bootcamp_finished',
+      bootcamp_have_loan: 'bootcamp_have_loan',
+      bootcamp_name: 'bootcamp_name',
+      bootcamp_recommend: 'bootcamp_recommend',
+      calc_first_time_dev: 'calc_first_time_dev',
+      codeevnt_coderdojo: 'codeevnt_coderdojo',
+      codeevnt_confs: 'codeevnt_confs',
+      codeevnt_djangogrls: 'codeevnt_djangogrls',
+      codeevnt_fcc: 'codeevnt_fcc',
+      codeevnt_gamejam: 'codeevnt_gamejam',
+      codeevnt_girldevit: 'codeevnt_girldevit',
+      codeevnt_hackthn: 'codeevnt_hackthn',
+      codeevnt_meetup: 'codeevnt_meetup',
+      codeevnt_nodeschl: 'codeevnt_nodeschl',
+      codeevnt_other: 'codeevnt_other',
+      codeevnt_railsbrdg: 'codeevnt_railsbrdg',
+      codeevnt_railsgrls: 'codeevnt_railsgrls',
+      codeevnt_startupwknd: 'codeevnt_startupwknd',
+      codeevnt_wkndbtcmp: 'codeevnt_wkndbtcmp',
+      codeevnt_womenwc: 'codeevnt_womenwc',
+      codeevnt_workshps: 'codeevnt_workshps',
+      communite_time: 'communite_time',
+      count: 'COUNT(*)',
+      country_citizen: 'country_citizen',
+      country_live: 'country_live',
+      curr_field: 'curr_field',
+      debt_amt: 'debt_amt',
+      developer_type: 'Developer Type',
+      do_finance_support: 'do_finance_support',
+      ethnic_minority: 'Ethnic Minority',
+      expected_earn: 'expected_earn',
+      first_time_developer: 'First Time Developer',
+      gender: 'gender',
+      gender_other: 'gender_other',
+      has_children: 'has_children',
+      has_finance_depends: 'has_finance_depends',
+      has_high_spd_ntnet: 'has_high_spd_ntnet',
+      has_served_military: 'has_served_military',
+      highest_degree_earned: 'Highest Degree Earned',
+      home_mrtg_has: 'home_mrtg_has',
+      home_mrtg_owe: 'home_mrtg_owe',
+      hours_learning: 'hours_learning',
+      is_ethnic_minority: 'is_ethnic_minority',
+      is_first_dev_job: 'is_first_dev_job',
+      is_recv_disab_bnft: 'is_recv_disab_bnft',
+      is_self_employed: 'is_self_employed',
+      is_software_dev: 'is_software_dev',
+      job_intr_backend: 'job_intr_backend',
+      job_intr_dataengn: 'job_intr_dataengn',
+      job_intr_datasci: 'job_intr_datasci',
+      job_intr_devops: 'job_intr_devops',
+      job_intr_fllstck: 'job_intr_fllstck',
+      job_intr_frntend: 'job_intr_frntend',
+      job_intr_gamedev: 'job_intr_gamedev',
+      job_intr_infosec: 'job_intr_infosec',
+      job_intr_mobile: 'job_intr_mobile',
+      job_intr_other: 'job_intr_other',
+      job_intr_projm: 'job_intr_projm',
+      job_intr_qa_engn: 'job_intr_qa_engn',
+      job_intr_teacher: 'job_intr_teacher',
+      job_intr_ux_engn: 'job_intr_ux_engn',
+      job_lctn_pref: 'job_lctn_pref',
+      job_location_preference: 'Job Location Preference',
+      job_pref: 'job_pref',
+      job_relocate: 'job_relocate',
+      lang_at_home: 'lang_at_home',
+      last_yr_income: 'last_yr_income',
+      live_city_population: 'live_city_population',
+      marital_status: 'marital_status',
+      money_for_learning: 'money_for_learning',
+      months_job_search: 'months_job_search',
+      months_programming: 'months_programming',
+      network_id: 'network_id',
+      num_children: 'num_children',
+      podcast_changelog: 'podcast_changelog',
+      podcast_codenewbie: 'podcast_codenewbie',
+      podcast_codepenrd: 'podcast_codepenrd',
+      podcast_codingblcks: 'podcast_codingblcks',
+      podcast_devtea: 'podcast_devtea',
+      podcast_fcc: 'podcast_fcc',
+      podcast_frnthppyhr: 'podcast_frnthppyhr',
+      podcast_fullstckrd: 'podcast_fullstckrd',
+      podcast_geekspeak: 'podcast_geekspeak',
+      podcast_hanselmnts: 'podcast_hanselmnts',
+      podcast_js_jabber: 'podcast_js_jabber',
+      podcast_ltcwm: 'podcast_ltcwm',
+      podcast_other: 'podcast_other',
+      podcast_progthrwdwn: 'podcast_progthrwdwn',
+      podcast_rubyrogues: 'podcast_rubyrogues',
+      podcast_sedaily: 'podcast_sedaily',
+      podcast_seradio: 'podcast_seradio',
+      podcast_shoptalk: 'podcast_shoptalk',
+      podcast_syntaxfm: 'podcast_syntaxfm',
+      podcast_talkpythonme: 'podcast_talkpythonme',
+      reasons_to_code: 'reasons_to_code',
+      reasons_to_code_other: 'reasons_to_code_other',
+      rsrc_code_wars: 'rsrc_code_wars',
+      rsrc_codeacdm: 'rsrc_codeacdm',
+      rsrc_coursera: 'rsrc_coursera',
+      rsrc_css_tricks: 'rsrc_css_tricks',
+      rsrc_edx: 'rsrc_edx',
+      rsrc_egghead: 'rsrc_egghead',
+      rsrc_fcc: 'rsrc_fcc',
+      rsrc_frntendmstr: 'rsrc_frntendmstr',
+      rsrc_hackerrank: 'rsrc_hackerrank',
+      rsrc_khan_acdm: 'rsrc_khan_acdm',
+      rsrc_lynda: 'rsrc_lynda',
+      rsrc_mdn: 'rsrc_mdn',
+      rsrc_other: 'rsrc_other',
+      rsrc_so: 'rsrc_so',
+      rsrc_treehouse: 'rsrc_treehouse',
+      rsrc_udacity: 'rsrc_udacity',
+      rsrc_udemy: 'rsrc_udemy',
+      school_degree: 'school_degree',
+      school_major: 'school_major',
+      student_debt_amt: 'student_debt_amt',
+      student_debt_has: 'student_debt_has',
+      testing_count: 'Testing count',
+      time_end: 'time_end',
+      time_start: 'time_start',
+      time_total_sec: 'time_total_sec',
+      when_appl_job: 'when_appl_job',
+      willing_to_relocate: 'Willing To Relocate',
+      yt_codingtrain: 'yt_codingtrain',
+      yt_codingtuts360: 'yt_codingtuts360',
+      yt_computerphile: 'yt_computerphile',
+      yt_cs_dojo: 'yt_cs_dojo',
+      yt_derekbanas: 'yt_derekbanas',
+      yt_devtips: 'yt_devtips',
+      yt_engn_truth: 'yt_engn_truth',
+      yt_fcc: 'yt_fcc',
+      yt_funfunfunct: 'yt_funfunfunct',
+      yt_googledevs: 'yt_googledevs',
+      yt_learncodeacdm: 'yt_learncodeacdm',
+      yt_lvluptuts: 'yt_lvluptuts',
+      yt_mit_ocw: 'yt_mit_ocw',
+      yt_mozillahacks: 'yt_mozillahacks',
+      yt_other: 'yt_other',
+      yt_simpleprog: 'yt_simpleprog',
+      yt_simplilearn: 'yt_simplilearn',
+    },
+  },
+
+  // Query results
+  queriesData: [
+    {
+      cache_key:
+        '31d61dc7e361c5625b82735b41ebf8a9d9829f73d119057cdb94aea77120ec82',
+      cached_dttm: '2026-01-18T05:01:57',
+      queried_dttm: '2026-01-18T05:01:57+00:00',
+      cache_timeout: 300,
+      applied_template_filters: [],
+      annotation_data: {},
+      error: null,
+      is_cached: true,
+      query:
+        "SELECT DATE_TRUNC('day', time_start) AS time_start, 
sum(money_for_learning) AS \"SUM(money_for_learning)\", COUNT(*) AS 
testing_count \nFROM main.\"FCC 2018 Survey\" \nWHERE time_start >= '2018-08-01 
00:00:00.000000' AND time_start < '2026-01-17 00:00:00.000000' GROUP BY 
DATE_TRUNC('day', time_start) ORDER BY \"SUM(money_for_learning)\" DESC \n 
LIMIT 10000;\n\nSELECT DATE_TRUNC('day', time_start) AS time_start, 
sum(money_for_learning) AS \"SUM(money_for_learning)\", COUNT(*) AS 
testing_count \nFROM main.\"FCC 2018 Survey\" \nWHERE time_start >= '2018-07-31 
00:00:00.000000' AND time_start < '2026-01-16 00:00:00.000000' AND time_start 
>= '2018-07-31 00:00:00.000000' AND time_start < '2026-01-16 00:00:00.000000' 
GROUP BY DATE_TRUNC('day', time_start) ORDER BY \"SUM(money_for_learning)\" 
DESC \n LIMIT 50000;\n\nSELECT DATE_TRUNC('day', time_start) AS time_start, 
sum(money_for_learning) AS \"SUM(money_for_learning)\", COUNT(*) AS 
testing_count \nFROM main.\"FCC 2018 Survey\" \nW
 HERE time_start >= '2018-07-25 00:00:00.000000' AND time_start < '2026-01-10 
00:00:00.000000' AND time_start >= '2018-07-25 00:00:00.000000' AND time_start 
< '2026-01-10 00:00:00.000000' GROUP BY DATE_TRUNC('day', time_start) ORDER BY 
\"SUM(money_for_learning)\" DESC \n LIMIT 50000;\n\nSELECT DATE_TRUNC('day', 
time_start) AS time_start, sum(money_for_learning) AS 
\"SUM(money_for_learning)\", COUNT(*) AS testing_count \nFROM main.\"FCC 2018 
Survey\" \nWHERE time_start >= '2017-08-01 00:00:00.000000' AND time_start < 
'2025-01-17 00:00:00.000000' AND time_start >= '2017-08-01 00:00:00.000000' AND 
time_start < '2025-01-17 00:00:00.000000' GROUP BY DATE_TRUNC('day', 
time_start) ORDER BY \"SUM(money_for_learning)\" DESC \n LIMIT 50000;\n\n",
+      status: 'success',
+      stacktrace: null,
+      rowcount: 85,
+      sql_rowcount: 85,
+      from_dttm: 1533081600000,
+      to_dttm: 1768608000000,
+      label_map: {
+        time_start: ['time_start'],
+        'SUM(money_for_learning)': ['SUM(money_for_learning)'],
+        'SUM(money_for_learning), 1 day ago': [
+          'SUM(money_for_learning)',
+          '1 day ago',
+        ],
+        'SUM(money_for_learning), 1 week ago': [
+          'SUM(money_for_learning)',
+          '1 week ago',
+        ],
+        'SUM(money_for_learning), 1 year ago': [
+          'SUM(money_for_learning)',
+          '1 year ago',
+        ],
+        testing_count: ['testing_count'],
+        'testing_count, 1 day ago': ['testing_count', '1 day ago'],
+        'testing_count, 1 week ago': ['testing_count', '1 week ago'],
+        'testing_count, 1 year ago': ['testing_count', '1 year ago'],
+        'Testing count': ['testing_count'],
+      },
+      colnames: [
+        'time_start',
+        'SUM(money_for_learning)',
+        'SUM(money_for_learning), 1 day ago',
+        'SUM(money_for_learning), 1 week ago',
+        'SUM(money_for_learning), 1 year ago',
+        'testing_count',
+        'testing_count, 1 day ago',
+        'testing_count, 1 week ago',
+        'testing_count, 1 year ago',
+      ],
+      indexnames: [0, 1, 2],
+      coltypes: [2, 0, 0, 0, 1, 0, 0, 0, 1],
+      data: [
+        {
+          time_start: 1533081600001,
+          'SUM(money_for_learning)': 101,
+          'SUM(money_for_learning), 1 day ago': null,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 1,
+          'testing_count, 1 day ago': null,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+        {
+          time_start: 1533168000001,
+          'SUM(money_for_learning)': 5791,
+          'SUM(money_for_learning), 1 day ago': 101,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 131,
+          'testing_count, 1 day ago': 11,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Mismatched x-axis column in test mocks</b></div>
   <div id="fix">
   
   The mocked queriesData uses 'time_start' as the x-axis column key in data 
objects, but formData.x_axis is 'ds', causing a mismatch. This leads to 
incorrect series extraction where 'time_start' may be treated as a series 
instead of the x-axis, resulting in erroneous legend entries and potential test 
failures.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #d67806</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/plugins/plugin-chart-echarts/src/utils/forecast.test.ts:
##########
@@ -0,0 +1,41 @@
+/**
+ * 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 { addLabelMapToVerboseMap } from './forecast';
+
+describe('echarts forecast', () => {
+  it('Should add label map to verbose map correctly', () => {
+    const result = addLabelMapToVerboseMap(
+      {
+        testing_count: ['testing_count'],
+        'testing_count, 1 day ago': ['testing_count', '1 day ago'],
+        'testing_count, 1 week ago': ['testing_count', '1 week ago'],
+      },
+      {
+        testing_count: 'Testing count',
+      },
+    );
+
+    expect(result).toEqual({
+      testing_count: 'Testing count',
+      'testing_count, 1 day ago': 'Testing count, 1 day ago',
+      'testing_count, 1 week ago': 'Testing count, 1 week ago',
+    });
+  });
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Insufficient test coverage for label 
replacements</b></div>
   <div id="fix">
   
   The current test only verifies behavior when at most one label per key has a 
verbose mapping, but the function's logic suggests it should replace all 
matching labels cumulatively. This misses cases where multiple labels in the 
array have mappings, potentially hiding a bug in the implementation where 
replacements aren't accumulated properly.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
     it('Should handle multiple matching labels in a key', () => {
       const result = addLabelMapToVerboseMap(
         {
           'testing_count and testing_count': ['testing_count'],
         },
         {
           testing_count: 'Testing count',
         },
       );
   
       expect(result).toEqual({
         testing_count: 'Testing count',
         'testing_count and testing_count': 'Testing count and Testing count',
       });
     });
   
     it('Should handle empty label_map', () => {
       const result = addLabelMapToVerboseMap(
         {},
         {
           testing_count: 'Testing count',
         },
       );
   
       expect(result).toEqual({
         testing_count: 'Testing count',
       });
     });
   
     it('Should handle empty labels array', () => {
       const result = addLabelMapToVerboseMap(
         {
           'some_key': [],
         },
         {
           testing_count: 'Testing count',
         },
       );
   
       expect(result).toEqual({
         testing_count: 'Testing count',
       });
     });
   });
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/5c97dc8/.cursor/rules/dev-standard.mdc#L22";>dev-standard.mdc:22</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #d67806</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/plugins/plugin-chart-echarts/src/Timeseries/transformProps.test.ts:
##########
@@ -0,0 +1,461 @@
+/**
+ * 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 { DatasourceType } from '@superset-ui/core';
+import transformProps from './transformProps';
+import {
+  EchartsTimeseriesChartProps,
+  EchartsTimeseriesSeriesType,
+  OrientationType,
+} from './types';
+import { LegendOrientation, LegendType } from '../types';
+
+const mockedProps = {
+  // Chart dimensions
+  width: 787,
+  height: 190.1953125,
+
+  // Datasource metadata
+  datasource: {
+    id: 1,
+    name: 'test_datasource',
+    type: DatasourceType.Table,
+    columns: [
+      {
+        column_name: 'ds',
+        type: 'TIMESTAMP',
+        type_generic: 2,
+        verbose_name: null,
+      },
+      {
+        column_name: 'metric_col',
+        type: 'DOUBLE PRECISION',
+        type_generic: 0,
+        verbose_name: null,
+      },
+    ],
+    metrics: [
+      {
+        certification_details: null,
+        certified_by: null,
+        currency: null,
+        d3format: null,
+        description: null,
+        expression: 'COUNT(*)',
+        id: 34,
+        is_certified: false,
+        metric_name: 'testing_count',
+        uuid: '8ec0dc91-e0ef-43e9-b74d-3b4dc3688295',
+        verbose_name: 'Testing count',
+        warning_markdown: null,
+        warning_text: null,
+      },
+      {
+        certification_details: null,
+        certified_by: null,
+        currency: null,
+        d3format: null,
+        description: null,
+        expression: 'COUNT(*)',
+        id: 17,
+        is_certified: false,
+        metric_name: 'count',
+        uuid: 'd8fc38ce-8938-4ae4-a032-8b3723f5fbd3',
+        verbose_name: 'COUNT(*)',
+        warning_markdown: '',
+        warning_text: null,
+      },
+    ],
+    columnFormats: {},
+    currencyFormats: {},
+    verboseMap: {
+      ID: 'ID',
+      __timestamp: 'Time',
+      age: 'age',
+      bootcamp_attend: 'bootcamp_attend',
+      bootcamp_finished: 'bootcamp_finished',
+      bootcamp_have_loan: 'bootcamp_have_loan',
+      bootcamp_name: 'bootcamp_name',
+      bootcamp_recommend: 'bootcamp_recommend',
+      calc_first_time_dev: 'calc_first_time_dev',
+      codeevnt_coderdojo: 'codeevnt_coderdojo',
+      codeevnt_confs: 'codeevnt_confs',
+      codeevnt_djangogrls: 'codeevnt_djangogrls',
+      codeevnt_fcc: 'codeevnt_fcc',
+      codeevnt_gamejam: 'codeevnt_gamejam',
+      codeevnt_girldevit: 'codeevnt_girldevit',
+      codeevnt_hackthn: 'codeevnt_hackthn',
+      codeevnt_meetup: 'codeevnt_meetup',
+      codeevnt_nodeschl: 'codeevnt_nodeschl',
+      codeevnt_other: 'codeevnt_other',
+      codeevnt_railsbrdg: 'codeevnt_railsbrdg',
+      codeevnt_railsgrls: 'codeevnt_railsgrls',
+      codeevnt_startupwknd: 'codeevnt_startupwknd',
+      codeevnt_wkndbtcmp: 'codeevnt_wkndbtcmp',
+      codeevnt_womenwc: 'codeevnt_womenwc',
+      codeevnt_workshps: 'codeevnt_workshps',
+      communite_time: 'communite_time',
+      count: 'COUNT(*)',
+      country_citizen: 'country_citizen',
+      country_live: 'country_live',
+      curr_field: 'curr_field',
+      debt_amt: 'debt_amt',
+      developer_type: 'Developer Type',
+      do_finance_support: 'do_finance_support',
+      ethnic_minority: 'Ethnic Minority',
+      expected_earn: 'expected_earn',
+      first_time_developer: 'First Time Developer',
+      gender: 'gender',
+      gender_other: 'gender_other',
+      has_children: 'has_children',
+      has_finance_depends: 'has_finance_depends',
+      has_high_spd_ntnet: 'has_high_spd_ntnet',
+      has_served_military: 'has_served_military',
+      highest_degree_earned: 'Highest Degree Earned',
+      home_mrtg_has: 'home_mrtg_has',
+      home_mrtg_owe: 'home_mrtg_owe',
+      hours_learning: 'hours_learning',
+      is_ethnic_minority: 'is_ethnic_minority',
+      is_first_dev_job: 'is_first_dev_job',
+      is_recv_disab_bnft: 'is_recv_disab_bnft',
+      is_self_employed: 'is_self_employed',
+      is_software_dev: 'is_software_dev',
+      job_intr_backend: 'job_intr_backend',
+      job_intr_dataengn: 'job_intr_dataengn',
+      job_intr_datasci: 'job_intr_datasci',
+      job_intr_devops: 'job_intr_devops',
+      job_intr_fllstck: 'job_intr_fllstck',
+      job_intr_frntend: 'job_intr_frntend',
+      job_intr_gamedev: 'job_intr_gamedev',
+      job_intr_infosec: 'job_intr_infosec',
+      job_intr_mobile: 'job_intr_mobile',
+      job_intr_other: 'job_intr_other',
+      job_intr_projm: 'job_intr_projm',
+      job_intr_qa_engn: 'job_intr_qa_engn',
+      job_intr_teacher: 'job_intr_teacher',
+      job_intr_ux_engn: 'job_intr_ux_engn',
+      job_lctn_pref: 'job_lctn_pref',
+      job_location_preference: 'Job Location Preference',
+      job_pref: 'job_pref',
+      job_relocate: 'job_relocate',
+      lang_at_home: 'lang_at_home',
+      last_yr_income: 'last_yr_income',
+      live_city_population: 'live_city_population',
+      marital_status: 'marital_status',
+      money_for_learning: 'money_for_learning',
+      months_job_search: 'months_job_search',
+      months_programming: 'months_programming',
+      network_id: 'network_id',
+      num_children: 'num_children',
+      podcast_changelog: 'podcast_changelog',
+      podcast_codenewbie: 'podcast_codenewbie',
+      podcast_codepenrd: 'podcast_codepenrd',
+      podcast_codingblcks: 'podcast_codingblcks',
+      podcast_devtea: 'podcast_devtea',
+      podcast_fcc: 'podcast_fcc',
+      podcast_frnthppyhr: 'podcast_frnthppyhr',
+      podcast_fullstckrd: 'podcast_fullstckrd',
+      podcast_geekspeak: 'podcast_geekspeak',
+      podcast_hanselmnts: 'podcast_hanselmnts',
+      podcast_js_jabber: 'podcast_js_jabber',
+      podcast_ltcwm: 'podcast_ltcwm',
+      podcast_other: 'podcast_other',
+      podcast_progthrwdwn: 'podcast_progthrwdwn',
+      podcast_rubyrogues: 'podcast_rubyrogues',
+      podcast_sedaily: 'podcast_sedaily',
+      podcast_seradio: 'podcast_seradio',
+      podcast_shoptalk: 'podcast_shoptalk',
+      podcast_syntaxfm: 'podcast_syntaxfm',
+      podcast_talkpythonme: 'podcast_talkpythonme',
+      reasons_to_code: 'reasons_to_code',
+      reasons_to_code_other: 'reasons_to_code_other',
+      rsrc_code_wars: 'rsrc_code_wars',
+      rsrc_codeacdm: 'rsrc_codeacdm',
+      rsrc_coursera: 'rsrc_coursera',
+      rsrc_css_tricks: 'rsrc_css_tricks',
+      rsrc_edx: 'rsrc_edx',
+      rsrc_egghead: 'rsrc_egghead',
+      rsrc_fcc: 'rsrc_fcc',
+      rsrc_frntendmstr: 'rsrc_frntendmstr',
+      rsrc_hackerrank: 'rsrc_hackerrank',
+      rsrc_khan_acdm: 'rsrc_khan_acdm',
+      rsrc_lynda: 'rsrc_lynda',
+      rsrc_mdn: 'rsrc_mdn',
+      rsrc_other: 'rsrc_other',
+      rsrc_so: 'rsrc_so',
+      rsrc_treehouse: 'rsrc_treehouse',
+      rsrc_udacity: 'rsrc_udacity',
+      rsrc_udemy: 'rsrc_udemy',
+      school_degree: 'school_degree',
+      school_major: 'school_major',
+      student_debt_amt: 'student_debt_amt',
+      student_debt_has: 'student_debt_has',
+      testing_count: 'Testing count',
+      time_end: 'time_end',
+      time_start: 'time_start',
+      time_total_sec: 'time_total_sec',
+      when_appl_job: 'when_appl_job',
+      willing_to_relocate: 'Willing To Relocate',
+      yt_codingtrain: 'yt_codingtrain',
+      yt_codingtuts360: 'yt_codingtuts360',
+      yt_computerphile: 'yt_computerphile',
+      yt_cs_dojo: 'yt_cs_dojo',
+      yt_derekbanas: 'yt_derekbanas',
+      yt_devtips: 'yt_devtips',
+      yt_engn_truth: 'yt_engn_truth',
+      yt_fcc: 'yt_fcc',
+      yt_funfunfunct: 'yt_funfunfunct',
+      yt_googledevs: 'yt_googledevs',
+      yt_learncodeacdm: 'yt_learncodeacdm',
+      yt_lvluptuts: 'yt_lvluptuts',
+      yt_mit_ocw: 'yt_mit_ocw',
+      yt_mozillahacks: 'yt_mozillahacks',
+      yt_other: 'yt_other',
+      yt_simpleprog: 'yt_simpleprog',
+      yt_simplilearn: 'yt_simplilearn',
+    },
+  },
+
+  // Query results
+  queriesData: [
+    {
+      cache_key:
+        '31d61dc7e361c5625b82735b41ebf8a9d9829f73d119057cdb94aea77120ec82',
+      cached_dttm: '2026-01-18T05:01:57',
+      queried_dttm: '2026-01-18T05:01:57+00:00',
+      cache_timeout: 300,
+      applied_template_filters: [],
+      annotation_data: {},
+      error: null,
+      is_cached: true,
+      query:
+        "SELECT DATE_TRUNC('day', time_start) AS time_start, 
sum(money_for_learning) AS \"SUM(money_for_learning)\", COUNT(*) AS 
testing_count \nFROM main.\"FCC 2018 Survey\" \nWHERE time_start >= '2018-08-01 
00:00:00.000000' AND time_start < '2026-01-17 00:00:00.000000' GROUP BY 
DATE_TRUNC('day', time_start) ORDER BY \"SUM(money_for_learning)\" DESC \n 
LIMIT 10000;\n\nSELECT DATE_TRUNC('day', time_start) AS time_start, 
sum(money_for_learning) AS \"SUM(money_for_learning)\", COUNT(*) AS 
testing_count \nFROM main.\"FCC 2018 Survey\" \nWHERE time_start >= '2018-07-31 
00:00:00.000000' AND time_start < '2026-01-16 00:00:00.000000' AND time_start 
>= '2018-07-31 00:00:00.000000' AND time_start < '2026-01-16 00:00:00.000000' 
GROUP BY DATE_TRUNC('day', time_start) ORDER BY \"SUM(money_for_learning)\" 
DESC \n LIMIT 50000;\n\nSELECT DATE_TRUNC('day', time_start) AS time_start, 
sum(money_for_learning) AS \"SUM(money_for_learning)\", COUNT(*) AS 
testing_count \nFROM main.\"FCC 2018 Survey\" \nW
 HERE time_start >= '2018-07-25 00:00:00.000000' AND time_start < '2026-01-10 
00:00:00.000000' AND time_start >= '2018-07-25 00:00:00.000000' AND time_start 
< '2026-01-10 00:00:00.000000' GROUP BY DATE_TRUNC('day', time_start) ORDER BY 
\"SUM(money_for_learning)\" DESC \n LIMIT 50000;\n\nSELECT DATE_TRUNC('day', 
time_start) AS time_start, sum(money_for_learning) AS 
\"SUM(money_for_learning)\", COUNT(*) AS testing_count \nFROM main.\"FCC 2018 
Survey\" \nWHERE time_start >= '2017-08-01 00:00:00.000000' AND time_start < 
'2025-01-17 00:00:00.000000' AND time_start >= '2017-08-01 00:00:00.000000' AND 
time_start < '2025-01-17 00:00:00.000000' GROUP BY DATE_TRUNC('day', 
time_start) ORDER BY \"SUM(money_for_learning)\" DESC \n LIMIT 50000;\n\n",
+      status: 'success',
+      stacktrace: null,
+      rowcount: 85,
+      sql_rowcount: 85,
+      from_dttm: 1533081600000,
+      to_dttm: 1768608000000,
+      label_map: {
+        time_start: ['time_start'],
+        'SUM(money_for_learning)': ['SUM(money_for_learning)'],
+        'SUM(money_for_learning), 1 day ago': [
+          'SUM(money_for_learning)',
+          '1 day ago',
+        ],
+        'SUM(money_for_learning), 1 week ago': [
+          'SUM(money_for_learning)',
+          '1 week ago',
+        ],
+        'SUM(money_for_learning), 1 year ago': [
+          'SUM(money_for_learning)',
+          '1 year ago',
+        ],
+        testing_count: ['testing_count'],
+        'testing_count, 1 day ago': ['testing_count', '1 day ago'],
+        'testing_count, 1 week ago': ['testing_count', '1 week ago'],
+        'testing_count, 1 year ago': ['testing_count', '1 year ago'],
+        'Testing count': ['testing_count'],
+      },
+      colnames: [
+        'time_start',
+        'SUM(money_for_learning)',
+        'SUM(money_for_learning), 1 day ago',
+        'SUM(money_for_learning), 1 week ago',
+        'SUM(money_for_learning), 1 year ago',
+        'testing_count',
+        'testing_count, 1 day ago',
+        'testing_count, 1 week ago',
+        'testing_count, 1 year ago',
+      ],
+      indexnames: [0, 1, 2],
+      coltypes: [2, 0, 0, 0, 1, 0, 0, 0, 1],
+      data: [
+        {
+          time_start: 1533081600000,
+          'SUM(money_for_learning)': 100,
+          'SUM(money_for_learning), 1 day ago': null,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 1,
+          'testing_count, 1 day ago': null,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+        {
+          time_start: 1533168000000,
+          'SUM(money_for_learning)': 5790,
+          'SUM(money_for_learning), 1 day ago': 100,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 13,
+          'testing_count, 1 day ago': 1,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+      ],
+      result_format: 'json',
+      applied_filters: [
+        {
+          column: 'time_start',
+        },
+      ],
+      rejected_filters: [],
+    },
+  ] as unknown as EchartsTimeseriesChartProps['queriesData'],
+
+  // Filter and legend state
+  filterState: {
+    selectedValues: [],
+  },
+  legendState: {},
+
+  // Form data (chart configuration)
+  formData: {
+    area: false,
+    annotationLayers: [],
+    colorScheme: 'supersetColors',
+    forecastEnabled: false,
+    groupby: [],
+    legendOrientation: LegendOrientation.Top,
+    legendType: LegendType.Scroll,
+    legendMargin: 0,
+    legendSort: null,
+    logAxis: false,
+    markerEnabled: false,
+    markerSize: 6,
+    metrics: [
+      {
+        aggregate: 'SUM',
+        column: {
+          column_name: 'money_for_learning',
+          description: null,
+          expression: null,
+          filterable: true,
+          groupby: true,
+          id: 460,
+          is_dttm: false,
+          python_date_format: null,
+          type: 'DOUBLE PRECISION',
+          type_generic: 0,
+          verbose_name: null,
+        },
+        expressionType: 'SIMPLE',
+        hasCustomLabel: false,
+        label: 'SUM(money_for_learning)',
+        optionName: 'metric_olnflt1ak9g_z1vjg3dhmnf',
+      },
+      'testing_count',
+    ],
+    minorSplitLine: false,
+    minorTicks: false,
+    onlyTotal: false,
+    opacity: 0.2,
+    orientation: OrientationType.Vertical,
+    percentageThreshold: 0,
+    richTooltip: true,
+    seriesType: EchartsTimeseriesSeriesType.Line,
+    showLegend: true,
+    showValue: false,
+    sliceId: 1,
+    sortSeriesType: 'name',
+    sortSeriesAscending: true,
+    forceMaxInterval: false,
+    timeCompare: [],
+    stack: null,
+    tooltipTimeFormat: '%Y-%m-%d',
+    tooltipSortByMetric: false,
+    showTooltipTotal: false,
+    showTooltipPercentage: false,
+    truncateXAxis: false,
+    truncateYAxis: false,
+    xAxis: 'ds',
+    xAxisBounds: [null, null],
+    xAxisForceCategorical: false,
+    xAxisLabelRotation: 0,
+    xAxisLabelInterval: 0,
+    xAxisSort: 'asc',
+    xAxisSortAsc: true,
+    xAxisTimeFormat: '%Y-%m-%d',
+    xAxisNumberFormat: '.3~s',
+    xAxisTitle: '',
+    xAxisTitleMargin: 0,
+    yAxisBounds: [null, null],
+    yAxisFormat: '.3~s',
+    currencyFormat: null,
+    yAxisTitle: '',
+    yAxisTitleMargin: 0,
+    yAxisTitlePosition: 'Left',
+    zoomable: false,
+  } as unknown as EchartsTimeseriesChartProps['formData'],
+
+  // Hooks
+  hooks: {
+    setDataMask: () => {},
+    setControlValue: () => {},
+    onContextMenu: () => {},
+    onLegendStateChanged: () => {},
+    onLegendScroll: () => {},
+  },
+
+  // UI state
+  inContextMenu: false,
+  emitCrossFilters: true,
+  legendIndex: 0,
+
+  // Raw form data (needed for additional validation)
+  rawFormData: {
+    datasource: '1__table',
+    viz_type: 'echarts_timeseries',
+    x_axis: 'ds',
+    time_compare: [],
+  } as unknown as EchartsTimeseriesChartProps['rawFormData'],
+
+  // Theme
+  theme: {},
+} as unknown as EchartsTimeseriesChartProps;
+
+describe('Timeseries transformProps', () => {
+  it('Should transform props correctly', () => {
+    const result = transformProps(mockedProps);
+
+    expect(result.coltypeMapping).toEqual({
+      'SUM(money_for_learning)': 0,
+      'SUM(money_for_learning), 1 day ago': 0,
+      'SUM(money_for_learning), 1 week ago': 0,
+      'SUM(money_for_learning), 1 year ago': 1,
+      testing_count: 0,
+      'testing_count, 1 day ago': 0,
+      'testing_count, 1 week ago': 0,
+      'testing_count, 1 year ago': 1,
+      time_start: 2,
+    });
+
+    expect(result.legendData).toEqual([
+      'SUM(money_for_learning)',
+      'SUM(money_for_learning), 1 day ago',
+      'SUM(money_for_learning), 1 week ago',
+      'SUM(money_for_learning), 1 year ago',
+      'Testing count',
+      'Testing count, 1 day ago',
+      'Testing count, 1 week ago',
+      'Testing count, 1 year ago',
+      'time_start',
+    ]);

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Incorrect test expectation</b></div>
   <div id="fix">
   
   The test expects 'time_start' in legendData, but the transformProps code 
does not include the x-axis column in legendData for timeseries charts. This 
will cause the test to fail or pass incorrectly.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #d67806</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]


Reply via email to