mingmwang commented on issue #2175:
URL:
https://github.com/apache/arrow-datafusion/issues/2175#issuecomment-1262540503
@alamb @thinkharderdev @yahoNanJing
I'm afraid the 'PhysicalExpr' Trait need to be changed to Enum also.
A major problem is because it is trait, we do not have a way to compare or
check whether two 'PhysicalExpr'
equal or not.
In the physical plan phase, we need to check a plan's required children
distribution and the current children's output partition, if the distribution
is not satisfied, we should add the RepartitionExec, if it is satisfied,
RepartitionExec can be
skipped. Currently, because the PhysicalExpr is a Trait, it blocks some
important optimizations.
````
pub trait PhysicalExpr: Send + Sync + Display + Debug {
/// Returns the physical expression as [`Any`](std::any::Any) so that it
can be
/// downcast to a specific implementation.
fn as_any(&self) -> &dyn Any;
/// Get the data type of this expression, given the schema of the input
fn data_type(&self, input_schema: &Schema) -> Result<DataType>;
/// Determine whether this expression is nullable, given the schema of
the input
fn nullable(&self, input_schema: &Schema) -> Result<bool>;
/// Evaluate an expression against a RecordBatch
fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue>;
/// Evaluate an expression against a RecordBatch after first applying a
/// validity array
................
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]