Skip to content

fix: apply #default annotation when it comes before #datatype - #732

Open
sarankumar1325 wants to merge 2 commits into
influxdata:masterfrom
sarankumar1325:fix-csv-default-before-datatype
Open

sarankumar1325 wants to merge 2 commits into
influxdata:masterfrom
sarankumar1325:fix-csv-default-before-datatype

Conversation

@sarankumar1325

Copy link
Copy Markdown

Closes #727

Proposed Changes

FluxCsvParser applied the #default annotation row as soon as it was read, but the table columns are only created by the #datatype row. If #default came before #datatype, add_default_empty_values looped over an empty column list and the defaults were lost, so empty cells were parsed as None.

The parser already keeps #group until the column-name row, so #default now 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, #default order 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 #default

Both fail on master and pass with the change. The rest of test_FluxCSVParser.py passes, the httpretty-based test_QueryApi.py/test_QueryApiDataFrame.py results are the same before and after (the only failures need a running InfluxDB), and flake8 plus pydocstyle are clean on the changed file.

I used an AI coding assistant for this change and reviewed and tested it myself.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • pytest tests completes successfully (unit tests pass; integration tests need a running InfluxDB)
  • Commit messages are conventional
  • Sign CLA (if not already signed)

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-30T11:02:56.638494Z
We couldn’t complete this review. Comment @codex review to try again.
8a75234 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.50%. Comparing base (ef60f89) to head (7bae87e).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #732      +/-   ##
==========================================
+ Coverage   90.49%   90.50%   +0.01%     
==========================================
  Files          40       40              
  Lines        3568     3572       +4     
==========================================
+ Hits         3229     3233       +4     
  Misses        339      339              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FluxCsvParser ignores #default when the #default annotation row comes before #datatype

2 participants