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

Bug: unknown variant Polygons #93

Closed
2 tasks done
rushmorem opened this issue Sep 2, 2022 · 15 comments
Closed
2 tasks done

Bug: unknown variant Polygons #93

rushmorem opened this issue Sep 2, 2022 · 15 comments
Labels
bug Something isn't working

Comments

@rushmorem
Copy link
Collaborator

Describe the bug

Selecting a record that contains a MultiPolygon crashes the database.

Steps to reproduce

Run the following documented query:

UPDATE university:oxford SET locations = {
	type: "MultiPolygon",
	coordinates: [
		[
			[ [10.0, 11.2], [10.5, 11.9], [10.8, 12.0], [10.0, 11.2] ]
		],
		[
			[ [9.0, 11.2], [10.5, 11.9], [10.3, 13.0], [9.0, 11.2] ]
		]
	]
};

Select the record or export the database:

SELECT * FROM university:oxford;

The database crashes with the following error message:

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Syntax("unknown variant `Polygons`, expected one of `Point`, `Line`, `Polygon`, `MultiPoint`, `MultiLine`, `MultiPolygon`, `Collection`")', lib/src/sql/value/value.rs:97:60

Expected behaviour

Selects should return the record successfully and exporting should work as expected. I have already identified the source of the bug and will prepare and submit a pull request shortly.

SurrealDB version

surreal 1.0.0-beta.7 for linux on x86_64

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@rushmorem rushmorem added the bug Something isn't working label Sep 2, 2022
@tobiemh
Copy link
Member

tobiemh commented Sep 2, 2022

Hi @rushmorem , I've got the fix for this if you want me to push it up...?

@tobiemh
Copy link
Member

tobiemh commented Sep 2, 2022

I've found another issue, and am finishing a fix for this too (and adding some tests)...

@rushmorem
Copy link
Collaborator Author

Hi @tobiemh, it's OK take your time. It's just something I ran across while trying the SQL queries on the website.

@tobiemh tobiemh closed this as completed in 93dedd4 Sep 2, 2022
@tobiemh
Copy link
Member

tobiemh commented Sep 2, 2022

Hi @rushmorem thanks for finding this bug 👏 !

@rushmorem
Copy link
Collaborator Author

It's my pleasure. Thank you so much for building this awesome database and open sourcing it!

@rushmorem
Copy link
Collaborator Author

@tobiemh While we are still on the topic of geometry types, are you interested in supporting more formats for latitude and longitude? For example the ones listed in this crate?

@tobiemh
Copy link
Member

tobiemh commented Sep 2, 2022

Definitely could look into supporting lat/lon degress, and the like. We would need to write it in the parser (as opposed to defer to the that crate though, as that will be more performant. Similar to how we are parsing datetimes/durations...

@tobiemh
Copy link
Member

tobiemh commented Sep 2, 2022

@rushmorem ☝️

@rushmorem
Copy link
Collaborator Author

OK, noted. This is not something I have a use for right now though. I just thought you might be interested. If it's something you need soon though, I will be happy to look into it.

@tobiemh
Copy link
Member

tobiemh commented Sep 2, 2022

@rushmorem could you add a separate feature request for it by any chance?

@rushmorem
Copy link
Collaborator Author

Sure! No problem.

@rushmorem
Copy link
Collaborator Author

Done

@Adithya2907
Copy link

Adithya2907 commented Sep 20, 2022

@rushmorem @tobiemh has this issue been resolved? I tried to recreate the same, and the server crashed, giving the same error message.
Attaching a screenshot of the server logs.

image

@rushmorem
Copy link
Collaborator Author

@Adithya2907 Yes, it's fixed on main.

> UPDATE university:oxford SET locations = {
        type: "MultiPolygon",
        coordinates: [
                [
                        [ [10.0, 11.2], [10.5, 11.9], [10.8, 12.0], [10.0, 11.2] ]
                ],
                [
                        [ [9.0, 11.2], [10.5, 11.9], [10.3, 13.0], [9.0, 11.2] ]
                ]
        ]
};
[{"time":"246.85µs","status":"OK","result":[{"id":"university:oxford","locations":{"type":"MultiPolygon","coordinates":[[[[10.0,11.2],[10.5,11.9],[10.8,12.0],[10.0,11.2]]],[[[9.0,11.2],[10.5,11.9],[10.3,13.0],[9.0,11.2]]]]}}]}]
> SELECT * FROM university:oxford;
[{"time":"105.191µs","status":"OK","result":[{"id":"university:oxford","locations":{"type":"MultiPolygon","coordinates":[[[[10.0,11.2],[10.5,11.9],[10.8,12.0],[10.0,11.2]]],[[[9.0,11.2],[10.5,11.9],[10.3,13.0],[9.0,11.2]]]]}}]}]

v1.0.0-beta.8 won't have this issue.

@Adithya2907
Copy link

Yes, it's working on main. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants