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] GIE ouputs unexpected physical plan on query bi12 #2757

Open
lnfjpt opened this issue May 26, 2023 · 0 comments
Open

[BUG] GIE ouputs unexpected physical plan on query bi12 #2757

lnfjpt opened this issue May 26, 2023 · 0 comments
Assignees

Comments

@lnfjpt
Copy link
Collaborator

lnfjpt commented May 26, 2023

bi12 query (Cypher)

MATCH
	(person:PERSON)<-[:HASCREATOR]-(msg)-[:REPLYOF*0..7]->(reply:POST)
WHERE 
	msg.length < 80 and msg.creationDate > 20120626000000000
	and (reply.language = 'es' or reply.language = 'ta' or reply.language = 'pt')
RETURN person.id

Current physical plan:

PhysicalOpr {
            opr: Some(
                Operator {
                    op_kind: Some(
                        Scan(
                            Scan {
                                scan_opt: Vertex,
                                alias: Some(
                                    2,
                                ),
                                params: Some(
                                    QueryParams {
                                        ...
                                        predicate: Some(
                                            Expression {
                                                operators: [
                                                    ExprOpr {
                                                        node_type: Some(
                                                            IrDataType {
                                                                r#type: Some(
                                                                    DataType(
                                                                        Int64,
                                                                    ),
                                                                ),
                                                            },
                                                        ),
                                                        item: Some(
                                                            Var(
                                                                Variable {
                                                                    tag: None,
                                                                    property: Some(
                                                                        Property {
                                                                            item: Some(
                                                                                Key(
                                                                                    NameOrId {
                                                                                        item: Some(
                                                                                            Name(
                                                                                                "language",
                                                                                            ),
                                                                                        ),
                                                                                    },
                                                                                ),
                                                                            ),
                                                                        },
                                                                    ),
                                                                    node_type: Some(
                                                                        IrDataType {
                                                                            r#type: Some(
                                                                                DataType(
                                                                                    Int64,
                                                                                ),
                                                                            ),
                                                                        },
                                                                    ),
                                                                },
                                                            ),
                                                        ),
                                                    },
...
 PhysicalOpr {
            opr: Some(
                Operator {
                    op_kind: Some(
                        Path(
                            PathExpand {
                                base: Some(
                                    ExpandBase {
                                        edge_expand: Some(
                                            EdgeExpand {
                                            ...
                                            }
                                        ),
                                        get_v: Some(
                                            GetV {
                                                tag: None,
                                                opt: Itself,
                                                params: Some(
                                                    QueryParams {
                                                        tables: [
                                                            NameOrId {
                                                                item: Some(
                                                                    Id(
                                                                        3,
                                                                    ),
                                                                ),
                                                            },
                                                        ],
                                                        columns: [],
                                                        is_all_columns: false,
                                                        limit: None,
                                                        predicate: None,
                                                        sample_ratio: 1.0,
                                                        extra: {},
                                                    },
                                                ),
                                                alias: Some(
                                                    2,
                                                ),
                                            },
                                        ),
                                    },
                                ),
                                ...

Expected physical plan:

PhysicalOpr {
            opr: Some(
                Operator {
                    op_kind: Some(
                        Scan(
                            Scan {
                                scan_opt: Vertex,
                                alias: Some(
                                    2,
                                ),
                                params: Some(
                                    QueryParams {
                                        ...
                                        predicate: Some(
                                            Expression {
                                                operators: [
                                                    ExprOpr {
                                                        node_type: Some(
                                                            IrDataType {
                                                                r#type: Some(
                                                                    DataType(
                                                                        String,
                                                                    ),
                                                                ),
                                                            },
                                                        ),
                                                        item: Some(
                                                            Var(
                                                                Variable {
                                                                    tag: None,
                                                                    property: Some(
                                                                        Property {
                                                                            item: Some(
                                                                                Key(
                                                                                    NameOrId {
                                                                                        item: Some(
                                                                                            Name(
                                                                                                "language",
                                                                                            ),
                                                                                        ),
                                                                                    },
                                                                                ),
                                                                            ),
                                                                        },
                                                                    ),
                                                                    node_type: Some(
                                                                        IrDataType {
                                                                            r#type: Some(
                                                                                DataType(
                                                                                    String,
                                                                                ),
                                                                            ),
                                                                        },
                                                                    ),
                                                                },
                                                            ),
                                                        ),
                                                    },
...
 PhysicalOpr {
            opr: Some(
                Operator {
                    op_kind: Some(
                        Path(
                            PathExpand {
                                base: Some(
                                    ExpandBase {
                                        edge_expand: Some(
                                            EdgeExpand {
                                            ...
                                            }
                                        ),
                                        get_v: Some(
                                            GetV {
                                                tag: None,
                                                opt: Itself,
                                                params: Some(
                                                    QueryParams {
                                                        tables: [],
                                                        columns: [],
                                                        is_all_columns: false,
                                                        limit: None,
                                                        predicate: None,
                                                        sample_ratio: 1.0,
                                                        extra: {},
                                                    },
                                                ),
                                                alias: None,
                                            },
                                        ),
                                    },
                                ),
                                ...

Problems:
1. Incorrect DataType in Scan Operator; Int64 -> String
2. Incorrect label filter in PathExpand-getv; [3(POST)] - > []
3. Incorrect alias in PathExpand-getv; Some(2) -> None

BingqingLyu added a commit that referenced this issue May 30, 2023
#2763)

…d the alias of `PathExpand` itself.

<!--
Thanks for your contribution! please review
https://github.com/alibaba/GraphScope/blob/main/CONTRIBUTING.md before
opening an issue.
-->

## What do these changes do?

<!-- Please give a short brief about these changes. -->

As titled. This fixes the bug in Problem 3 in issue #2757.

## Related issue number

<!-- Are there any issues opened that will be resolved by merging this
change? -->

#2757

---------

Co-authored-by: shirly121 <[email protected]>
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

3 participants