Repository navigation
fix: apply #default annotation when it comes before #datatype - #732
karel-rehor merged 3 commits into
Conversation
FluxCsvParser applied the #default row right away, but the columns are only created by the #datatype row. When #default came first, the defaults were dropped and empty cells parsed as None. Keep the #default row like #group and apply it when the column names are parsed; reset it for each new table. Closes influxdata#727
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #732 +/- ##
==========================================
+ Coverage 90.43% 90.47% +0.03%
==========================================
Files 41 41
Lines 3577 3589 +12
==========================================
+ Hits 3235 3247 +12
Misses 342 342 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
karel-rehor
left a comment
There was a problem hiding this comment.
All tests pass in local venv for me.
N.B. started local development and test instance for integration tests with scripts/influxdb-restart.sh
Looks good to me as well. 🚴 🏁
* fix: apply #default annotation when it comes before #datatype FluxCsvParser applied the #default row right away, but the columns are only created by the #datatype row. When #default came first, the defaults were dropped and empty cells parsed as None. Keep the #default row like #group and apply it when the column names are parsed; reset it for each new table. Closes #727 * docs: add CHANGELOG entry for #732 --------- Co-authored-by: karel-rehor <karel-rehor@users.noreply.github.com>
Closes #727
Proposed Changes
FluxCsvParserapplied the#defaultannotation row as soon as it was read, but the table columns are only created by the#datatyperow. If#defaultcame before#datatype,add_default_empty_valueslooped over an empty column list and the defaults were lost, so empty cells were parsed asNone.The parser already keeps
#groupuntil the column-name row, so#defaultnow works the same way: the row is stored in the parser metadata and applied when the column names are parsed. It is reset when a new table starts, so one table's defaults don't carry over to the next. The usual#datatype,#group,#defaultorder gives the same result as before.Tests in
tests/test_FluxCSVParser.py:test_default_annotation_before_datatype: the reproduction from the issue (string and long defaults)test_default_annotation_before_datatype_more_tables: several tables with different annotation orders, and a check that defaults don't leak into a table without#defaultBoth fail on
masterand pass with the change. The rest oftest_FluxCSVParser.pypasses, the httpretty-basedtest_QueryApi.py/test_QueryApiDataFrame.pyresults are the same before and after (the only failures need a running InfluxDB), andflake8pluspydocstyleare clean on the changed file.I used an AI coding assistant for this change and reviewed and tested it myself.
Checklist
pytest testscompletes successfully (unit tests pass; integration tests need a running InfluxDB)