Skip to content

Conversation

@0xARK
Copy link
Contributor

@0xARK 0xARK commented Nov 21, 2025

I noticed that Buffer and SenderTransaction classes allows None columns values

However, the exposed Sender class does not allow this.

I just added a type hint to allow it.

Summary by CodeRabbit

Release Notes

  • New Features
    • Row insertion methods now support null values in column data, enabling more flexible handling of incomplete or optional data fields
    • Enhanced numeric type support by adding decimal number types, accommodating scenarios requiring high-precision calculations and representations

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 21, 2025

Walkthrough

The pull request expands type hints in the QuestDB ingress module to explicitly allow None and Decimal as valid column value types. Sender.row() now accepts None in column values, while Buffer.row() accepts both None and Decimal. These are type-annotation-only changes with no runtime behavior modifications.

Changes

Cohort / File(s) Summary
Type stub file
src/questdb/ingress.pyi
Updated Sender.row() to allow None in the columns parameter Union. Updated Buffer.row() to allow both None and Decimal in the columns parameter Union.
Implementation file
src/questdb/ingress.pyx
Updated Sender.row() type hints (two occurrences) to include None in the columns parameter Union, aligning with the stub file.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Changes are isolated to type hint annotations only
  • Pattern is repetitive across files and locations (same Union type expansion applied consistently)
  • No logic modifications or behavioral changes
  • Minor attention needed to verify consistency between .pyi and .pyx files

Poem

🐰 None and Decimal hop on in,
Type hints now cast a wider spin,
Columns embrace what they can hold,
A richer schema, brave and bold!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Allows None as column value in Sender row' directly describes the main change: adding None as an allowed type for column values in the Sender.row method signature.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/questdb/ingress.pyx (1)

2536-2536: Type hint correctly updated to allow None values.

The addition of None to the Union aligns the Sender.row type signature with Buffer.row and SenderTransaction.row, accurately reflecting the existing runtime behavior (lines 1122-1125 skip None values).

Optional future improvement: Consider also including TimestampNanos and Decimal in the type hint. The runtime already supports both (_column method at lines 1039-1040 for TimestampNanos and lines 1045-1046 for Decimal), and they're present in similar type hints for Buffer.row (line 1144) and SenderTransaction.row (line 654). This would improve type safety and consistency across the API.

src/questdb/ingress.pyi (1)

1036-1036: Type hint correctly updated, but consider adding missing types for consistency.

The addition of None to the Union is correct and aligns with the runtime behavior. However, there's an inconsistency in this type stub file:

  • Buffer.row (line 386) and SenderTransaction.row (line 207) include Decimal in their column type unions
  • Sender.row (line 1036) does NOT include Decimal or TimestampNanos

Since all three methods ultimately use the same serialization logic that supports Decimal and TimestampNanos, the type hints should be consistent.

Consider updating the type hint to:

Dict[str, Union[None, bool, int, float, str, TimestampMicros, TimestampNanos, datetime, np.ndarray, Decimal]]

This would match the capabilities in Buffer.row and SenderTransaction.row and accurately reflect the runtime support in the _column method (lines 1026-1057 in ingress.pyx).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50ded92 and b52faf7.

📒 Files selected for processing (2)
  • src/questdb/ingress.pyi (1 hunks)
  • src/questdb/ingress.pyx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-22T07:31:37.016Z
Learnt from: RaphDal
Repo: questdb/py-questdb-client PR: 114
File: src/questdb/ingress.pyx:192-195
Timestamp: 2025-10-22T07:31:37.016Z
Learning: In src/questdb/ingress.pyx, the IngressErrorCode.BadDataFrame enum member is Python-internal only and does not map to any C error code from the underlying library. It is defined as `<int>line_sender_error_invalid_decimal + 1` and should not be added to the c_err_code_to_py function, which only handles C-to-Python error code translation.

Applied to files:

  • src/questdb/ingress.pyx
  • src/questdb/ingress.pyi

Copy link
Collaborator

@amunra amunra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@amunra amunra merged commit 26db19b into questdb:main Nov 24, 2025
10 checks passed
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.

2 participants