Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Time with offset constraint does not appear to be working correctly #1556

Open
Tom-hayden opened this issue Nov 20, 2019 · 1 comment
Open
Labels
bug Something isn't working

Comments

@Tom-hayden
Copy link
Contributor

Tom-hayden commented Nov 20, 2019

Bug Report

When using an offset constraint with a non zero offset, datahelix incorrecly marks the profile as contradictory.

Steps to Reproduce:

run the profile

{
  "fields": [
    {
      "name": "time",
      "type": "time",
      "nullable": false
    },
    {
      "name": "anHourLater",
      "type": "time",
      "nullable": false
    }
  ],
      "constraints": [

        {
          "field": "anHourLater",
          "equalToField": "time",
          "offset": 1,
          "offsetUnit": "seconds"
        }
  ]
}

Expected Result:

times seperated by a second are produced.

Actual Result:

Generation started at: 10:55:19

Number of rows | Velocity (rows/sec) | Velocity trend
---------------+---------------------+---------------
* The provided profile is wholly contradictory!
@Tom-hayden Tom-hayden added the bug Something isn't working label Nov 20, 2019
@Tom-hayden Tom-hayden self-assigned this Nov 21, 2019
@Tom-hayden Tom-hayden removed their assignment Dec 2, 2019
@tjohnson-scottlogic tjohnson-scottlogic removed this from Approved in Product roadmap Jun 10, 2020
@Ro4052
Copy link
Contributor

Ro4052 commented Jul 15, 2020

Looks like there's some inversion happening, maybe here?

// FieldSpecGroupValueGenerator (createModifierForField lines 120-122)
if (!relation.main().equals(first)){
    relation = relation.inverse();
}

We end up with the offset being -1 so when the LinearRestrictions object is constructed, inclusiveMin is greater than inclusiveMax and the restriction is marked as contradictory.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Product roadmap
  
Approved
Development

No branches or pull requests

2 participants