Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] DIVIDE and MODULUS return an error when dividing by 0 with the Byte data type #1582

Open
matthewryanwells opened this issue Apr 25, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@matthewryanwells
Copy link
Contributor

What is the bug?
When you divide or modulus two byte values together using DIVIDE(), /, MODULUS(), MOD(), and % if the denominator value is 0 then the following error will be returned: TransportError(503, 'ArithmeticException', {'error': {'reason': 'There was internal problem at backend', 'details': '/ by zero', 'type': 'ArithmeticException'}, 'status': 503})

How can one reproduce the bug?
Start OpenSearch on localhost:9200.

Create and load mappings file: byte_mapping.json

{
    "mappings" : {
      "properties" : {
        "value" : {
          "type" : "byte"
        }
      }
    }
}

Load mappings file:

curl -H 'Content-Type: application/x-ndjson' -XPUT \
  'http://localhost:9200/byte_mapping.json?pretty' \
  -u admin:admin --insecure --data-binary @byte_mapping.json

Create and load mappings file: byte.json

{"index": {"_index": "byte", "_id": "1"}}
{ "value" : 0 }

Load mappings file:

curl -H 'Content-Type: application/x-ndjson' -XPOST \
  'http://localhost:9200/byte.json/_bulk?pretty' \
  -u admin:admin --insecure --data-binary @byte.json

Run SQL command:
SELECT DIVIDE(value, value) FROM byte;

What is the expected behavior?
a null value should be returned

What is your host/environment?

  • OS: MacOS
  • Version 13.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants