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

1.17 is not a multiple of 0.0001 #11

Closed
visch opened this issue Jul 12, 2021 · 5 comments
Closed

1.17 is not a multiple of 0.0001 #11

visch opened this issue Jul 12, 2021 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@visch
Copy link

visch commented Jul 12, 2021

13:41:07,19 INFO: stderr from second_pipe_cmd: b'jsonschema.exceptions.ValidationError: 1.17 is not a multiple of 0.0001\r\n'
13:41:07,20 INFO: stderr from second_pipe_cmd: b'\r\n'
13:41:07,20 INFO: stderr from second_pipe_cmd: b"Failed validating 'multipleOf' in schema['properties']['balance1']:\r\n"
13:41:07,21 INFO: stderr from second_pipe_cmd: b" {'inclusion': 'available',\r\n"
13:41:07,21 INFO: stderr from second_pipe_cmd: b" 'multipleOf': 0.0001,\r\n"
13:41:07,21 INFO: stderr from second_pipe_cmd: b" 'type': ['null', 'number']}\r\n"
13:41:07,22 INFO: stderr from second_pipe_cmd: b'\r\n'
13:41:07,22 INFO: stderr from second_pipe_cmd: b"On instance['balance1']:\r\n"
13:41:07,23 INFO: stderr from second_pipe_cmd: b' 1.17\r\n'

To replicate

Take this file

{"type": "SCHEMA", "stream": "stream", "schema": {"properties": {"primary_key": {"inclusion": "available", "minimum": -9223372036854775808, "maximum": 9223372036854775807, "type": ["null", "integer"]}, "testfield": {"inclusion": "available", "multipleOf": 0.0001, "type": ["null", "number"]}}, "type": "object"}, "key_properties": []}
{"type": "RECORD", "stream": "stream", "record": {"primary_key":123, "testfield": 1.1700}, "version": 1626119374393, "time_extracted": "2021-07-12T19:49:34.400771Z"}

And pipe it into the target-csv.

My guess this is something to do with decimal precision

@visch
Copy link
Author

visch commented Jul 12, 2021

https://github.com/singer-io/target-csv/pull/25/files works as a hotfix for this.

@hsyyid
Copy link
Member

hsyyid commented Jul 15, 2021

@visch You are correct, adding a flag to allow users to prevent validation is a possible fix. My question is what is your use case that the schema provided doesn't match the record? I believe this behavior is intended to catch bugs in the tap being used.

@hsyyid hsyyid self-assigned this Jul 15, 2021
@hsyyid hsyyid added the question Further information is requested label Jul 15, 2021
@visch
Copy link
Author

visch commented Jul 16, 2021

@visch You are correct, adding a flag to allow users to prevent validation is a possible fix. My question is what is your use case that the schema provided doesn't match the record? I believe this behavior is intended to catch bugs in the tap being used.

I have data coming from an Oracle tap that has data in this format. The thing is that the Schema is correct the incorrect portion is how the validation is validating the data.

0.0001 is a multiple of 1.1700 but it comes down to how precise decimal is being (I'm pretty sure, I'd have to dive into a fix I did for a different tap a while back)

@visch
Copy link
Author

visch commented Jul 18, 2021

I have another use case from MSSQL as well with Balance information that has this issue. My workaround right now is in MSSQL just convert it to a string so the target doesn't see it as a number

@hsyyid
Copy link
Member

hsyyid commented Sep 6, 2021

@visch Spent some time looking into this today – looks like it's an issue that Singer Python already addressed by parsing with Decimalsinger-io/singer-python@ddab733#diff-c41c36e8946e31bf6ddedb837eb5a8eb284532852ad8b4afb7f72892afa9ba7cR186

Updating the singer-python version on target-csv seems to have solved this

@hsyyid hsyyid closed this as completed in a8f5188 Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants