EpsilonPrime opened a new issue, #12204:
URL: https://github.com/apache/datafusion/issues/12204

   ### Describe the bug
   
   According to the [Substrait 
specification](https://substrait.io/relations/logical_relations/#project-operation)
 project relations emit all if the input fields followed by the list of new 
expressions.  Datafusion only emits the new expressions.
   
   
   ### To Reproduce
   
   Pass a Substrait plan such as the following to Datafusion.  (A literal can 
be used instead of a window function but this is what I had handy.)
   
   `
   {
     "extensionUris": [
       {
         "extensionUriAnchor": 1,
         "uri": "/functions_arithmetic.yaml"
       }
     ],
     "extensions": [
       {
         "extensionFunction": {
           "extensionUriReference": 1,
           "functionAnchor": 1,
           "name": "row_number"
         }
       }
     ],
     "relations": [
       {
         "root": {
           "input": {
             "project": {
               "common": {
                 "direct": {}
               },
               "input": {
                 "read": {
                   "common": {
                     "direct": {}
                   },
                   "baseSchema": {
                     "names": [
                       "user_id",
                       "name",
                       "paid_for_service"
                     ],
                     "struct": {
                       "types": [
                         {
                           "string": {
                             "nullability": "NULLABILITY_REQUIRED"
                           }
                         },
                         {
                           "string": {
                             "nullability": "NULLABILITY_REQUIRED"
                           }
                         },
                         {
                           "bool": {
                             "nullability": "NULLABILITY_REQUIRED"
                           }
                         }
                       ],
                       "nullability": "NULLABILITY_REQUIRED"
                     }
                   },
                   "namedTable": {
                     "names": [
                       "users"
                     ]
                   }
                 }
               },
               "expressions": [
                 {
                   "windowFunction": {
                     "functionReference": 1,
                     "sorts": [
                       {
                         "expr": {
                           "selection": {
                             "directReference": {
                               "structField": {
                                 "field": 1
                               }
                             },
                             "rootReference": {}
                           }
                         },
                         "direction": "SORT_DIRECTION_ASC_NULLS_FIRST"
                       }
                     ],
                     "upperBound": {
                       "unbounded": {}
                     },
                     "lowerBound": {
                       "unbounded": {}
                     },
                     "outputType": {
                       "i64": {
                         "nullability": "NULLABILITY_REQUIRED"
                       }
                     },
                     "invocation": 3
                   }
                 }
               ]
             }
           },
           "names": [
             "user_id",
             "name",
             "paid_for_service",
             "row_number"
           ]
         }
       }
     ],
     "version": {
       "minorNumber": 52,
       "producer": "spark-substrait-gateway"
     }
   }
   `
   
   ### Expected behavior
   
   The result of the plan above would be 4 columns to match the 4 names 
provided.  The current behavior is that Datafusion returns just one column 
(row_number) for the project.
   
   
   ### Additional context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to