You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by dh...@apache.org on 2021/05/29 17:33:22 UTC
[arrow-datafusion] branch tokomak_optimizer updated: docs
This is an automated email from the ASF dual-hosted git repository.
dheres pushed a commit to branch tokomak_optimizer
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/tokomak_optimizer by this push:
new 23736d9 docs
23736d9 is described below
commit 23736d95c96655ff756e263cac88aa08b091048a
Author: Daniel Heres <da...@gmail.com>
AuthorDate: Sat May 29 19:33:10 2021 +0200
docs
---
datafusion/src/optimizer/simplification.rs | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/datafusion/src/optimizer/simplification.rs b/datafusion/src/optimizer/simplification.rs
index 778c6c3..569784f 100644
--- a/datafusion/src/optimizer/simplification.rs
+++ b/datafusion/src/optimizer/simplification.rs
@@ -16,6 +16,7 @@
// under the License.
//! Expression simplification optimizer.
+//! Rewrites expressions using equivalence rules and the egg optimization library
use std::vec;
use crate::{
@@ -28,17 +29,17 @@ use crate::logical_plan::Expr;
use crate::execution::context::ExecutionProps;
use egg::{rewrite as rw, *};
-pub struct Tokomak {}
+pub struct ExprSimplifier {}
-impl Tokomak {
+impl ExprSimplifier {
#[allow(missing_docs)]
pub fn new() -> Self {
Self {}
}
}
-pub type EGraph = egg::EGraph<Tokomak, ()>;
+pub type EGraph = egg::EGraph<ExprSimplifier, ()>;
-pub fn rules() -> Vec<Rewrite<TokomakExpr, ()>> {
+pub fn rules() -> Vec<Rewrite<ExprSimplifierExpr, ()>> {
return vec![
rw!("commute-add"; "(+ ?x ?y)" => "(+ ?y ?x)"),
rw!("commute-mul"; "(* ?x ?y)" => "(* ?y ?x)"),
@@ -71,8 +72,8 @@ pub fn rules() -> Vec<Rewrite<TokomakExpr, ()>> {
}
define_language! {
- /// Supported expressions in Tokomak
- pub enum TokomakExpr {
+ /// Supported expressions in ExprSimplifier
+ pub enum ExprSimplifierExpr {
"+" = Plus([Id; 2]),
"-" = Minus([Id; 2]),
"*" = Multiply([Id; 2]),
@@ -103,7 +104,7 @@ define_language! {
}
}
-pub fn to_tokomak_expr(rec_expr: &mut RecExpr<TokomakExpr>, expr: Expr) -> Option<Id> {
+pub fn to_tokomak_expr(rec_expr: &mut RecExpr<ExprSimplifierExp>, expr: Expr) -> Option<Id> {
match expr {
Expr::BinaryExpr { left, op, right } => {
let left = to_tokomak_expr(rec_expr, *left)?;