Skip to content

SQL Server incorrect results for column validation max of tinyint value #1585

@nj1973

Description

@nj1973

Describe the bug
On SQL Server we get incorrect results for in column validation max for some tinyint values.

sqlcmd output:

1> SELECT count(*) AS count, max(t0.col_int1) AS max__col_int1, max(t0.col_int2) AS max__col_int2 FROM pso_data_validator.dvt_sql_server_types AS t0;
2> go
count       max__col_int1 max__col_int2
----------- ------------- -------------
          2           210         22222

DVT output:

╒═══════════════════╤═══════════════════╤═════════════════════════════════════════╤══════════════════════╤════════════════════╤════════════════════╤══════════════════╤═════════════════════╤══════════════════════════════════════╕
│ validation_name   │ validation_type   │ source_table_name                       │ source_column_name   │   source_agg_value │   target_agg_value │   pct_difference │ validation_status   │ run_id                               │
╞═══════════════════╪═══════════════════╪═════════════════════════════════════════╪══════════════════════╪════════════════════╪════════════════════╪══════════════════╪═════════════════════╪══════════════════════════════════════╡
│ max__col_int2     │ Column            │ pso_data_validator.dvt_sql_server_types │ col_int2             │              22222 │              22222 │            0     │ success             │ 4b677376-a277-4942-a3de-eebb1467336c │
├───────────────────┼───────────────────┼─────────────────────────────────────────┼──────────────────────┼────────────────────┼────────────────────┼──────────────────┼─────────────────────┼──────────────────────────────────────┤
│ max__col_int1     │ Column            │ pso_data_validator.dvt_sql_server_types │ col_int1             │                -46 │                210 │         -556.522 │ fail                │ 4b677376-a277-4942-a3de-eebb1467336c │
├───────────────────┼───────────────────┼─────────────────────────────────────────┼──────────────────────┼────────────────────┼────────────────────┼──────────────────┼─────────────────────┼──────────────────────────────────────┤
│ count             │ Column            │ pso_data_validator.dvt_sql_server_types │                      │                  2 │                  2 │            0     │ success             │ 4b677376-a277-4942-a3de-eebb1467336c │
╘═══════════════════╧═══════════════════╧═════════════════════════════════════════╧══════════════════════╧════════════════════╧════════════════════╧══════════════════╧═════════════════════╧══════════════════════════════════════╛

Notice the -46 value for max(col_int1) in DVT output which differs from sqlcmd.

What version of DVT are you using?
8.1.1

What type of connections are you using for source and target?
SQL Server

Steps to reproduce the behavior
Search for issue-x in tests/system/data_sources/test_sql_server.py to reproduce.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions