这是indexloc提供的服务,不要输入任何密码
Skip to content

unify double and int types to double in cli introspection #77

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

Merged
merged 5 commits into from
Jun 13, 2024

Conversation

hallettj
Copy link
Collaborator

@hallettj hallettj commented Jun 12, 2024

Previously if we saw a mixture of int and double values in the same field in different documents in a collection we would infer the ExtendedJSON type for that field. This PR changes that behavior to infer double.

We could extend this to unify other compatible numeric types:

  • intlong
  • intdecimal
  • doubledecimal
  • longdecimal

For now I've stuck with intdouble because we have special handling an bson_to_json to accept a value of one type where the other is expected. We'll have to add similar special handling to support unifying the other numeric types.

MDB-128

@hallettj hallettj requested review from codedmart and dmoverton June 12, 2024 23:20
@hallettj hallettj changed the title unify compatible numeric types in cli introspection unify double and int types to double in cli introspection Jun 12, 2024
@codedmart codedmart merged commit 1196054 into main Jun 13, 2024
1 check passed
@codedmart codedmart deleted the jesse/unify-compatible-numeric-types branch June 13, 2024 13:13
hallettj added a commit that referenced this pull request Jun 13, 2024
…uble (#80)

In #77 I neglected to adjust our round-trip bson-to-json serialization proptest to handle cases where we treat ints as interchangeable with doubles. This change adds a custom equality test for use solely in tests that can compare ints and doubles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants