Skip to content

Conversation

@waitingkuo
Copy link
Contributor

Which issue does this PR close?

Closes #3095

Rationale for this change

allow us to use arrow_typeof to check the datatype
e.g.

select arrow_typeof(now());
+------------------------------------+
| arrowtypeof(now())                 |
+------------------------------------+
| Timestamp(Nanosecond, Some("UTC")) |
+------------------------------------+
1 row in set. Query took 0.034 seconds.
select arrow_typeof(1.0::float);
+------------------------------------------+
| arrowtypeof(CAST(Float64(1) AS Float32)) |
+------------------------------------------+
| Float32                                  |
+------------------------------------------+
1 row in set. Query took 0.005 seconds.

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates labels Aug 12, 2022
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome and very helpful @waitingkuo 👍

#[tokio::test]
async fn arrow_typeof_null() -> Result<()> {
let ctx = SessionContext::new();
let sql = "SELECT arrow_typeof(true)";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test is named 'typeof_nullbut this seems to test aarrow_typeof(true)rather thanarrow_typeof(null)`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thank you.

@codecov-commenter
Copy link

Codecov Report

Merging #3120 (989a2d1) into master (56052c5) will increase coverage by 0.02%.
The diff coverage is 97.70%.

@@            Coverage Diff             @@
##           master    #3120      +/-   ##
==========================================
+ Coverage   85.93%   85.95%   +0.02%     
==========================================
  Files         290      291       +1     
  Lines       52295    52382      +87     
==========================================
+ Hits        44939    45025      +86     
- Misses       7356     7357       +1     
Impacted Files Coverage Δ
datafusion/core/tests/sql/mod.rs 97.79% <ø> (ø)
datafusion/proto/src/from_proto.rs 35.27% <0.00%> (-0.05%) ⬇️
datafusion/proto/src/to_proto.rs 52.84% <0.00%> (-0.10%) ⬇️
datafusion/core/tests/sql/arrow_typeof.rs 100.00% <100.00%> (ø)
datafusion/expr/src/built_in_function.rs 100.00% <100.00%> (ø)
datafusion/expr/src/expr_fn.rs 91.01% <100.00%> (+0.05%) ⬆️
datafusion/expr/src/function.rs 97.75% <100.00%> (+0.01%) ⬆️
datafusion/physical-expr/src/functions.rs 92.75% <100.00%> (+0.02%) ⬆️
datafusion/expr/src/window_frame.rs 92.43% <0.00%> (-0.85%) ⬇️
datafusion/expr/src/logical_plan/plan.rs 77.95% <0.00%> (+0.34%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@alamb alamb merged commit 9e0bc50 into apache:master Aug 13, 2022
@alamb
Copy link
Contributor

alamb commented Aug 13, 2022

Thanks again @waitingkuo ❤️

@ursabot
Copy link

ursabot commented Aug 13, 2022

Benchmark runs are scheduled for baseline = c525e6c and contender = 9e0bc50. 9e0bc50 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a arrow_typeof like posgresql's pg_typeof

4 participants