Skip to content

Minus zero values #16

Open
Open
@minouminou

Description

@minouminou

Signed zero values should be additionally checked:

  1. Minus zero values are not supported for float datatype
create table t1_1 (id Uint64, a Float, primary key(id));
insert into t1_2(id,a) values (1,-0.0);
Status: GENERIC_ERROR
Issues: 
<main>: Error: Type annotation, code: 1030
    <main>:1:13: Error: At function: KiWriteTable!
        <main>:1:21: Error: Failed to convert type: Struct<'a':Double,'id':Int32> to Struct<'a':Float?,'id':Uint64?>
        <main>:1:21: Error: Failed to convert input columns types to scheme types, code: 2031

create table t1(id Uint64, a Double, primary key(id));
insert into t1(id,a) values (1,0),(2,-0.0);
select * from t1;
┌────┬────┐
| a  | id |
├────┼────┤
| 0  | 1  |
├────┼────┤
| -0 | 2  |
└────┴────┘
  1. Division by zero returns error when using YDB CLI, +inf/-inf values are not supported
select 1/-0.0;
library/cpp/json/writer/json.cpp:259: JSON writer: invalid float value: -inf

select 1/0.0;
library/cpp/json/writer/json.cpp:259: JSON writer: invalid float value: inf

select 1/0;
┌─────────┐
| column0 |
├─────────┤
| null    |
└─────────┘
  1. Result of min/max functions might be inconsistent (should be +0)
create table t1(id Uint64, a Double, primary key(id));
insert into t1(id,a) values (1,0),(2,-0.0);
select min(a) from t1;
┌─────────┐
| column0 |
├─────────┤
| -0      |
└─────────┘

select max(a) from t1;
┌─────────┐
| column0 |
├─────────┤
| -0      |
└─────────┘

select min_of(0.0,-0.0);'
┌─────────┐
| column0 |
├─────────┤
| 0       |
└─────────┘

select max_of(0.0,-0.0);'
┌─────────┐
| column0 |
├─────────┤
| 0       |
└─────────┘

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions