Skip to content

Commit 2fd5097

Browse files
committed
Merge branch 'is-it-fresh-exp-5.6'
2 parents df9da5a + d7ce32b commit 2fd5097

File tree

8 files changed

+1131
-17
lines changed

8 files changed

+1131
-17
lines changed

src/commands/buffer.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,20 @@ impl Buffer {
507507
| Operation {
508508
op: OperationType::HllRead,
509509
..
510+
}
511+
| Operation {
512+
op: OperationType::ExpRead,
513+
..
510514
} => read_attr |= INFO1_READ,
511515
_ => write_attr |= INFO2_WRITE,
512516
}
513517

514518
let each_op = matches!(
515519
operation.data,
516-
OperationData::CdtMapOp(_) | OperationData::CdtBitOp(_)
520+
OperationData::CdtMapOp(_)
521+
| OperationData::CdtBitOp(_)
522+
| OperationData::HLLOp(_)
523+
| OperationData::EXPOp(_)
517524
);
518525

519526
if policy.respond_per_each_op || each_op {
@@ -556,7 +563,6 @@ impl Buffer {
556563
for operation in operations {
557564
operation.write_to(self)?;
558565
}
559-
560566
self.end()
561567
}
562568

src/expressions/hll.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const MODULE: i64 = 2;
2323

2424
#[doc(hidden)]
2525
pub enum HllExpOp {
26+
Init = 0,
2627
Add = 1,
2728
Count = 50,
2829
Union = 51,
@@ -33,6 +34,33 @@ pub enum HllExpOp {
3334
MayContain = 56,
3435
}
3536

37+
/// Create expression that creates a new HLL or resets an existing HLL.
38+
pub fn init(
39+
policy: HLLPolicy,
40+
index_bit_count: FilterExpression,
41+
bin: FilterExpression,
42+
) -> FilterExpression {
43+
init_with_min_hash(policy, index_bit_count, int_val(-1), bin)
44+
}
45+
46+
/// Create expression that creates a new HLL or resets an existing HLL with minhash bits.
47+
pub fn init_with_min_hash(
48+
policy: HLLPolicy,
49+
index_bit_count: FilterExpression,
50+
min_hash_count: FilterExpression,
51+
bin: FilterExpression,
52+
) -> FilterExpression {
53+
add_write(
54+
bin,
55+
vec![
56+
ExpressionArgument::Value(Value::from(HllExpOp::Init as i64)),
57+
ExpressionArgument::FilterExpression(index_bit_count),
58+
ExpressionArgument::FilterExpression(min_hash_count),
59+
ExpressionArgument::Value(Value::from(policy.flags as i64)),
60+
],
61+
)
62+
}
63+
3664
/// Create expression that adds list values to a HLL set and returns HLL set.
3765
/// The function assumes HLL bin already exists.
3866
/// ```

0 commit comments

Comments
 (0)