Skip to content

Mod operator applied to UBIGINT, INTEGER returns a DOUBLE type #3931

Closed
@jwills

Description

What happens?

The mod operator applied to a UBIGINT, INTEGER combination returns a DOUBLE instead of e.g. a HUGEINT, which surprised me; doing the mod of a BIGINT returns a BIGINT and the mod of a HUGEINT returns a HUGEINT. I'm not aware of any other cases where doing a mod of an integer type by another integer type returns a DOUBLE value.

I noticed this when I was testing the fix for #3920 and wasn't sure if it was a bug or if it was the intended behavior for that case.

To Reproduce

SELECT typeof(1::ubigint % 2);

Environment (please complete the following information):

  • OS: OS X
  • DuckDB Version: 0.4.0
  • DuckDB Client: CLI

Identity Disclosure:

  • Full Name: Josh Wills
  • Affiliation: WeaveGrid

Before Submitting

  • Have you tried this on the latest master branch?
  • Python: pip install duckdb --upgrade --pre
  • R: install.packages("https://github.com/duckdb/duckdb/releases/download/master-builds/duckdb_r_src.tar.gz", repos = NULL)
  • Other Platforms: You can find binaries here or compile from source.

No, but I'm pretty sure it's broken (?) there too.

  • [] Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

Yep, it's a straightforward one.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions