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/07/16 14:55:08 UTC
[GitHub] [arrow-datafusion] waitingkuo opened a new pull request, #2924: add from_unixtime
waitingkuo opened a new pull request, #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #2871
# 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.
-->
a new `from_unixtime` expression added
# 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] alamb commented on pull request #2924: Add `from_unixtime` function
Posted by GitBox <gi...@apache.org>.
alamb commented on PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924#issuecomment-1188237663
Hi @waitingkuo -- I normally re-trigger jobs like this

However, since this PR passed tests previously and the only thing that was changed was the removal of a `println` I am going to YOLO this and just merge.
Thanks again!
--
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] waitingkuo commented on pull request #2924: Add `from_unixtime` function
Posted by GitBox <gi...@apache.org>.
waitingkuo commented on PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924#issuecomment-1188242068
@alamb Looks like that i have no permission to do so

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] alamb commented on a diff in pull request #2924: Add `from_unixtime` function
Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924#discussion_r923700638
##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -333,6 +333,8 @@ pub fn date_part(args: &[ColumnarValue]) -> Result<ColumnarValue> {
}
let (date_part, array) = (&args[0], &args[1]);
+ println!("date_part --> {:?}", date_part.data_type());
Review Comment:
No problems!
--
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] codecov-commenter commented on pull request #2924: add from_unixtime
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924#issuecomment-1186218436
# [Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/2924?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#2924](https://codecov.io/gh/apache/arrow-datafusion/pull/2924?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6e4b8c1) into [master](https://codecov.io/gh/apache/arrow-datafusion/commit/fe1995f31164774776baf67f6fb26ba66c42db0b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fe1995f) will **increase** coverage by `0.02%`.
> The diff coverage is `84.61%`.
```diff
@@ Coverage Diff @@
## master #2924 +/- ##
==========================================
+ Coverage 85.30% 85.32% +0.02%
==========================================
Files 273 273
Lines 49269 49382 +113
==========================================
+ Hits 42028 42135 +107
- Misses 7241 7247 +6
```
| [Impacted Files](https://codecov.io/gh/apache/arrow-datafusion/pull/2924?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [datafusion/proto/src/from\_proto.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9wcm90by9zcmMvZnJvbV9wcm90by5ycw==) | `34.52% <0.00%> (-0.12%)` | :arrow_down: |
| [datafusion/proto/src/to\_proto.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9wcm90by9zcmMvdG9fcHJvdG8ucnM=) | `56.36% <0.00%> (-0.10%)` | :arrow_down: |
| [datafusion/physical-expr/src/functions.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9mdW5jdGlvbnMucnM=) | `92.71% <71.42%> (-0.17%)` | :arrow_down: |
| [datafusion/core/tests/sql/timestamp.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9jb3JlL3Rlc3RzL3NxbC90aW1lc3RhbXAucnM=) | `100.00% <100.00%> (ø)` | |
| [datafusion/expr/src/built\_in\_function.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9leHByL3NyYy9idWlsdF9pbl9mdW5jdGlvbi5ycw==) | `100.00% <100.00%> (ø)` | |
| [datafusion/expr/src/expr\_fn.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9leHByL3NyYy9leHByX2ZuLnJz) | `89.47% <100.00%> (+0.06%)` | :arrow_up: |
| [datafusion/expr/src/function.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9leHByL3NyYy9mdW5jdGlvbi5ycw==) | `97.60% <100.00%> (+0.03%)` | :arrow_up: |
| [...tafusion/physical-expr/src/datetime\_expressions.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9kYXRldGltZV9leHByZXNzaW9ucy5ycw==) | `78.04% <100.00%> (+0.13%)` | :arrow_up: |
| [datafusion/expr/src/window\_frame.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9leHByL3NyYy93aW5kb3dfZnJhbWUucnM=) | `92.43% <0.00%> (-0.85%)` | :arrow_down: |
| [datafusion/common/src/pyarrow.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9jb21tb24vc3JjL3B5YXJyb3cucnM=) | `0.00% <0.00%> (ø)` | |
| ... and [5 more](https://codecov.io/gh/apache/arrow-datafusion/pull/2924/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/2924?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/2924?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [fe1995f...6e4b8c1](https://codecov.io/gh/apache/arrow-datafusion/pull/2924?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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] alamb merged pull request #2924: Add `from_unixtime` function
Posted by GitBox <gi...@apache.org>.
alamb merged PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924
--
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] ursabot commented on pull request #2924: Add `from_unixtime` function
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924#issuecomment-1188249013
Benchmark runs are scheduled for baseline = a2be1dc397fde42a1b24e810c14bb1ed109a304a and contender = b772c6df99fa23bbb75b65d06afb2e4dd3bba697. b772c6df99fa23bbb75b65d06afb2e4dd3bba697 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/602eefcf46e14f78a069104479a173a9...54592367924e4f87b47ca8ad049e36fe/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/656116f1d95f41dda516fa6c090fc712...99c2301d21094d6b9de02fddb4877fc6/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/0b21a3bf8cb04aa5b2afb956b9d23b74...14fbd2ef8bfa447db18ee6b28efcaed1/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/62178048bee2488ab7029b34ebae7511...8dbbec480dc145a8980e5f7ae2032b2c/)
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
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] waitingkuo commented on pull request #2924: Add `from_unixtime` function
Posted by GitBox <gi...@apache.org>.
waitingkuo commented on PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924#issuecomment-1188235055
Got the "No space left error"
```bash
Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/github/home/target/debug/examples/avro_sql-2824a43bdc617b6b" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
= note: /usr/bin/ld: final link failed: No space left on device
collect2: error: ld returned 1 exit status
error: could not compile `datafusion-examples` due to previous error
Error: Process completed with exit code 101.
```
<https://github.com/apache/arrow-datafusion/runs/7395447529?check_suite_focus=true>
Is there any way to re-trigger this without an empty commit?
--
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] alamb commented on a diff in pull request #2924: Add `from_unixtime` function
Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924#discussion_r923642791
##########
datafusion/core/tests/sql/timestamp.rs:
##########
@@ -266,6 +266,37 @@ async fn query_cast_timestamp_micros_to_others() -> Result<()> {
Ok(())
}
+#[tokio::test]
+async fn query_cast_timestamp_from_unixtime() -> Result<()> {
+ let ctx = SessionContext::new();
+
+ let t1_schema = Arc::new(Schema::new(vec![Field::new("ts", DataType::Int64, true)]));
+ let t1_data = RecordBatch::try_new(
+ t1_schema.clone(),
+ vec![Arc::new(Int64Array::from(vec![
+ 1235865600, 1235865660, 1238544000,
+ ]))],
+ )?;
+ let t1_table = MemTable::try_new(t1_schema, vec![vec![t1_data]])?;
+ ctx.register_table("t1", Arc::new(t1_table))?;
+
+ let sql = "SELECT from_unixtime(ts) FROM t1 LIMIT 3";
+ let actual = execute_to_batches(&ctx, sql).await;
+
+ let expected = vec![
Review Comment:
For what it is worth `mysql` gives a different answer (defaults to local time)
```sql
mysql> select from_unixtime(1238544000);
+---------------------------+
| from_unixtime(1238544000) |
+---------------------------+
| 2009-03-31 20:00:00 |
+---------------------------+
1 row in set (0.00 sec)
```
However, when I set the session timezone to UTC things look good
```sql
mysql> SET time_zone = '+0:00';
Query OK, 0 rows affected (0.00 sec)
mysql> select from_unixtime(1238544000);
+---------------------------+
| from_unixtime(1238544000) |
+---------------------------+
| 2009-04-01 00:00:00 |
+---------------------------+
1 row in set (0.00 sec)
```
(This behavior is not unique to `from_unixtime` I think it affects all timestamp arithmetic in DataFusion)
##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -333,6 +333,8 @@ pub fn date_part(args: &[ColumnarValue]) -> Result<ColumnarValue> {
}
let (date_part, array) = (&args[0], &args[1]);
+ println!("date_part --> {:?}", date_part.data_type());
Review Comment:
This seems like a left over from debugging
##########
datafusion/physical-expr/src/functions.rs:
##########
@@ -152,6 +152,23 @@ pub fn create_physical_expr(
}
}
}),
+ BuiltinScalarFunction::FromUnixtime => Arc::new({
+ match coerced_phy_exprs[0].data_type(input_schema) {
+ Ok(DataType::Int64) => |col_values: &[ColumnarValue]| {
+ cast_column(
Review Comment:
👍
--
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] waitingkuo commented on a diff in pull request #2924: Add `from_unixtime` function
Posted by GitBox <gi...@apache.org>.
waitingkuo commented on code in PR #2924:
URL: https://github.com/apache/arrow-datafusion/pull/2924#discussion_r923675010
##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -333,6 +333,8 @@ pub fn date_part(args: &[ColumnarValue]) -> Result<ColumnarValue> {
}
let (date_part, array) = (&args[0], &args[1]);
+ println!("date_part --> {:?}", date_part.data_type());
Review Comment:
just fixed, apologize for the carelessness
--
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