alamb commented on issue #6508:
URL: 
https://github.com/apache/arrow-datafusion/issues/6508#issuecomment-1572597041

   Thanks for the report @osawyerr 
   
   TLDR is that DataFusion treats `VARCHAR` and `CHAR` the same (because they 
use the same underlying Arrow type)
   
   🤔  I am not quite sure what to do here. Postgres has the notion of a max 
width character column `CHAR` but arrow does not . DataFusion maps the SQL type 
`CHAR` --> arrow type `Utf8` 
   
   Thus I am no sure we were be able to replicate the behavior of postgres in 
this instance. 
   
   For anyone following along, here is what postgres does
   
   ```sql
   postgres=# create table example(name varchar(20));
   CREATE TABLE
   postgres=# insert into example values ('foo'), ('barrr');
   INSERT 0 2
   postgres=# select octet_length(name) from example;
    octet_length
   --------------
               3
               5
   (2 rows)
   postgres=# select octet_length(name::char(25)) from example;
    octet_length
   --------------
              25
              25
   (2 rows)
   postgres=# select octet_length(name::varchar(25)) from example;
    octet_length
   --------------
               3
               5
   (2 rows)
   
   postgres=#
   ```


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