Skip to content

Commit e581c10

Browse files
authored
fix: update object store crate to 0.10.2 (#870)
Co-authored-by: parmesant <[email protected]>
1 parent 225d640 commit e581c10

File tree

9 files changed

+497
-384
lines changed

9 files changed

+497
-384
lines changed

Cargo.lock

Lines changed: 219 additions & 134 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ build = "build.rs"
1010
[dependencies]
1111
### apache arrow/datafusion dependencies
1212
# arrow = "51.0.0"
13-
arrow-schema = { version = "51.0.0", features = ["serde"] }
14-
arrow-array = { version = "51.0.0" }
15-
arrow-json = "51.0.0"
16-
arrow-ipc = { version = "51.0.0", features = ["zstd"] }
17-
arrow-select = "51.0.0"
18-
datafusion = "37.1.0"
19-
object_store = { version = "0.9.1", features = ["cloud", "aws"] } # cannot update object_store as datafusion has not caught up
20-
parquet = "51.0.0"
21-
arrow-flight = { version = "51.0.0", features = [ "tls" ] }
13+
arrow-schema = { version = "52.1.0", features = ["serde"] }
14+
arrow-array = { version = "52.1.0" }
15+
arrow-json = "52.1.0"
16+
arrow-ipc = { version = "52.1.0", features = ["zstd"] }
17+
arrow-select = "52.1.0"
18+
datafusion = { git = "https://github.com/apache/datafusion.git", rev = "a64df83502821f18067fb4ff65dd217815b305c9" }
19+
object_store = { version = "0.10.2", features = ["cloud", "aws"] } # cannot update object_store as datafusion has not caught up
20+
parquet = "52.1.0"
21+
arrow-flight = { version = "52.1.0", features = [ "tls" ] }
2222
tonic = {version = "0.11.0", features = ["tls", "transport", "gzip", "zstd"] }
2323
tonic-web = "0.11.0"
2424
tower-http = { version = "0.4.4", features = ["cors"] }
@@ -62,7 +62,7 @@ hex = "0.4"
6262
hostname = "0.4.0"
6363
http = "0.2.7"
6464
humantime-serde = "1.1"
65-
itertools = "0.12.1"
65+
itertools = "0.13.0"
6666
log = "0.4"
6767
num_cpus = "1.15"
6868
once_cell = "1.17.1"

server/src/handlers/http/llm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub async fn make_llm_request(body: web::Json<AiPrompt>) -> Result<HttpResponse,
9595
let stream_name = &body.stream;
9696
let schema = STREAM_INFO.schema(stream_name)?;
9797
let filtered_schema = schema
98-
.all_fields()
98+
.flattened_fields()
9999
.into_iter()
100100
.map(Field::from)
101101
.collect_vec();

server/src/hottier.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ impl HotTierManager {
396396
Ok(file_processed)
397397
}
398398

399+
#[allow(dead_code)]
399400
///delete the files for the date range given from the hot tier directory for the stream
400401
/// update the used and available size in the hot tier metadata
401402
pub async fn delete_files_from_hot_tier(

server/src/query.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl TableScanVisitor {
190190
}
191191
}
192192

193-
impl TreeNodeVisitor for TableScanVisitor {
193+
impl TreeNodeVisitor<'_> for TableScanVisitor {
194194
type Node = LogicalPlan;
195195

196196
fn f_down(&mut self, node: &Self::Node) -> Result<TreeNodeRecursion, DataFusionError> {
@@ -232,27 +232,27 @@ fn transform(
232232
_start_time_filter =
233233
PartialTimeFilter::Low(std::ops::Bound::Included(start_time))
234234
.binary_expr(Expr::Column(Column::new(
235-
Some(table.table_name.to_owned_reference()),
235+
Some(table.table_name.to_owned()),
236236
time_partition.clone(),
237237
)));
238238
_end_time_filter =
239239
PartialTimeFilter::High(std::ops::Bound::Excluded(end_time))
240240
.binary_expr(Expr::Column(Column::new(
241-
Some(table.table_name.to_owned_reference()),
241+
Some(table.table_name.to_owned()),
242242
time_partition,
243243
)));
244244
}
245245
None => {
246246
_start_time_filter =
247247
PartialTimeFilter::Low(std::ops::Bound::Included(start_time))
248248
.binary_expr(Expr::Column(Column::new(
249-
Some(table.table_name.to_owned_reference()),
249+
Some(table.table_name.to_owned()),
250250
event::DEFAULT_TIMESTAMP_KEY,
251251
)));
252252
_end_time_filter =
253253
PartialTimeFilter::High(std::ops::Bound::Excluded(end_time))
254254
.binary_expr(Expr::Column(Column::new(
255-
Some(table.table_name.to_owned_reference()),
255+
Some(table.table_name.to_owned()),
256256
event::DEFAULT_TIMESTAMP_KEY,
257257
)));
258258
}

server/src/query/filter_optimizer.rs

Lines changed: 158 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,158 @@
1-
/*
2-
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
3-
*
4-
* This program is free software: you can redistribute it and/or modify
5-
* it under the terms of the GNU Affero General Public License as
6-
* published by the Free Software Foundation, either version 3 of the
7-
* License, or (at your option) any later version.
8-
*
9-
* This program is distributed in the hope that it will be useful,
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
* GNU Affero General Public License for more details.
13-
*
14-
* You should have received a copy of the GNU Affero General Public License
15-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
*
17-
*/
18-
19-
use std::{collections::HashMap, sync::Arc};
20-
21-
use datafusion::{
22-
common::{DFField, DFSchema},
23-
logical_expr::{Filter, LogicalPlan, Projection},
24-
optimizer::{optimize_children, OptimizerRule},
25-
prelude::{lit, or, Column, Expr},
26-
scalar::ScalarValue,
27-
};
28-
29-
/// Rewrites logical plan for source using projection and filter
30-
pub struct FilterOptimizerRule {
31-
pub column: String,
32-
pub literals: Vec<String>,
33-
}
34-
35-
// Try to add filter node on table scan
36-
// As every table supports projection push down
37-
// we try to directly add projection for column directly to table
38-
// To preserve the orignal projection we must add a projection node with orignal projection
39-
impl OptimizerRule for FilterOptimizerRule {
40-
fn try_optimize(
41-
&self,
42-
plan: &datafusion::logical_expr::LogicalPlan,
43-
config: &dyn datafusion::optimizer::OptimizerConfig,
44-
) -> datafusion::error::Result<Option<datafusion::logical_expr::LogicalPlan>> {
45-
// if there are no patterns then the rule cannot be performed
46-
let Some(filter_expr) = self.expr() else {
47-
return Ok(None);
48-
};
49-
50-
if let LogicalPlan::Filter(filter) = plan {
51-
if filter.predicate == filter_expr {
52-
return Ok(None);
53-
}
54-
}
55-
56-
if let LogicalPlan::TableScan(table) = plan {
57-
if table.projection.is_none()
58-
|| table
59-
.filters
60-
.iter()
61-
.any(|expr| self.contains_valid_tag_filter(expr))
62-
{
63-
return Ok(None);
64-
}
65-
66-
let mut table = table.clone();
67-
let schema = &table.source.schema();
68-
let orignal_projection = table.projected_schema.clone();
69-
70-
// add filtered column projection to table
71-
if !table
72-
.projected_schema
73-
.has_column_with_unqualified_name(&self.column)
74-
{
75-
let tags_index = schema.index_of(&self.column)?;
76-
let tags_field = schema.field(tags_index);
77-
// modify source table projection to include tags
78-
let mut df_schema = table.projected_schema.fields().clone();
79-
df_schema.push(DFField::new(
80-
Some(table.table_name.clone()),
81-
tags_field.name(),
82-
tags_field.data_type().clone(),
83-
tags_field.is_nullable(),
84-
));
85-
86-
table.projected_schema =
87-
Arc::new(DFSchema::new_with_metadata(df_schema, HashMap::default())?);
88-
if let Some(projection) = &mut table.projection {
89-
projection.push(tags_index)
90-
}
91-
}
92-
93-
let filter = LogicalPlan::Filter(Filter::try_new(
94-
filter_expr,
95-
Arc::new(LogicalPlan::TableScan(table)),
96-
)?);
97-
let plan = LogicalPlan::Projection(Projection::new_from_schema(
98-
Arc::new(filter),
99-
orignal_projection,
100-
));
101-
102-
return Ok(Some(plan));
103-
}
104-
105-
// If we didn't find anything then recurse as normal and build the result.
106-
optimize_children(self, plan, config)
107-
}
108-
109-
fn name(&self) -> &str {
110-
"parseable_read_filter"
111-
}
112-
}
113-
114-
impl FilterOptimizerRule {
115-
fn expr(&self) -> Option<Expr> {
116-
let mut patterns = self.literals.iter().map(|literal| {
117-
Expr::Column(Column::from_name(&self.column)).like(lit(format!("%{}%", literal)))
118-
});
119-
120-
let mut filter_expr = patterns.next()?;
121-
for expr in patterns {
122-
filter_expr = or(filter_expr, expr)
123-
}
124-
125-
Some(filter_expr)
126-
}
127-
128-
fn contains_valid_tag_filter(&self, expr: &Expr) -> bool {
129-
match expr {
130-
Expr::Like(like) => {
131-
let matches_column = match &*like.expr {
132-
Expr::Column(column) => column.name == self.column,
133-
_ => return false,
134-
};
135-
136-
let matches_pattern = match &*like.pattern {
137-
Expr::Literal(ScalarValue::Utf8(Some(literal))) => {
138-
let literal = literal.trim_matches('%');
139-
self.literals.iter().any(|x| x == literal)
140-
}
141-
_ => false,
142-
};
143-
144-
matches_column && matches_pattern && !like.negated
145-
}
146-
_ => false,
147-
}
148-
}
149-
}
1+
// /*
2+
// * Parseable Server (C) 2022 - 2024 Parseable, Inc.
3+
// *
4+
// * This program is free software: you can redistribute it and/or modify
5+
// * it under the terms of the GNU Affero General Public License as
6+
// * published by the Free Software Foundation, either version 3 of the
7+
// * License, or (at your option) any later version.
8+
// *
9+
// * This program is distributed in the hope that it will be useful,
10+
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// * GNU Affero General Public License for more details.
13+
// *
14+
// * You should have received a copy of the GNU Affero General Public License
15+
// * along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
// *
17+
// */
18+
// use std::{collections::HashMap, sync::Arc};
19+
20+
// use arrow_schema::Field;
21+
// use datafusion::{
22+
// common::DFSchema,
23+
// logical_expr::{Filter, LogicalPlan, Projection},
24+
// optimizer::{optimize_children, OptimizerRule},
25+
// prelude::{lit, or, Column, Expr},
26+
// scalar::ScalarValue,
27+
// };
28+
29+
// /// Rewrites logical plan for source using projection and filter
30+
// pub struct FilterOptimizerRule {
31+
// pub column: String,
32+
// pub literals: Vec<String>,
33+
// }
34+
35+
// // Try to add filter node on table scan
36+
// // As every table supports projection push down
37+
// // we try to directly add projection for column directly to table
38+
// // To preserve the orignal projection we must add a projection node with orignal projection
39+
// impl OptimizerRule for FilterOptimizerRule {
40+
// fn try_optimize(
41+
// &self,
42+
// plan: &datafusion::logical_expr::LogicalPlan,
43+
// config: &dyn datafusion::optimizer::OptimizerConfig,
44+
// ) -> datafusion::error::Result<Option<datafusion::logical_expr::LogicalPlan>> {
45+
// // if there are no patterns then the rule cannot be performed
46+
// let Some(filter_expr) = self.expr() else {
47+
// return Ok(None);
48+
// };
49+
50+
// if let LogicalPlan::Filter(filter) = plan {
51+
// if filter.predicate == filter_expr {
52+
// return Ok(None);
53+
// }
54+
// }
55+
56+
// if let LogicalPlan::TableScan(table) = plan {
57+
// if table.projection.is_none()
58+
// || table
59+
// .filters
60+
// .iter()
61+
// .any(|expr| self.contains_valid_tag_filter(expr))
62+
// {
63+
// return Ok(None);
64+
// }
65+
66+
// let mut table = table.clone();
67+
// let schema = &table.source.schema();
68+
// let orignal_projection = table.projected_schema.clone();
69+
70+
// // add filtered column projection to table
71+
// if !table
72+
// .projected_schema
73+
// .has_column_with_unqualified_name(&self.column)
74+
// {
75+
// let tags_index = schema.index_of(&self.column)?;
76+
// let tags_field = schema.field(tags_index);
77+
// // modify source table projection to include tags
78+
// let df_schema = table.projected_schema.fields().clone();
79+
80+
// // from datafusion 37.1.0 -> 40.0.0
81+
// // `DFField` has been removed
82+
// // `DFSchema.new_with_metadata()` has changed
83+
// // it requires `qualified_fields`(`Vec<(Option<TableReference>, Arc<Field>)>`) instead of `fields`
84+
// // hence, use `DFSchema::from_unqualified_fields()` for relatively unchanged code
85+
86+
// df_schema.to_vec().push(Arc::new(Field::new(
87+
// tags_field.name(),
88+
// tags_field.data_type().clone(),
89+
// tags_field.is_nullable(),
90+
// )));
91+
92+
// table.projected_schema =
93+
// Arc::new(DFSchema::from_unqualified_fields(df_schema, HashMap::default())?);
94+
// if let Some(projection) = &mut table.projection {
95+
// projection.push(tags_index)
96+
// }
97+
// }
98+
99+
// let filter = LogicalPlan::Filter(Filter::try_new(
100+
// filter_expr,
101+
// Arc::new(LogicalPlan::TableScan(table)),
102+
// )?);
103+
// let plan = LogicalPlan::Projection(Projection::new_from_schema(
104+
// Arc::new(filter),
105+
// orignal_projection,
106+
// ));
107+
108+
// return Ok(Some(plan));
109+
// }
110+
111+
// // If we didn't find anything then recurse as normal and build the result.
112+
113+
// // TODO: replace `optimize_children()` since it will be removed
114+
// // But it is not being used anywhere, so might as well just let it be for now
115+
// optimize_children(self, plan, config)
116+
// }
117+
118+
// fn name(&self) -> &str {
119+
// "parseable_read_filter"
120+
// }
121+
// }
122+
123+
// impl FilterOptimizerRule {
124+
// fn expr(&self) -> Option<Expr> {
125+
// let mut patterns = self.literals.iter().map(|literal| {
126+
// Expr::Column(Column::from_name(&self.column)).like(lit(format!("%{}%", literal)))
127+
// });
128+
129+
// let mut filter_expr = patterns.next()?;
130+
// for expr in patterns {
131+
// filter_expr = or(filter_expr, expr)
132+
// }
133+
134+
// Some(filter_expr)
135+
// }
136+
137+
// fn contains_valid_tag_filter(&self, expr: &Expr) -> bool {
138+
// match expr {
139+
// Expr::Like(like) => {
140+
// let matches_column = match &*like.expr {
141+
// Expr::Column(column) => column.name == self.column,
142+
// _ => return false,
143+
// };
144+
145+
// let matches_pattern = match &*like.pattern {
146+
// Expr::Literal(ScalarValue::Utf8(Some(literal))) => {
147+
// let literal = literal.trim_matches('%');
148+
// self.literals.iter().any(|x| x == literal)
149+
// }
150+
// _ => false,
151+
// };
152+
153+
// matches_column && matches_pattern && !like.negated
154+
// }
155+
// _ => false,
156+
// }
157+
// }
158+
// }

0 commit comments

Comments
 (0)