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

Index cannot be created for properties with non-simplified identifier names #8761

Closed
muneebshere opened this issue Feb 10, 2019 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@muneebshere
Copy link

OrientDB Version: 3.0.14

Java Version: 11

OS: Windows 10

Expected behavior

It is possible to create properties with non-simplified identifier names, such as names containing spaces. Such names are surrounded by back-ticks, e.g. `First Name`. It should also be possible to create indexes on such properties.

Actual behavior

When attempting to create an index on a property which has spaces in its names, the OrientDB engine throws an exception whether or not the back-ticks are added:
java.lang.IllegalArgumentException: Illegal field name format, should be ' [by key|value]' but was '`First Name`'

Steps to reproduce

CREATE VERTEX Customer
CREATE PROPERTY Customer.`First Name` STRING
CREATE PROPERTY Customer.`Last Name` STRING
CREATE INDEX Name ON Customer( `First Name`, `Last Name` ) UNIQUE

@luigidellaquila luigidellaquila self-assigned this Feb 11, 2019
@muneebshere
Copy link
Author

Any update? Could you replicate the issue?

@luigidellaquila
Copy link
Member

Hi @muneebshere

I just pushed a fix, it will be released with v 3.0.18

Thanks

Luigi

@luigidellaquila luigidellaquila added this to the 3.0.18 milestone Mar 8, 2019
@muneebshere
Copy link
Author

muneebshere commented Mar 11, 2019

@luigidellaquila
Thanks.
By the way, I'm just curious, but I looked at your commit and I couldn't see exactly how the issue was resolved. Could you point out the fix to me?

@luigidellaquila
Copy link
Member

Hi @muneebshere

The actual fix is only these ten lines of code 8de5efa#diff-66768ef3a31ffa04a5036f7d9855fb6aR87

Thanks

Luigi

@muneebshere
Copy link
Author

Hi @muneebshere

The actual fix is only these ten lines of code 8de5efa#diff-66768ef3a31ffa04a5036f7d9855fb6aR87

Thanks

Luigi

Yes, but how does that parse `` when it wasn't doing that before? Does it have to do with FILED_NAME_PATTERN.split(fieldDefinition)?

@luigidellaquila
Copy link
Member

Hi @muneebshere

The problem is not at query parsing, it's in the index factory. There is a legacy API to create indexes by key or by value (on maps) like Create index ... on x (theMap by key), and the API does a split by blank spaces. Before the fix, it just discarded all the fields with blank spaces, now it works also for them.

Thanks

Luigi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants