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

   ### Describe the bug
   
   Datafusion substrait does not set 'maintain_singular_struct' in 
MaskExpression
   
   
https://github.com/substrait-io/substrait/blob/aab01537d750f6fb296a7fe8e18299d04ecc7a83/proto/substrait/algebra.proto#L1298-L1300
   
   
   
   ### To Reproduce
   
   Generate the substrait plan from the following SQL
   
   SQL
   ```
   SELECT PS_AVAILQTY
   FROM 'partsupp'
   ORDER BY PS_AVAILQTY
   ```
   
   The following substrait plan will be generated:
   
   ```
   {
     "relations": [
       {
         "root": {
           "input": {
             "fetch": {
               "input": {
                 "sort": {
                   "input": {
                     "read": {
                       "baseSchema": {
                         "names": [
                           "ps_partkey",
                           "ps_suppkey",
                           "ps_availqty",
                           "ps_supplycost",
                           "ps_comment"
                         ]
                       },
                       "projection": {
                         "select": {
                           "structItems": [
                             {
                               "field": 2
                             }
                           ]
                         }
                       },
                       "namedTable": {
                         "names": [
                           "partsupp"
                         ]
                       }
                     }
                   },
                   "sorts": [
                     {
                       "expr": {
                         "selection": {
                           "directReference": {
                             "structField": {}
                           }
                         }
                       },
                       "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
                     }
                   ]
                 }
               },
               "count": "10"
             }
           },
           "names": [
             "ps_availqty"
           ]
         }
       }
     ],
     "version": {
       "minorNumber": 51,
       "producer": "datafusion"
     }
   }
   ```
   
   projection doesn't include 'maintain_singular_struct' and therefore fails 
when running the plan through the substrait-validator
   ```
                       "projection": {
                         "select": {
                           "structItems": [
                             {
                               "field": 2
                             }
                           ]
                         }
                       },
   ```
   
   ### Expected behavior
   
   _No response_
   
   ### 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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to