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

feat(interactive): Support implicit type conversion for vertex index scan #3418

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhanglei1949
Copy link
Collaborator

@zhanglei1949 zhanglei1949 commented Dec 12, 2023

For Interactive compute engine, we need to provide the ability for implicit type conversion in predicate. (The only scenario where the type conversion may happen).

For most of the predicates, we convert it to a c++ expression, and the implicit conversion if down by C++ compiler. For example.

MATCH(p : Person) where p.creditCardId = 1234 return p;

will be convert into an expression

bool predicate(int64_t creditCardId, int32_t target_value) {
    return creditCardId == target_value; // compare between a int64_t and int32_t.
}

However, when the query perform index scan for the vertex, we use indices for faster scan.

MATCH(p: Person { id : 1234}) return p;

will be compiled to

auto vertexSet = graph.ScanVertexFromOid(person_label_id, Any::From(1234));

Which will cause runtime error.

So, In this PR, we enable id_indexer support implicit type conversion between currently supported primary keys:

  • uint32_t
  • uint64_t
  • int32_t
  • uint32_t

Note that conversion between String and other type are not supported, since compiler will throw the error before compiling to a physical plan.

@zhanglei1949 zhanglei1949 marked this pull request as draft January 16, 2024 03:17
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.

None yet

1 participant