Skip to content

Commit

Permalink
bitwise feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed Oct 6, 2024
1 parent 3ba9452 commit 5b7074d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crates/polars-sql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "SQL transpiler for Polars. Converts SQL to Polars logical plans"

[dependencies]
arrow = { workspace = true }
polars-core = { workspace = true, features = ["bitwise", "rows"] }
polars-core = { workspace = true, features = ["rows"] }
polars-error = { workspace = true }
polars-lazy = { workspace = true, features = ["abs", "binary_encoding", "concat_str", "cross_join", "cum_agg", "dtype-date", "dtype-decimal", "dtype-struct", "is_in", "list_eval", "log", "meta", "regex", "round_series", "sign", "string_reverse", "strings", "timezones", "trigonometry"] }
polars-ops = { workspace = true }
Expand All @@ -24,7 +24,6 @@ rand = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
sqlparser = { workspace = true }
# sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs.git", rev = "ae3b5844c839072c235965fe0d1bddc473dced87" }

[dev-dependencies]
# to display dataframes in case of test failures
Expand All @@ -34,6 +33,7 @@ polars-core = { workspace = true, features = ["fmt"] }
default = []
nightly = []
binary_encoding = ["polars-lazy/binary_encoding"]
bitwise = ["polars-lazy/bitwise"]
csv = ["polars-lazy/csv"]
diagonal_concat = ["polars-lazy/diagonal_concat"]
dtype-decimal = ["polars-lazy/dtype-decimal"]
Expand Down
3 changes: 3 additions & 0 deletions crates/polars-sql/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub(crate) enum PolarsSQLFunctions {
/// ```sql
/// SELECT BIT_COUNT(column_1) FROM df;
/// ```
#[cfg(feature = "bitwise")]
BitCount,
/// SQL 'bit_or' function.
/// Returns the bitwise OR of the input expressions.
Expand Down Expand Up @@ -754,6 +755,7 @@ impl PolarsSQLFunctions {
// Bitwise functions
// ----
"bit_and" | "bitand" => Self::BitAnd,
#[cfg(feature = "bitwise")]
"bit_count" | "bitcount" => Self::BitCount,
"bit_or" | "bitor" => Self::BitOr,
"bit_xor" | "bitxor" | "xor" => Self::BitXor,
Expand Down Expand Up @@ -913,6 +915,7 @@ impl SQLFunctionVisitor<'_> {
// Bitwise functions
// ----
BitAnd => self.visit_binary::<Expr>(Expr::and),
#[cfg(feature = "bitwise")]
BitCount => self.visit_unary(Expr::bitwise_count_ones),
BitOr => self.visit_binary::<Expr>(Expr::or),
BitXor => self.visit_binary::<Expr>(Expr::xor),
Expand Down
8 changes: 7 additions & 1 deletion crates/polars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ array_any_all = ["polars-lazy?/array_any_all", "dtype-array"]
asof_join = ["polars-lazy?/asof_join", "polars-ops/asof_join"]
iejoin = ["polars-lazy?/iejoin"]
binary_encoding = ["polars-ops/binary_encoding", "polars-lazy?/binary_encoding", "polars-sql?/binary_encoding"]
bitwise = ["polars-core/bitwise", "polars-plan?/bitwise", "polars-ops/bitwise", "polars-lazy?/bitwise"]
bitwise = [
"polars-core/bitwise",
"polars-plan?/bitwise",
"polars-ops/bitwise",
"polars-lazy?/bitwise",
"polars-sql?/bitwise",
]
business = ["polars-lazy?/business", "polars-ops/business"]
checked_arithmetic = ["polars-core/checked_arithmetic"]
chunked_ids = ["polars-ops?/chunked_ids"]
Expand Down

0 comments on commit 5b7074d

Please sign in to comment.