You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/25 09:25:20 UTC

[GitHub] [arrow-datafusion] mingmwang opened a new pull request #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

mingmwang opened a new pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091


   # 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 #1862.
   
    # 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.  
   -->
   
   # 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.
   -->
   This is the part3 of the PR. It covers the below parts:
   1.  Avoid using ``` &mut` self ``` in SessionContext methods,  trivial UT fixes
   2. Remove the global SessionContext from Ballista SchedulerServer, add SessionContextRegistry to Scheduler to manage multiple running sessions.
   3. Remove the global SessionContext from Ballista Executor, implement FunctionRegistry for TaskContext.
   4. Ballista proto grpc API changes, add ```optional_session_id``` to ```ExecuteQueryParams```, add session_id and props to ```TaskDefinition```. Create new SessionContext for the first time of the query and reuse the existing SessionContext for ongoing queries for a users.
   5. Propagate the session configurations from Ballista Client to Ballista Scheduler and to Executors.
   
   
   
   # Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   


-- 
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] yahoNanJing commented on pull request #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

Posted by GitBox <gi...@apache.org>.
yahoNanJing commented on pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091#issuecomment-1079592759


   Thanks @mingmwang. I do agree to remove the SessionContext from the Ballista executor and to serialize session related things in the task definition.😄🐂


-- 
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 pull request #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091#issuecomment-1080599700


   Thanks again @mingmwang and everyone else who helped review this PR!


-- 
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 pull request #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091#issuecomment-1079902677


   I'll plan to merge this PR on Monday unless we hear anything else -- this PR is likely to accumulate conflicts quickly. 
   
   In fact it looks like it has accumulated a few conflicts already which need to be resolved


-- 
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] mingmwang commented on pull request #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

Posted by GitBox <gi...@apache.org>.
mingmwang commented on pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091#issuecomment-1080116930


   > 
   
   
   
   > I'll plan to merge this PR on Monday unless we hear anything else -- this PR is likely to accumulate conflicts quickly.
   > 
   > In fact it looks like it has accumulated a few conflicts already which need to be resolved
   
   I will resolve the conflicts today.


-- 
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 #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

Posted by GitBox <gi...@apache.org>.
alamb merged pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091


   


-- 
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] mingmwang commented on pull request #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

Posted by GitBox <gi...@apache.org>.
mingmwang commented on pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091#issuecomment-1080306850


   Rebased to master to resolve conflicts.


-- 
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] mingmwang commented on a change in pull request #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

Posted by GitBox <gi...@apache.org>.
mingmwang commented on a change in pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091#discussion_r836090742



##########
File path: datafusion/src/execution/context.rs
##########
@@ -982,6 +1008,14 @@ pub struct SessionState {
     pub runtime_env: Arc<RuntimeEnv>,
 }
 
+/// Default session builder using the provided configuration
+pub fn default_session_builder(config: SessionConfig) -> SessionState {

Review comment:
       Done




-- 
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 change in pull request #2091: Refactor SessionContext, BallistaContext to support multi-tenancy configurations - Part 3

Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #2091:
URL: https://github.com/apache/arrow-datafusion/pull/2091#discussion_r835478120



##########
File path: datafusion/src/execution/context.rs
##########
@@ -982,6 +1008,14 @@ pub struct SessionState {
     pub runtime_env: Arc<RuntimeEnv>,
 }
 
+/// Default session builder using the provided configuration
+pub fn default_session_builder(config: SessionConfig) -> SessionState {

Review comment:
       Since there is already a `SessionContext::with_config_rt` maybe we could name this function `SessionState::with_config` and the existing `SessionState::with_config` to `SessionState::with_config_rt` for consistency

##########
File path: datafusion/src/execution/context.rs
##########
@@ -1331,16 +1382,48 @@ impl From<&SessionState> for TaskContext {
     fn from(state: &SessionState) -> Self {
         let session_id = state.session_id.clone();
         let config = state.config.clone();
+        let scalar_functions = state.scalar_functions.clone();
+        let aggregate_functions = state.aggregate_functions.clone();
         let runtime = state.runtime_env.clone();
         Self {
             task_id: None,
             session_id,
             properties: TaskProperties::SessionConfig(config),
+            scalar_functions,
+            aggregate_functions,
             runtime,
         }
     }
 }
 
+impl FunctionRegistry for TaskContext {

Review comment:
       👍 

##########
File path: benchmarks/src/bin/tpch.rs
##########
@@ -83,9 +85,10 @@ struct BallistaBenchmarkOpt {
     #[structopt(short = "i", long = "iterations", default_value = "3")]
     iterations: usize,
 
-    // /// Batch size when reading CSV or Parquet files
-    // #[structopt(short = "s", long = "batch-size", default_value = "8192")]
-    // batch_size: usize,
+    /// Batch size when reading CSV or Parquet files

Review comment:
       👍 

##########
File path: datafusion-proto/src/from_proto.rs
##########
@@ -836,7 +836,7 @@ impl TryFrom<&protobuf::ScalarValue> for ScalarValue {
 
 pub fn parse_expr(
     proto: &protobuf::LogicalExprNode,
-    ctx: &SessionContext,
+    registry: &dyn FunctionRegistry,

Review comment:
       👍 




-- 
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