You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "waynexia (via GitHub)" <gi...@apache.org> on 2023/03/02 08:35:07 UTC

[GitHub] [arrow-datafusion] waynexia opened a new pull request, #5450: feat: add name() method to UserDefinedLogicalNode

waynexia opened a new pull request, #5450:
URL: https://github.com/apache/arrow-datafusion/pull/5450

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #5449.
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   Add `name()` method so that there is no need to test a `UserDefinedLogicalNode` using `downcast_ref()`.
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   
   The public interface `UserDefinedLogicalNode` is changed


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb merged pull request #5450: feat: add name() method to UserDefinedLogicalNode

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #5450:
URL: https://github.com/apache/arrow-datafusion/pull/5450


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ursabot commented on pull request #5450: feat: add name() method to UserDefinedLogicalNode

Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #5450:
URL: https://github.com/apache/arrow-datafusion/pull/5450#issuecomment-1455952286

   Benchmark runs are scheduled for baseline = eb9541380964a5fd5aa92302a82ec189c3be792e and contender = c56b947651d923d99f9756f09af9c013430fc9c0. c56b947651d923d99f9756f09af9c013430fc9c0 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/f02295bbfdbc45d7a14120f64ca91637...e743e0a5d15e4e6891c1e1246c155e8a/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/bfbbedc64ce54391ba3474b46b7859a2...ed301b0b66bd433c905f31157e5e4b2e/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/1053bd33fbe74e9690e93ced75459039...80f96e23ad9d4ae9a0d6386602a22fee/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/021f58a1fbc744439e9275d3f54cda79...a3e9a8cfaf654f51807f496e76c65af1/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5450: feat: add name() method to UserDefinedLogicalNode

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #5450:
URL: https://github.com/apache/arrow-datafusion/pull/5450#discussion_r1126264212


##########
datafusion/expr/src/logical_plan/extension.rs:
##########
@@ -30,6 +30,9 @@ pub trait UserDefinedLogicalNode: fmt::Debug + Send + Sync {
     /// Return a reference to self as Any, to support dynamic downcasting
     fn as_any(&self) -> &dyn Any;
 
+    /// Return the plan's name

Review Comment:
   > What do you think about separate name and parameters? E.g.:
   
   I think it would make sense, but could also be done as a follow on PR. I think this PR is good enough for now.
   
   Thanks @waynexia 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] comphead commented on pull request #5450: feat: add name() method to UserDefinedLogicalNode

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #5450:
URL: https://github.com/apache/arrow-datafusion/pull/5450#issuecomment-1452128792

   @waynexia wouldn't this better to use enum for user node names? 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] waynexia commented on a diff in pull request #5450: feat: add name() method to UserDefinedLogicalNode

Posted by "waynexia (via GitHub)" <gi...@apache.org>.
waynexia commented on code in PR #5450:
URL: https://github.com/apache/arrow-datafusion/pull/5450#discussion_r1125858250


##########
datafusion/expr/src/logical_plan/extension.rs:
##########
@@ -30,6 +30,9 @@ pub trait UserDefinedLogicalNode: fmt::Debug + Send + Sync {
     /// Return a reference to self as Any, to support dynamic downcasting
     fn as_any(&self) -> &dyn Any;
 
+    /// Return the plan's name

Review Comment:
   I ignored the `fmt_for_explain` method... You are right, they are redundant information.
   
   >What would you think about making a function like the following that returned the result of format_for_explain
   
   The returned string (like "TopK: k=1") is also not easy to use for the dispatching purpose, like we need to `.contains()` or `.start_with()` those strings. What do you think about separate name and parameters? E.g.:
   ```rust
   fn name(&self) -> &'str {
     "TopK"
   }
   
   fn fmt_for_params(&self, f: &mut fmt::Formatter) -> fmt::Result { 
      write!(f, "k={}", self.k) 
   }
   
   // this can be provided as default implementation
   fn fmt_for_explain(&self, f: &mut fmt::Formatter) -> fmt::Result { 
      write!(f, "{}: {}", self.name(), self.fmt_for_params()) 
   }
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] waynexia commented on pull request #5450: feat: add name() method to UserDefinedLogicalNode

Posted by "waynexia (via GitHub)" <gi...@apache.org>.
waynexia commented on PR #5450:
URL: https://github.com/apache/arrow-datafusion/pull/5450#issuecomment-1452209484

   > @waynexia wouldn't this better to use enum for user node names? 
   
   I'm afraid it's hard to define this enum because we can't enumerate all the possible node in advance 🧐


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5450: feat: add name() method to UserDefinedLogicalNode

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #5450:
URL: https://github.com/apache/arrow-datafusion/pull/5450#discussion_r1123634700


##########
datafusion/expr/src/logical_plan/extension.rs:
##########
@@ -30,6 +30,9 @@ pub trait UserDefinedLogicalNode: fmt::Debug + Send + Sync {
     /// Return a reference to self as Any, to support dynamic downcasting
     fn as_any(&self) -> &dyn Any;
 
+    /// Return the plan's name

Review Comment:
   I think similar information is present via
   
   ```
       fn fmt_for_explain(&self, f: &mut fmt::Formatter) -> fmt::Result;
   ```
   
   For example: https://github.com/apache/arrow-datafusion/blob/a95e0ec2fd929aae1c2f67148243eb4825d81a3b/datafusion/proto/src/logical_plan/mod.rs#L1681-L1683
   
   However, it is not easy to use (as you need a formatter, etc)
   
   What would you think about making a function like the following that returned the result of format_for_explain
   
   ```rust
       fn to_string(&self) -> String {
          // figure out how to call format_for_explain here
        }
   ```
   
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org