comphead commented on issue #5695:
URL: 
https://github.com/apache/arrow-datafusion/issues/5695#issuecomment-1480248977

   Actually the problem is the column name mismatches  between schema and the 
batch
   
   ```
   [datafusion/core/src/datasource/memory.rs:60] &schema = Schema {
       fields: [
           Field {
               name: "RANK() PARTITION BY [orders.o_custkey] ROWS BETWEEN 
UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING",
               data_type: UInt64,
               nullable: true,
               dict_id: 0,
               dict_is_ordered: false,
               metadata: {},
           },
       ],
       metadata: {},
   }
   [datafusion/core/src/datasource/memory.rs:61] &batches.schema() = Schema {
       fields: [
           Field {
               name: "RANK()",
               data_type: UInt64,
               nullable: false,
               dict_id: 0,
               dict_is_ordered: false,
               metadata: {},
           },
       ],
       metadata: {},
   }
   thread 'sql::parquet::parquet_query_with_max_min1' panicked at 'called 
`Result::unwrap()` on an `Err` value: Plan("Mismatch between schema and 
batches")', datafusion/core/tests/sql/mod.rs:1163:33
   ```
   
   The reason for this I believe in for window function the name is shortened 
and looks not consistent
   
   ```
   SELECT RANK() OVER (PARTITION BY x order by x) FROM (select 1 as x);
   +--------+
   | RANK() |
   +--------+
   | 1      |
   +--------+
   ```
   
   once you wrap it into the function it stops name shorten
   
   ```
   SELECT abs(RANK() OVER (PARTITION BY x order by x)) FROM (select 1 as x);
   
+------------------------------------------------------------------------------------------------------------+
   | abs(RANK() PARTITION BY [x] ORDER BY [x ASC NULLS LAST] RANGE BETWEEN 
UNBOUNDED PRECEDING AND CURRENT ROW) |
   
+------------------------------------------------------------------------------------------------------------+
   | 1.0                                                                        
                                |
   
+------------------------------------------------------------------------------------------------------------+
   ```
   
   


-- 
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]

Reply via email to