Skip to content

fix(sql): improve null-handling of INSERT INTO SELECT queries that rely on implicit casting#5586

Merged
bluestreak01 merged 18 commits intomasterfrom
nw_record_copier
Sep 25, 2025
Merged

fix(sql): improve null-handling of INSERT INTO SELECT queries that rely on implicit casting#5586
bluestreak01 merged 18 commits intomasterfrom
nw_record_copier

Conversation

@nwoolmer
Copy link
Copy Markdown
Contributor

@nwoolmer nwoolmer commented Apr 15, 2025

RecordToRowCopier utils had some copy functions that were not null aware. In one example, a null LONG column would be converted to DOUBLE. But instead of the LONG null value becoming a Double.NaN, it stays as min long.

Fixes https://community.questdb.com/t/null-2147483648-or-what-am-i-doing-wrong/807/6

Fixes #5291

@nwoolmer nwoolmer added SQL Issues or changes relating to SQL execution Core Related to storage, data type, etc. Bug Incorrect or unexpected behavior labels Apr 15, 2025
# Conflicts:
#	core/src/test/java/io/questdb/test/griffin/SqlCompilerImplTest.java
# Conflicts:
#	core/src/main/java/io/questdb/griffin/SqlCodeGenerator.java
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 24, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nw_record_copier

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

@jerrinot jerrinot self-requested a review September 24, 2025 11:41
…(date, long) -> in both cases we return date.

this makes it consistent with commonWideningType(timestamp, long) and
commonWideningType(long, timestamp)
@jerrinot
Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 24, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nwoolmer
Copy link
Copy Markdown
Contributor Author

Thanks @jerrinot!

@glasstiger
Copy link
Copy Markdown
Contributor

[PR Coverage check]

😍 pass : 40 / 40 (100.00%)

file detail

path covered line new line coverage
🔵 io/questdb/cairo/ColumnType.java 4 4 100.00%
🔵 io/questdb/griffin/RecordToRowCopierUtils.java 18 18 100.00%
🔵 io/questdb/griffin/SqlUtil.java 18 18 100.00%

@bluestreak01 bluestreak01 merged commit b2f9f94 into master Sep 25, 2025
35 checks passed
@bluestreak01 bluestreak01 deleted the nw_record_copier branch September 25, 2025 17:41
nwoolmer added a commit that referenced this pull request Oct 9, 2025
…rely on implicit casting (#5586)

(cherry picked from commit b2f9f94)
bluestreak01 pushed a commit that referenced this pull request Oct 9, 2025
…rely on implicit casting (#5586)

(cherry picked from commit b2f9f94)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Incorrect or unexpected behavior Core Related to storage, data type, etc. SQL Issues or changes relating to SQL execution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect double null value returned in the select query.

4 participants