bito-code-review[bot] commented on code in PR #43863: URL: https://github.com/apache/superset/pull/43863#discussion_r4078166459
########## superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/EchartsCandlestick.tsx: ########## @@ -0,0 +1,167 @@ +/** + * 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 { useRef } from 'react'; +import { + BinaryQueryObjectFilterClause, + TimeGranularity, +} from '@superset-ui/core'; +import { GenericDataType } from '@apache-superset/core/common'; +import Echart from '../components/Echart'; +import { EchartsHandler, EventHandlers } from '../types'; +import { CandlestickChartTransformedProps } from './types'; + +type ContextMenuEvent = { + event?: { stop?: () => void; event?: PointerEvent }; + dataIndex?: number; + seriesName?: string; + seriesType?: string; +}; + +function toFilterValue(value: unknown): string | number | boolean | null { + if (value == null) { + return null; + } + if (value instanceof Date) { + return value.valueOf(); + } + if ( + typeof value === 'string' || + typeof value === 'number' || + typeof value === 'boolean' + ) { + return value; + } + return String(value); +} + +function toFilterClause( + col: string, + value: unknown, + formattedVal: string, + grain?: TimeGranularity, +): BinaryQueryObjectFilterClause { + return { + col, + op: '==', + val: toFilterValue(value), Review Comment: <div> <div id="suggestion"> <div id="issue"><b>CWE-703: Null filter regression</b></div> <div id="fix"> The removed null check changes behavior: `toFilterValue` (lines 36-51) returns `null` for null/undefined x-values, so the clause is now `{ op: '==', val: null }`. Backend `get_sqla_query` (`models/helpers.py` skips the None-value validation for EQUALS) renders `col = NULL` via `handle_comparison_filter`, which never matches, so drill-to-detail on a null x-category returns no rows. Sibling charts (`EchartsTimeseries.tsx:370`, `EchartsTreemap.tsx:78`) still emit `op: 'IS NULL'`. Please restore the IS NULL branch. ([CWE-703](https://cwe.mitre.org/data/definitions/703.html)) </div> </div> <small><i>Code Review Run #a03ce0</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/translations/messages.pot: ########## @@ -18566,6 +18664,9 @@ msgstr "" msgid "value descending" msgstr "" +msgid "valuename" +msgstr "" + Review Comment: <div> <div id="suggestion"> <div id="issue"><b>Stale pot msgid valuename</b></div> <div id="fix"> msgid "valuename" is not extractable from source: no superset/**.py, template, or frontend file mapped by superset/translations/babel.cfg contains this literal, so a fresh extraction drops it and scripts/translations/check_pot_drift.py (CI: superset-translations.yml) fails on a stale template entry. Remove the entry or regenerate via scripts/translations/babel_update.sh. </div> </div> <small><i>Code Review Run #a03ce0</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]
