You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "lmocsi (via GitHub)" <gi...@apache.org> on 2023/08/08 22:35:15 UTC

[GitHub] [arrow] lmocsi opened a new issue, #37071: Ds.dataset() should be able to return partition column as datetime (if it is in ISO date format)

lmocsi opened a new issue, #37071:
URL: https://github.com/apache/arrow/issues/37071

   ### Describe the enhancement requested
   
   Right now, ds.dataset() can include the partition key in the result if partitioning='hive' option is used.
   However, this partition key column is returned as a str, though it used to be a date.
   Would be nice, if it was returned as a datetime column, if it is in the standard ISO format.
   
   ```
   import pyarrow.dataset as ds
   
   mytab = ds.dataset("my_table_name", partitioning='hive').to_table()
   print(mytab)
   ```
   Calendar_date is the partitioning column.
   
   Results:
   pyarrow.Table
   USER_ID: double
   TRX_CNT: double
   DATE_OF_BIRTH: timestamp[ns]
   **CALENDAR_DATE: string**
   ----
   USER_ID: [[1000,1001,1002,1003],[1000,1001,1002,1005],[1000,1001,1003,1005,1008]]
   TRX_CNT: [[434,11,3,555],[111,32,1,2],[434,21,44,111,222]]
   DATE_OF_BIRTH: [[1998-12-01 23:00:00.000000000,2002-03-13 23:00:00.000000000,1975-08-31 23:00:00.000000000,1998-12-31 23:00:00.000000000],[1998-12-01 23:00:00.000000000,2002-03-13 23:00:00.000000000,1975-08-31 23:00:00.000000000,2004-06-06 22:00:00.000000000],[1998-12-01 23:00:00.000000000,2002-03-13 23:00:00.000000000,1998-12-31 23:00:00.000000000,2004-06-06 22:00:00.000000000,1988-02-27 23:00:00.000000000]]
   **CALENDAR_DATE: [["2023-08-01 00:00:00","2023-08-01 00:00:00","2023-08-01 00:00:00","2023-08-01 00:00:00"],["2023-08-02 00:00:00","2023-08-02 00:00:00","2023-08-02 00:00:00","2023-08-02 00:00:00"],["2023-08-03 00:00:00","2023-08-03 00:00:00","2023-08-03 00:00:00","2023-08-03 00:00:00","2023-08-03 00:00:00"]]**
   
   [my_table_name.zip](https://github.com/apache/arrow/files/12296610/my_table_name.zip)
   
   
   ### Component(s)
   
   Parquet, Python


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

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


Re: [I] Ds.dataset() should be able to return partition column as datetime (if it is in ISO date format) [arrow]

Posted by "lmocsi (via GitHub)" <gi...@apache.org>.
lmocsi closed issue #37071: Ds.dataset() should be able to return partition column as datetime (if it is in ISO date format)
URL: https://github.com/apache/arrow/issues/37071


-- 
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: issues-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] mapleFU commented on issue #37071: Ds.dataset() should be able to return partition column as datetime (if it is in ISO date format)

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on issue #37071:
URL: https://github.com/apache/arrow/issues/37071#issuecomment-1675247247

   ```python
   >>> part = ds.partitioning(pa.schema([("CALENDAR_DATE", pa.timestamp('ms'))]), flavor='hive')
   >>> mytab = ds.dataset(".", partitioning=part).to_table()
   >>> mytab
   pyarrow.Table
   USER_ID: double
   TRX_CNT: double
   DATE_OF_BIRTH: timestamp[ns]
   CALENDAR_DATE: timestamp[ms]
   ----
   USER_ID: [[1000,1001,1002,1003],[1000,1001,1002,1005],[1000,1001,1003,1005,1008]]
   TRX_CNT: [[434,11,3,555],[111,32,1,2],[434,21,44,111,222]]
   DATE_OF_BIRTH: [[1998-12-01 23:00:00.000000000,2002-03-13 23:00:00.000000000,1975-08-31 23:00:00.000000000,1998-12-31 23:00:00.000000000],[1998-12-01 23:00:00.000000000,2002-03-13 23:00:00.000000000,1975-08-31 23:00:00.000000000,2004-06-06 22:00:00.000000000],[1998-12-01 23:00:00.000000000,2002-03-13 23:00:00.000000000,1998-12-31 23:00:00.000000000,2004-06-06 22:00:00.000000000,1988-02-27 23:00:00.000000000]]
   CALENDAR_DATE: [[2023-08-01 00:00:00.000,2023-08-01 00:00:00.000,2023-08-01 00:00:00.000,2023-08-01 00:00:00.000],[2023-08-02 00:00:00.000,2023-08-02 00:00:00.000,2023-08-02 00:00:00.000,2023-08-02 00:00:00.000],[2023-08-03 00:00:00.000,2023-08-03 00:00:00.000,2023-08-03 00:00:00.000,2023-08-03 00:00:00.000,2023-08-03 00:00:00.000]]
   >>> 
   ```
   
   You can follow the doc: https://arrow.apache.org/docs/python/dataset.html#different-partitioning-schemes @lmocsi 


-- 
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-unsubscribe@arrow.apache.org

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