Skip to content

Commit ec7fb99

Browse files
committed
Add dictionary_expresions feature (apache#4386)
1 parent 6dce728 commit ec7fb99

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ jobs:
9595
- name: Build tests
9696
run: |
9797
export PATH=$PATH:$HOME/d/protoc/bin
98-
cargo test --features avro,jit,scheduler,json --no-run
98+
cargo test --features avro,jit,scheduler,json,dictionary_expressions --no-run
9999
- name: Run tests
100100
run: |
101101
export PATH=$PATH:$HOME/d/protoc/bin
102-
cargo test --features avro,jit,scheduler,json
102+
cargo test --features avro,jit,scheduler,json,dictionary_expressions
103103
- name: Run examples
104104
run: |
105105
export PATH=$PATH:$HOME/d/protoc/bin

datafusion/core/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ regex_expressions = ["datafusion-physical-expr/regex_expressions"]
5353
scheduler = ["rayon"]
5454
simd = ["arrow/simd"]
5555
unicode_expressions = ["datafusion-physical-expr/regex_expressions", "datafusion-sql/unicode_expressions"]
56+
# Enables support for non scalar, binary operations on dictionaries (note this results in significant additional codegen)
57+
dictionary_expressions = ["datafusion-physical-expr/dictionary_expressions"]
5658

5759
[dependencies]
5860
ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] }
@@ -102,7 +104,6 @@ xz2 = { version = "0.1", optional = true }
102104

103105

104106
[dev-dependencies]
105-
arrow = { version = "31.0.0", features = ["prettyprint", "dyn_cmp_dict"] }
106107
async-trait = "0.1.53"
107108
criterion = "0.4"
108109
csv = "1.1.6"

datafusion/core/tests/path_partition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ async fn csv_filter_with_file_col() -> Result<()> {
204204
);
205205

206206
let result = ctx
207-
.sql("SELECT c1, c2 FROM t WHERE date='2021-10-27' and date!=c1 LIMIT 5")
207+
.sql("SELECT c1, c2 FROM t WHERE date='2021-10-27' and c1!='2021-10-27' LIMIT 5")
208208
.await?
209209
.collect()
210210
.await?;

datafusion/core/tests/sql/select.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ async fn query_nested_get_indexed_field_on_struct() -> Result<()> {
621621
}
622622

623623
#[tokio::test]
624+
#[cfg(feature = "dictionary_expressions")]
624625
async fn query_on_string_dictionary() -> Result<()> {
625626
// Test to ensure DataFusion can operate on dictionary types
626627
// Use StringDictionary (32 bit indexes = keys)

datafusion/physical-expr/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repository = "https://github.com/apache/arrow-datafusion"
2424
readme = "README.md"
2525
authors = ["Apache Arrow <[email protected]>"]
2626
license = "Apache-2.0"
27-
keywords = [ "arrow", "query", "sql" ]
27+
keywords = ["arrow", "query", "sql"]
2828
edition = "2021"
2929
rust-version = "1.62"
3030

@@ -37,10 +37,13 @@ crypto_expressions = ["md-5", "sha2", "blake2", "blake3"]
3737
default = ["crypto_expressions", "regex_expressions", "unicode_expressions"]
3838
regex_expressions = ["regex"]
3939
unicode_expressions = ["unicode-segmentation"]
40+
# Enables support for non-scalar, binary operations on dictionaries
41+
# Note: this results in significant additional codegen
42+
dictionary_expressions = ["arrow/dyn_cmp_dict", "arrow/dyn_arith_dict"]
4043

4144
[dependencies]
4245
ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] }
43-
arrow = { version = "31.0.0", features = ["prettyprint", "dyn_cmp_dict"] }
46+
arrow = { version = "31.0.0", features = ["prettyprint"] }
4447
arrow-buffer = "31.0.0"
4548
arrow-schema = "31.0.0"
4649
blake2 = { version = "^0.10.2", optional = true }

datafusion/physical-expr/src/expressions/binary.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,7 @@ mod tests {
15021502
// is no way at the time of this writing to create a dictionary
15031503
// array using the `From` trait
15041504
#[test]
1505+
#[cfg(feature = "dictionary_expressions")]
15051506
fn test_dictionary_type_to_array_coersion() -> Result<()> {
15061507
// Test string a string dictionary
15071508
let dict_type =

0 commit comments

Comments
 (0)