You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/04/22 11:55:42 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6088: refactor(sqllogictests): port group by test to sqllogic

alamb commented on code in PR #6088:
URL: https://github.com/apache/arrow-datafusion/pull/6088#discussion_r1174398296


##########
datafusion/core/tests/sqllogictests/src/setup.rs:
##########
@@ -39,6 +41,95 @@ pub async fn register_aggregate_tables(ctx: &SessionContext) {
     register_test_data(ctx);
 }
 
+pub async fn register_group_tables(ctx: &SessionContext) {
+    register_time_test_tables(ctx);
+}
+
+/// Create and populate time32_s, time32_ms, time64_us, time64_ns tables
+fn register_time_test_tables(ctx: &SessionContext) {

Review Comment:
   I don't think you need rust code to do this setup anymore
   
   You can create arbitrary Arrow types that have no corresponding SQL types with the `arrow_cast` function -- https://arrow.apache.org/datafusion/user-guide/sql/data_types.html
   
   For example, here is one way to do it:
   https://github.com/apache/arrow-datafusion/blob/7759d96e892e7c159136af35ebc0def49ed3b3b1/datafusion/core/tests/sqllogictests/test_files/timestamps.slt#L113-L129
   
   So you can make a value of `Time32(Seconds)` with something like
   
   ```sql
   ❯ select arrow_cast(5000::int, 'Time32(Second)');
   +-------------+
   | Int64(5000) |
   +-------------+
   | 01:23:20    |
   +-------------+
   ```



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