Created
June 1, 2023 13:40
-
-
Save vibhatha/e8408546dc3464023dd352bdf904769a to your computer and use it in GitHub Desktop.
Sample substrait plan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension_uris { | |
| extension_uri_anchor: 1 | |
| uri: "https://github.com/substrait-io/substrait/blob/main/extensions/functions_boolean.yaml" | |
| } | |
| extension_uris { | |
| extension_uri_anchor: 2 | |
| uri: "https://github.com/substrait-io/substrait/blob/main/extensions/functions_comparison.yaml" | |
| } | |
| extensions { | |
| extension_function { | |
| extension_uri_reference: 1 | |
| function_anchor: 1 | |
| name: "and" | |
| } | |
| } | |
| extensions { | |
| extension_function { | |
| extension_uri_reference: 2 | |
| function_anchor: 2 | |
| name: "equal" | |
| } | |
| } | |
| extensions { | |
| extension_function { | |
| extension_uri_reference: 2 | |
| function_anchor: 3 | |
| name: "gt" | |
| } | |
| } | |
| relations { | |
| root { | |
| input { | |
| sort { | |
| input { | |
| filter { | |
| input { | |
| project { | |
| common { | |
| emit { | |
| output_mapping: 12 | |
| output_mapping: 13 | |
| output_mapping: 14 | |
| output_mapping: 15 | |
| output_mapping: 16 | |
| } | |
| } | |
| input { | |
| join { | |
| left { | |
| project { | |
| common { | |
| emit { | |
| output_mapping: 3 | |
| output_mapping: 4 | |
| output_mapping: 5 | |
| } | |
| } | |
| input { | |
| read { | |
| common { | |
| direct { | |
| } | |
| } | |
| base_schema { | |
| names: "tconst" | |
| names: "averageRating" | |
| names: "numVotes" | |
| struct { | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| nullability: NULLABILITY_REQUIRED | |
| } | |
| } | |
| named_table { | |
| names: "ratings" | |
| } | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| expressions { | |
| cast { | |
| type { | |
| fp64 { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| input { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 1 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| failure_behavior: FAILURE_BEHAVIOR_THROW_EXCEPTION | |
| } | |
| } | |
| expressions { | |
| cast { | |
| type { | |
| i64 { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| input { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 2 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| failure_behavior: FAILURE_BEHAVIOR_THROW_EXCEPTION | |
| } | |
| } | |
| } | |
| } | |
| right { | |
| project { | |
| common { | |
| emit { | |
| output_mapping: 9 | |
| output_mapping: 10 | |
| output_mapping: 11 | |
| } | |
| } | |
| input { | |
| filter { | |
| input { | |
| read { | |
| common { | |
| direct { | |
| } | |
| } | |
| base_schema { | |
| names: "tconst" | |
| names: "titleType" | |
| names: "primaryTitle" | |
| names: "originalTitle" | |
| names: "isAdult" | |
| names: "startYear" | |
| names: "endYear" | |
| names: "runtimeMinutes" | |
| names: "genres" | |
| struct { | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| types { | |
| string { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| nullability: NULLABILITY_REQUIRED | |
| } | |
| } | |
| named_table { | |
| names: "basics" | |
| } | |
| } | |
| } | |
| condition { | |
| scalar_function { | |
| function_reference: 1 | |
| output_type { | |
| bool { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| arguments { | |
| value { | |
| scalar_function { | |
| function_reference: 2 | |
| output_type { | |
| bool { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| arguments { | |
| value { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 1 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| } | |
| arguments { | |
| value { | |
| literal { | |
| string: "movie" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| arguments { | |
| value { | |
| scalar_function { | |
| function_reference: 2 | |
| output_type { | |
| bool { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| arguments { | |
| value { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 4 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| } | |
| arguments { | |
| value { | |
| literal { | |
| string: "0" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 2 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 5 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| } | |
| } | |
| expression { | |
| scalar_function { | |
| function_reference: 2 | |
| output_type { | |
| bool { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| arguments { | |
| value { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| } | |
| arguments { | |
| value { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 3 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| type: JOIN_TYPE_INNER | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 1 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 2 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 4 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| expressions { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 5 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| } | |
| } | |
| condition { | |
| scalar_function { | |
| function_reference: 3 | |
| output_type { | |
| bool { | |
| nullability: NULLABILITY_NULLABLE | |
| } | |
| } | |
| arguments { | |
| value { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 2 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| } | |
| arguments { | |
| value { | |
| literal { | |
| i32: 200000 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| sorts { | |
| expr { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 1 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| direction: SORT_DIRECTION_DESC_NULLS_FIRST | |
| } | |
| sorts { | |
| expr { | |
| selection { | |
| direct_reference { | |
| struct_field { | |
| field: 2 | |
| } | |
| } | |
| root_reference { | |
| } | |
| } | |
| } | |
| direction: SORT_DIRECTION_DESC_NULLS_FIRST | |
| } | |
| } | |
| } | |
| names: "tconst" | |
| names: "avg_rating" | |
| names: "num_votes" | |
| names: "primaryTitle" | |
| names: "startYear" | |
| } | |
| } | |
| version { | |
| minor_number: 24 | |
| producer: "ibis-substrait" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get a bit different plan, using the following code (tables downloaded from https://datasets.imdbws.com/)
The plan I get is a bit different (used some text comparison tool):