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] Type inference error on cypher queries. #4318

Open
zhanglei1949 opened this issue Nov 12, 2024 · 1 comment
Open

[BUG] Type inference error on cypher queries. #4318

zhanglei1949 opened this issue Nov 12, 2024 · 1 comment
Assignees

Comments

@zhanglei1949
Copy link
Collaborator

zhanglei1949 commented Nov 12, 2024

I have define a graph with two types of vertices, each is uniquely identified by primary key custom_id which is of type DT_SIGNED_INT64.

name: modern_graph # then must have a modern dir under ${data} directory
version: v0.1
store_type: mutable_csr  # v6d, groot, gart
description: A graph with 2 vertex types and 2 edge types
schema:
  vertex_types:
    - type_id: 0
      type_name: person
      description: A person vertex type
      properties:
        - property_id: 0
          property_name: custom_id
          property_type:
            primitive_type: DT_SIGNED_INT64
        - property_id: 1
          property_name: name
          property_type:
            string:
              long_text:
        - property_id: 2
          property_name: age
          property_type:
            primitive_type: DT_SIGNED_INT32
      primary_keys:
        - id
    - type_id: 1
      type_name: software
      description: A software vertex type
      properties:
        - property_id: 0
          property_name: custom_id
          property_type:
            primitive_type: DT_SIGNED_INT64
        - property_id: 1
          property_name: name
          property_type:
            string:
              long_text:
        - property_id: 2
          property_name: lang
          property_type:
            string:
              long_text:
      primary_keys:
        - id
  edge_types:
    - type_id: 0
      type_name: knows
      description: A knows edge type
      vertex_type_pair_relations:
        - source_vertex: person
          destination_vertex: person
          relation: MANY_TO_MANY
          x_csr_params:
            sort_on_compaction: TRUE
      properties:
        - property_id: 0
          property_name: weight
          property_type:
            primitive_type: DT_DOUBLE
    - type_id: 1
      type_name: created
      description: A created edge type
      vertex_type_pair_relations:
        - source_vertex: person
          destination_vertex: software
          relation: MANY_TO_MANY
      properties:
        - property_id: 0
          property_name: weight
          property_type:
            primitive_type: DT_DOUBLE

But following two queries give different physical plan

MATCH(n :person {custom_id: 1L}) return n;
MATCH(n  {custom_id: 1L}) return n;

For each first query the plan is like

 opr {
    scan {
      alias {
      }
      params {
        tables {
          id: 0
        }
        sample_ratio: 1
      }
      idx_predicate {
        or_predicates {
          predicates {
            key {
              key {
                name: "custom_id"
              }
            }
            const {
              i64: 1
            }
          }
        }
      }
    }
  }
  meta_data {
    type {
      graph_type {
        graph_data_type {
          label {
          }
          props {
            prop_id {
              name: "custom_id"
            }
            type: INT64
          }
          props {
            prop_id {
              name: "name"
            }
            type: STRING
          }
          props {
            prop_id {
              name: "age"
            }
            type: INT32
          }
        }
      }
    }
  }

For the second one, the plan is like

plan {
  opr {
    scan {
      alias {
      }
      params {
        tables {
          id: 0
        }
        tables {
          id: 1
        }
        sample_ratio: 1
      }
      idx_predicate {
        or_predicates {
          predicates {
            key {
              key {
                name: "custom_id"
              }
            }
            const {
              i32: 1
            }
          }
        }
      }
    }
  }

Which different data type is given, i.e. i32 vs i64

@shirly121
Copy link
Collaborator

Ensure the following configuration is correct:

  1. graph.planner.opt: RBO
  2. graph.physical.opt: proto

Based on the above configuration, the type of 1L is inferred as i64, which meets expectations.

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

No branches or pull requests

2 participants