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

Fix: Use Decimal Writer for CBOR Spatial Geography Point #176

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

no1melman
Copy link

@no1melman no1melman commented Feb 18, 2025

Thank you for submitting this pull request! We appreciate you spending the time to work on these changes.

What is the motivation?

Current bug where surreal is expecting an array of two decimal values

What does this change do?

Ensures the converter for the Geography Point writes two decimal values

What is your testing strategy?

Yes

Is this related to any issues?

#175

Have you read the Contributing Guidelines?

Copy link
Contributor

@Odonno Odonno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @no1melman

I can see there is indeed a change from decimal (as a string) to f64 type. Can you change the Write and Read methods so that each use the DoubleConverter?

Note that GeometryPointConverter also follows the same logic. Can you also make the change for this converter?

@no1melman
Copy link
Author

no1melman commented Feb 19, 2025

@Odonno all done

I can't - for some reason - build the rust-embedded stuff, so I can't actually build the whole project and run tests...

Warning: corrupt .drectve at end of def file␍
          C:\Users\callu\code\my-surrealdb-net\fix-cbor-spatial-point\rust-embedded\target\debug\deps\liblibrocksdb_sys-98402df79e65f43b.rlib(34500ee411ddd5f5-convenience.o):convenience.cc:(.text$_ZTWN7rocksdb10perf_levelE[_ZTWN7rocksdb10perf_levelE]+0x15): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against undefined symbol `TLS init function for rocksdb::perf_level'␍
          C:\Users\callu\code\my-surrealdb-net\fix-cbor-spatial-point\rust-embedded\target\debug\deps\liblibrocksdb_sys-98402df79e65f43b.rlib(34500ee411ddd5f5-memtable.o):memtable.cc:(.text$_ZTWN7rocksdb15ConcurrentArena9tls_cpuidE[_ZTWN7rocksdb15ConcurrentArena9tls_cpuidE]+0x15): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against undefined symbol `TLS init function for rocksdb::ConcurrentArena::tls_cpuid'␍
          collect2.exe: error: ld returned 1 exit status

On Win 11, x64, rust version: 1.84.1 (cargo the same).

@Odonno
Copy link
Contributor

Odonno commented Feb 19, 2025

@Odonno all done

Perfect!

I can't - for some reason - build the rust-embedded stuff, so I can't actually build the whole project and run tests...

Warning: corrupt .drectve at end of def file␍
          C:\Users\callu\code\my-surrealdb-net\fix-cbor-spatial-point\rust-embedded\target\debug\deps\liblibrocksdb_sys-98402df79e65f43b.rlib(34500ee411ddd5f5-convenience.o):convenience.cc:(.text$_ZTWN7rocksdb10perf_levelE[_ZTWN7rocksdb10perf_levelE]+0x15): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against undefined symbol `TLS init function for rocksdb::perf_level'␍
          C:\Users\callu\code\my-surrealdb-net\fix-cbor-spatial-point\rust-embedded\target\debug\deps\liblibrocksdb_sys-98402df79e65f43b.rlib(34500ee411ddd5f5-memtable.o):memtable.cc:(.text$_ZTWN7rocksdb15ConcurrentArena9tls_cpuidE[_ZTWN7rocksdb15ConcurrentArena9tls_cpuidE]+0x15): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against undefined symbol `TLS init function for rocksdb::ConcurrentArena::tls_cpuid'␍
          collect2.exe: error: ld returned 1 exit status

On Win 11, x64, rust version: 1.84.1 (cargo the same).

You can run the tests for remote (HTTP, WS) by disabling the embedded mode. See this section in the readme file: https://github.com/surrealdb/surrealdb.net?tab=readme-ov-file#embedded-mode

If serialization works for remote, it should work for embedded too.

@no1melman
Copy link
Author

@Odonno I've updated the affected tests, they all work now.... bar 1 test which had a depth problem

GeographyMultiPolygonConverterTests.cs:58
Maximum recursion depth of 5 was reached.  Increase MaxDepth on AssertionScope or AssertionOptions to get more details.

@Odonno
Copy link
Contributor

Odonno commented Feb 19, 2025

This is weird. Can you try adjusting the settings like this:

AssertionOptions.FormattingOptions.MaxDepth = 10;

You can increase this value up to 100 in case it's still failing.

Does it fix the problem?

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.

2 participants