datahelix icon indicating copy to clipboard operation
datahelix copied to clipboard

Profiles are not guaranteed to succeed even when they have solutions

Open cdowding-sl opened this issue 6 years ago • 1 comments

Bug Report

Steps to Reproduce:

Run

generate --max-rows=1000 --profile-file=C:\src\DataHelix\profile.json

with profile:

{
  "description": "Testing Profile",
  "fields": [
      {
          "name": "a",
          "type": "date",
          "nullable": false
      },
      {
          "name": "b",
          "type": "date",
          "nullable": false
      },
      {
          "name": "c",
          "type": "date",
          "nullable": false
      },
      {
          "name": "d",
          "type": "date",
          "nullable": false
      }
  ],
          "constraints": [
              {
                  "field": "a",
                  "afterField": "b"
              },
              {
                  "field": "b",
                  "afterField": "c"
              },
              {
                  "field": "c",
                  "afterField": "d"
              },
              {
                  "field": "a",
                  "before": "0002-01-01"
              },
              {
                  "field": "b",
                  "before": "0002-01-01"
              },
              {
                  "field": "c",
                  "before": "0002-01-01"
              },
              {
                  "field": "d",
                  "before": "0002-01-01"
              }
          ]
}

Expected Result:

Valid solutions

Actual Result:

Generates a number of rows of data before stopping with error

  • The provided profile is wholly contradictory!

Solution

This occurs because we do not calculate the solution space in its entirety, and instead make some assumptions that we hope are likely to hold true for the solution we are generating. Of course they don't always hold true, leading to an error.

cdowding-sl avatar Nov 14 '19 14:11 cdowding-sl

This can occur with any profile with "chained" inter-field dependencies where those fields are also restricted by other constraints.

Tom-hayden avatar Nov 18 '19 09:11 Tom-hayden