Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the to_timestamp* functions to datafusion-functions #9388

Merged
merged 26 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6ffb364
WIP
Omega359 Feb 21, 2024
aa56090
Merge remote-tracking branch 'upstream/main' into feature/9291
Omega359 Feb 21, 2024
b1868ef
WIP
Omega359 Feb 21, 2024
aa1c5a6
Merge remote-tracking branch 'upstream/main' into feature/9291
Omega359 Feb 28, 2024
d8e6016
cargo fmt updates.
Omega359 Feb 28, 2024
78baa96
Migrate to_timestamp* functions to new functions crate.
Omega359 Feb 28, 2024
45bea0f
Merge remote-tracking branch 'upstream/main' into feature/9291
Omega359 Feb 28, 2024
a02ecae
update to allow wasm run to complete.
Omega359 Feb 28, 2024
87a9797
Fix expr_api example
Omega359 Feb 28, 2024
54d5ee6
cargo fmt.
Omega359 Feb 28, 2024
00fa3cb
Update datafusion/core/tests/simplification.rs
Omega359 Feb 28, 2024
320f867
Revert changes to sql in tests to restore to_timestamp(..) calls.
Omega359 Feb 28, 2024
152fc83
Merge remote-tracking branch 'upstream/main' into feature/9291
Omega359 Feb 29, 2024
4fd9ec9
Rust fmt apparently can't make up it's mind.
Omega359 Feb 29, 2024
d83cef5
Updates for merge and moving some expression simplifier tests from op…
Omega359 Feb 29, 2024
dd9baa0
Revert test changes
alamb Feb 29, 2024
10b0a8a
Update datafusion/core/tests/simplification.rs
alamb Feb 29, 2024
c172c4c
Move cast_column to `ColumnarValue::cast_to`
alamb Feb 29, 2024
d5f9615
Remove datafusion-physical-expr dependency
alamb Feb 29, 2024
e29e62d
Merge pull request #1 from alamb/alamb/move_cast
Omega359 Mar 1, 2024
0767a07
Merge remote-tracking branch 'upstream/main' into feature/9291
Omega359 Mar 1, 2024
f59254e
Move dependencies to dev
alamb Mar 1, 2024
7a1cc02
Fix merge conflict by migrating to_date to new functions module along…
Omega359 Mar 1, 2024
c3a8d0e
Merge remote-tracking branch 'origin/feature/9291' into feature/9291
Omega359 Mar 1, 2024
b1fd2bf
Cargo lock update from merge.
Omega359 Mar 1, 2024
200e2f8
Add missing licenses.
Omega359 Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ jobs:
- name: Check function packages (array_expressions)
run: cargo check --no-default-features --features=array_expressions -p datafusion

- name: Check function packages (datetime_expressions)
run: cargo check --no-default-features --features=datetime_expressions -p datafusion

- name: Check Cargo.lock for datafusion-cli
run: |
# If this test fails, try running `cargo update` in the `datafusion-cli` directory
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Default features:
- `array_expressions`: functions for working with arrays such as `array_to_string`
- `compression`: reading files compressed with `xz2`, `bzip2`, `flate2`, and `zstd`
- `crypto_expressions`: cryptographic functions such as `md5` and `sha256`
- `datetime_expressions`: date and time functions such as `to_timestamp`
- `encoding_expressions`: `encode` and `decode` functions
- `parquet`: support for reading the [Apache Parquet] format
- `regex_expressions`: regular expression functions, such as `regexp_match`
Expand Down
3 changes: 3 additions & 0 deletions datafusion-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions datafusion-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ clap = { version = "3", features = ["derive", "cargo"] }
datafusion = { path = "../datafusion/core", version = "36.0.0", features = [
"avro",
"crypto_expressions",
"datetime_expressions",
"encoding_expressions",
"parquet",
"regex_expressions",
Expand Down
11 changes: 5 additions & 6 deletions datafusion-examples/examples/expr_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
// specific language governing permissions and limitations
// under the License.

use std::collections::HashMap;
use std::sync::Arc;

use arrow::array::{BooleanArray, Int32Array};
use arrow::record_batch::RecordBatch;

use datafusion::arrow::datatypes::{DataType, Field, Schema, TimeUnit};
use datafusion::common::{DFField, DFSchema};
use datafusion::error::Result;
Expand All @@ -30,8 +34,6 @@ use datafusion_common::{ScalarValue, ToDFSchema};
use datafusion_expr::expr::BinaryExpr;
use datafusion_expr::interval_arithmetic::Interval;
use datafusion_expr::{ColumnarValue, ExprSchemable, Operator};
use std::collections::HashMap;
use std::sync::Arc;

/// This example demonstrates the DataFusion [`Expr`] API.
///
Expand Down Expand Up @@ -113,10 +115,7 @@ fn evaluate_demo() -> Result<()> {
fn simplify_demo() -> Result<()> {
// For example, lets say you have has created an expression such
// ts = to_timestamp("2020-09-08T12:00:00+00:00")
let expr = col("ts").eq(call_fn(
"to_timestamp",
vec![lit("2020-09-08T12:00:00+00:00")],
)?);
let expr = col("ts").eq(to_timestamp(vec![lit("2020-09-08T12:00:00+00:00")]));
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


// Naively evaluating such an expression against a large number of
// rows would involve re-converting "2020-09-08T12:00:00+00:00" to a
Expand Down
7 changes: 7 additions & 0 deletions datafusion/common/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@
// specific language governing permissions and limitations
// under the License.

use arrow::compute::CastOptions;
use arrow::util::display::{DurationFormat, FormatOptions};

/// The default [`FormatOptions`] to use within DataFusion
pub const DEFAULT_FORMAT_OPTIONS: FormatOptions<'static> =
FormatOptions::new().with_duration_format(DurationFormat::Pretty);

/// The default [`CastOptions`] to use within DataFusion
pub const DEFAULT_CAST_OPTIONS: CastOptions<'static> = CastOptions {
safe: false,
format_options: DEFAULT_FORMAT_OPTIONS,
};
2 changes: 2 additions & 0 deletions datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ avro = ["apache-avro", "num-traits", "datafusion-common/avro"]
backtrace = ["datafusion-common/backtrace"]
compression = ["xz2", "bzip2", "flate2", "zstd", "async-compression", "tokio-util"]
crypto_expressions = ["datafusion-physical-expr/crypto_expressions", "datafusion-optimizer/crypto_expressions"]
datetime_expressions = ["datafusion-functions/datetime_expressions"]
default = [
"array_expressions",
"crypto_expressions",
"datetime_expressions",
"encoding_expressions",
"regex_expressions",
"unicode_expressions",
Expand Down
Loading
Loading