You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/11 10:04:36 UTC

[GitHub] [arrow-datafusion] Ted-Jiang opened a new pull request #1991: Add doc for EXTRACT, date_part

Ted-Jiang opened a new pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991


   # Which issue does this PR close?
   After implement the #1974 , add the doc for user😊
   
   Closes #.
   
    # Rationale for this change
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   # What changes are included in this PR?
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   


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



[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r825287206



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,31 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.

Review comment:
       https://github.com/apache/arrow-datafusion/issues/1992




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



[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r824743599



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,31 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.

Review comment:
       I think the result type of u32 is not enough.
   From the spark, 
   ```
   spark-sql> SELECT EXTRACT(YEAR FROM TIMESTAMP '-2000-12-16 12:21:13');
   -2000
   ```
   But this is not related to this issue, I will open a follow up pull request and discuss the returned type.




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



[GitHub] [arrow-datafusion] Ted-Jiang commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r825776860



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,31 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.

Review comment:
       @liukun4515 We need  a discussion  about wether need support negative `timestamp `or `date`




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



[GitHub] [arrow-datafusion] yjshen commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
yjshen commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r827571397



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,24 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.
+  - `year` :`EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 2020`
+  - `month`:`EXTRACT(month FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 9`
+  - `week` :`EXTRACT(week FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 23`
+  - `day`: `EXTRACT(day FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 8`
+  - `hour`: `EXTRACT(hour FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 12`
+  - `minute`: `EXTRACT(minute FROM to_timestamp('2020-09-08T12:01:00+00:00')) -> 1`
+  - `second`: `EXTRACT(second FROM to_timestamp('2020-09-08T12:00:03+00:00')) -> 3`
+

Review comment:
       Yes, I changed it a bit because we modeled after Postgresql? Should we add this sentence here to introduce `data_part` a little bit?




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



[GitHub] [arrow-datafusion] Ted-Jiang commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r827574736



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,24 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.
+  - `year` :`EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 2020`
+  - `month`:`EXTRACT(month FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 9`
+  - `week` :`EXTRACT(week FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 23`
+  - `day`: `EXTRACT(day FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 8`
+  - `hour`: `EXTRACT(hour FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 12`
+  - `minute`: `EXTRACT(minute FROM to_timestamp('2020-09-08T12:01:00+00:00')) -> 1`
+  - `second`: `EXTRACT(second FROM to_timestamp('2020-09-08T12:00:03+00:00')) -> 3`
+

Review comment:
       Got it, Thanks.




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



[GitHub] [arrow-datafusion] liukun4515 commented on pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#issuecomment-1068622200


   > 
   
   @yjshen I have pointed out this issue like https://github.com/apache/arrow-datafusion/issues/1379
   I have a plan to do and consolidate them.


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



[GitHub] [arrow-datafusion] Ted-Jiang commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r827569105



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,24 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.
+  - `year` :`EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 2020`
+  - `month`:`EXTRACT(month FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 9`
+  - `week` :`EXTRACT(week FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 23`
+  - `day`: `EXTRACT(day FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 8`
+  - `hour`: `EXTRACT(hour FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 12`
+  - `minute`: `EXTRACT(minute FROM to_timestamp('2020-09-08T12:01:00+00:00')) -> 1`
+  - `second`: `EXTRACT(second FROM to_timestamp('2020-09-08T12:00:03+00:00')) -> 3`
+

Review comment:
       PG saild: The date_part function is modeled on the traditional Ingres equivalent to the SQL-standard function extract:




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



[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r824735397



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,31 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.
+  - `year`
+  - `EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 2020`

Review comment:
       ```suggestion
     - `year`: EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 2020
   ```




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



[GitHub] [arrow-datafusion] liukun4515 commented on pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#issuecomment-1066752107


   @Ted-Jiang  please fix the format of the document.


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



[GitHub] [arrow-datafusion] yjshen merged pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
yjshen merged pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991


   


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



[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r824728699



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,31 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.

Review comment:
       ```suggestion
     The source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
   ```




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



[GitHub] [arrow-datafusion] liukun4515 commented on pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#issuecomment-1068622681


   > It seems we modeled after PostgreSQL for both the function and this documentation. I've noticed some gaps in the supported types and the return type. Do we have notes elsewhere, or should we create TODOs to fill the gap?
   
   @yjshen I have pointed out this issue like https://github.com/apache/arrow-datafusion/issues/1379
   I have a plan to do and consolidate them.


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



[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r824737187



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,31 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.
+  - `year`
+  - `EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 2020`
+  - `month`
+  - `EXTRACT(month FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 9`
+  - `week`
+  - `EXTRACT(week FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 23`
+  - `day`
+  - `EXTRACT(day FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 8`
+  - `hour`
+  - `EXTRACT(hour FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 12`
+  - `minute`
+  - `EXTRACT(minute FROM to_timestamp('2020-09-08T12:01:00+00:00')) -> 1`
+  - `second`
+  - `EXTRACT(second FROM to_timestamp('2020-09-08T12:00:03+00:00')) -> 3`

Review comment:
       ```suggestion
   
     - `year`: EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 2020
     - `month`: EXTRACT(month FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 9
     - `week`: EXTRACT(week FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 23
     - `day`: EXTRACT(day FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 8
     - `hour`: EXTRACT(hour FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 12
     - `minute`: EXTRACT(minute FROM to_timestamp('2020-09-08T12:01:00+00:00')) -> 1
     - `second`: EXTRACT(second FROM to_timestamp('2020-09-08T12:00:03+00:00')) -> 3
   
   ```




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



[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r824727599



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,31 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`

Review comment:
       ```suggestion
   ## `EXTRACT, date_part`
   ```




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



[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r825913664



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,31 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.

Review comment:
       I think this is just a little issue for me, after my careful research I will give a feedback in the issue




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



[GitHub] [arrow-datafusion] liukun4515 removed a comment on pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
liukun4515 removed a comment on pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#issuecomment-1068622200


   > 
   
   @yjshen I have pointed out this issue like https://github.com/apache/arrow-datafusion/issues/1379
   I have a plan to do and consolidate them.


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



[GitHub] [arrow-datafusion] yjshen commented on a change in pull request #1991: Add doc for EXTRACT, date_part

Posted by GitBox <gi...@apache.org>.
yjshen commented on a change in pull request #1991:
URL: https://github.com/apache/arrow-datafusion/pull/1991#discussion_r826979661



##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,24 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.

Review comment:
       ```suggestion
   - The `extract` function retrieves subfields such as year or hour from date/time values.
   ```

##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,24 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.

Review comment:
       ```suggestion
     `source` must be a value expression of type timestamp, Data32, or Data64. `field` is an identifier that selects what field to extract from the source value.
   ```

##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,24 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.
+  - `year` :`EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 2020`
+  - `month`:`EXTRACT(month FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 9`
+  - `week` :`EXTRACT(week FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 23`
+  - `day`: `EXTRACT(day FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 8`
+  - `hour`: `EXTRACT(hour FROM to_timestamp('2020-09-08T12:00:00+00:00')) -> 12`
+  - `minute`: `EXTRACT(minute FROM to_timestamp('2020-09-08T12:01:00+00:00')) -> 1`
+  - `second`: `EXTRACT(second FROM to_timestamp('2020-09-08T12:00:03+00:00')) -> 3`
+

Review comment:
       The `date_part` function is modeled on the postgres equivalent to the SQL-standard function extract:

##########
File path: docs/source/user-guide/sql/datafusion-functions.md
##########
@@ -84,3 +84,24 @@ Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolut
 - Other Timestamp() columns or values
 
 Note that `CAST(.. AS Timestamp)` converts to Timestamps with Nanosecond resolution; this function is the only way to convert/cast to seconds resolution.
+
+## `EXTRACT, date_part`
+
+`EXTRACT(field FROM source)`
+
+- The extract function retrieves subfields such as year or hour from date/time values.
+  source must be a value expression of type timestamp, Data32, Data64 field is an identifier that selects what field to extract from the source value.
+  The extract function returns values of type u32.

Review comment:
       ```suggestion
     The `extract` function returns values of type u32.
   ```




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