Skip to content

Commit 8d0c0d5

Browse files
committed
Add deprecation notice
Signed-off-by: Adam Gutglick <adamgsal@gmail.com>
1 parent 17c3ed8 commit 8d0c0d5

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

datafusion-examples/examples/query_planning/expr_api.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ fn simplify_demo() -> Result<()> {
175175
// the ExecutionProps carries information needed to simplify
176176
// expressions, such as the current time (to evaluate `now()`
177177
// correctly)
178-
let context = SimplifyContext::default()
178+
let context = SimplifyContext::builder()
179179
.with_schema(schema)
180-
.with_current_time();
180+
.with_current_time()
181+
.build();
181182
let simplifier = ExprSimplifier::new(context);
182183

183184
// And then call the simplify_expr function:
@@ -192,9 +193,10 @@ fn simplify_demo() -> Result<()> {
192193

193194
// here are some other examples of what DataFusion is capable of
194195
let schema = Schema::new(vec![make_field("i", DataType::Int64)]).to_dfschema_ref()?;
195-
let context = SimplifyContext::default()
196+
let context = SimplifyContext::builder()
196197
.with_schema(Arc::clone(&schema))
197-
.with_current_time();
198+
.with_current_time()
199+
.build();
198200
let simplifier = ExprSimplifier::new(context);
199201

200202
// basic arithmetic simplification
@@ -554,9 +556,10 @@ fn type_coercion_demo() -> Result<()> {
554556
assert!(physical_expr.evaluate(&batch).is_ok());
555557

556558
// 2. Type coercion with `ExprSimplifier::coerce`.
557-
let context = SimplifyContext::default()
559+
let context = SimplifyContext::builder()
558560
.with_schema(Arc::new(df_schema.clone()))
559-
.with_current_time();
561+
.with_current_time()
562+
.build();
560563
let simplifier = ExprSimplifier::new(context);
561564
let coerced_expr = simplifier.coerce(expr.clone(), &df_schema)?;
562565
let physical_expr = datafusion::physical_expr::create_physical_expr(

datafusion/expr/src/simplify.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,30 @@ impl SimplifyContext {
6464
SimplifyContextBuilder::default()
6565
}
6666

67+
#[deprecated(
68+
since = "53.1.0",
69+
note = "Use SimplifyContextBuilder if you intend to use non-default values."
70+
)]
6771
/// Set the [`ConfigOptions`] for this context
6872
pub fn with_config_options(mut self, config_options: Arc<ConfigOptions>) -> Self {
6973
self.config_options = config_options;
7074
self
7175
}
7276

77+
#[deprecated(
78+
since = "53.1.0",
79+
note = "Use SimplifyContextBuilder if you intend to use non-default values."
80+
)]
7381
/// Set the schema for this context
7482
pub fn with_schema(mut self, schema: DFSchemaRef) -> Self {
7583
self.schema = schema;
7684
self
7785
}
7886

87+
#[deprecated(
88+
since = "53.1.0",
89+
note = "Use SimplifyContextBuilder if you intend to use non-default values."
90+
)]
7991
/// Set the query execution start time
8092
pub fn with_query_execution_start_time(
8193
mut self,
@@ -85,6 +97,10 @@ impl SimplifyContext {
8597
self
8698
}
8799

100+
#[deprecated(
101+
since = "53.1.0",
102+
note = "Use SimplifyContextBuilder if you intend to use non-default values."
103+
)]
88104
/// Set the query execution start to the current time
89105
pub fn with_current_time(mut self) -> Self {
90106
self.query_execution_start_time = Some(Utc::now());

0 commit comments

Comments
 (0)