CREATE INDEX `def_type` ON `travel-sample`(`type`);
|
|
CREATE INDEX idx_airlineid ON `travel-sample` (airlineid, airline, sourceairport, destinationairport) WHERE type="route";
|
|
|
|
SELECT Count(DISTINCT route.sourceairport) AS distinctairports1
|
FROM `travel-sample` airline
|
JOIN `travel-sample` route
|
ON KEY route.airlineid FOR airline
|
WHERE route.type = "route"
|
AND airline.type = "airline"
|
AND airline.callsign = "AA";
|
|
|
|
[
|
\{
|
"code": 5001,
|
"msg": "Panic: runtime error: invalid memory address or nil pointer dereference"
|
}
|
]
|
|
|
|
\{
|
"plan": \{
|
"#operator": "Sequence",
|
"~children": [
|
\{
|
"#operator": "IndexScan2",
|
"as": "airline",
|
"index": "def_type",
|
"index_id": "5df08999fbd53d24",
|
"index_projection": \{
|
"primary_key": true
|
},
|
"keyspace": "travel-sample",
|
"namespace": "default",
|
"spans": [
|
\{
|
"exact": true,
|
"range": [
|
\{
|
"high": "\"airline\"",
|
"inclusion": 3,
|
"low": "\"airline\""
|
}
|
]
|
}
|
],
|
"using": "gsi"
|
},
|
\{
|
"#operator": "Fetch",
|
"as": "airline",
|
"keyspace": "travel-sample",
|
"namespace": "default"
|
},
|
\{
|
"#operator": "Parallel",
|
"~child": \{
|
"#operator": "Sequence",
|
"~children": [
|
\{
|
"#operator": "IndexJoin",
|
"as": "route",
|
"for": "airline",
|
"keyspace": "travel-sample",
|
"namespace": "default",
|
"on_key": "cover ((`route`.`airlineid`))",
|
"scan": \{
|
"covers": [
|
"cover ((`route`.`airlineid`))",
|
"cover ((`route`.`airline`))",
|
"cover ((`route`.`sourceairport`))",
|
"cover ((`route`.`destinationairport`))",
|
"cover ((meta(`route`).`id`))"
|
],
|
"filter_covers": \{
|
"cover ((`route`.`type`))": "route"
|
},
|
"index": "idx_airlineid",
|
"index_id": "65592f79528be36d",
|
"using": "gsi"
|
}
|
},
|
\{
|
"#operator": "Filter",
|
"condition": "(((cover ((`route`.`type`)) = \"route\") and ((`airline`.`type`) = \"airline\")) and ((`airline`.`iata`) = \"AA\"))"
|
},
|
\{
|
"#operator": "InitialGroup",
|
"aggregates": [
|
"count(distinct cover ((`route`.`sourceairport`)))"
|
],
|
"group_keys": []
|
}
|
]
|
}
|
},
|
\{
|
"#operator": "IntermediateGroup",
|
"aggregates": [
|
"count(distinct cover ((`route`.`sourceairport`)))"
|
],
|
"group_keys": []
|
},
|
\{
|
"#operator": "FinalGroup",
|
"aggregates": [
|
"count(distinct cover ((`route`.`sourceairport`)))"
|
],
|
"group_keys": []
|
},
|
\{
|
"#operator": "Parallel",
|
"~child": \{
|
"#operator": "Sequence",
|
"~children": [
|
\{
|
"#operator": "InitialProject",
|
"result_terms": [
|
\{
|
"as": "distinctairports1",
|
"expr": "count(distinct cover ((`route`.`sourceairport`)))"
|
}
|
]
|
},
|
\{
|
"#operator": "FinalProject"
|
}
|
]
|
}
|
}
|
]
|
},
|
"text": "SELECT Count(DISTINCT route.sourceairport) AS distinctairports1 \nFROM `travel-sample` airline \n JOIN `travel-sample` route \n ON KEY route.airlineid FOR airline \nWHERE route.type = \"route\" \n AND airline.type = \"airline\" \n AND airline.iata = \"AA\";"
|
}
|