You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gluten.apache.org by "M1zukiqwq (via GitHub)" <gi...@apache.org> on 2025/10/28 03:04:59 UTC

[D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

GitHub user M1zukiqwq created a discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

I'm currently exploring the possibility of dynamically selecting the execution engine (either the native Spark engine or one of Gluten's backends) based on the characteristics of the query's execution plan.
Could anyone point me to the relevant sections of the Gluten codebase that I would need to modify to implement this kind of dynamic, plan-based engine selection logic? I would appreciate any guidance or suggestions on where to start looking.

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "zhztheplayer (via GitHub)" <gi...@apache.org>.
GitHub user zhztheplayer added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

> It means if the execution plan meets certain conditions.

Do you have the concrete conditions, or a rough strategy in mind already?

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14805918

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "zjuwangg (via GitHub)" <gi...@apache.org>.
GitHub user zjuwangg added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

> > #7143 #5177 RAS may be a good choice to begin. cc @zhztheplayer
> 
> I want implement whole stage fallback, not single stagefallback.

What's the meaning of whole stage fallback, you mean all plan ?

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14801144

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "PHILO-HE (via GitHub)" <gi...@apache.org>.
GitHub user PHILO-HE deleted a comment on the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

@M1zukiqwq, could you share more details about your decider? I'm curious whether it's tailored to your specific workload or designed to be generalizable for common use cases .If it's workload-specific, we might consider exposing APIs that allow users to inject their own custom deciders into Gluten.  Otherwise, it may be better to contribute it directly to the Gluten project. 

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14823275

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "PHILO-HE (via GitHub)" <gi...@apache.org>.
GitHub user PHILO-HE added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

@M1zukiqwq, could you share more details about your decider? I'm curious whether it's tailored to your specific workload or designed to be generalizable for common use cases .If it's workload-specific, we might consider exposing APIs that allow users to inject their own custom deciders into Gluten. Otherwise, it may be better to contribute it directly to the Gluten project.

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14823280

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "M1zukiqwq (via GitHub)" <gi...@apache.org>.
GitHub user M1zukiqwq added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

> > It means if the execution plan meets certain conditions.
> 
> Do you have the concrete conditions, or a rough strategy in mind already?

I use a decider to decide use gluten or not, and I integrate this decider by use Catalyst Extension.Therefore, I want to use this decorator's judgment to decide whether to use gluten to execute the query.

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14811745

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "FelixYBW (via GitHub)" <gi...@apache.org>.
GitHub user FelixYBW added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

Do you mean fallback whole queries or stages? to queries, you can set `spark.gluten.enabled=false` for the query. To stages we currently can support whole stage fallback once there is one operator in the stage needs fallback by setting `spark.gluten.sql.columnar.wholeStage.fallback.threshold=1`.

If you need to fallback any whole stage you want, how do you define the stage? you can easily add some config like `spark.gluten.fallbackstage=5`. But you would like to fallback based on some rules, RAS is a good choice.

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14883284

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "zjuwangg (via GitHub)" <gi...@apache.org>.
GitHub user zjuwangg added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

https://github.com/apache/incubator-gluten/issues/7143 https://github.com/apache/incubator-gluten/issues/5177
RAS may be a good choice to begin.
cc @zhztheplayer  Please correct me if I misunderstand the purpose of RAS.

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14799812

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "zjuwangg (via GitHub)" <gi...@apache.org>.
GitHub user zjuwangg edited a comment on the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

https://github.com/apache/incubator-gluten/issues/7143 https://github.com/apache/incubator-gluten/issues/5177
RAS may be a good choice to begin.
cc @zhztheplayer  

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14799812

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "M1zukiqwq (via GitHub)" <gi...@apache.org>.
GitHub user M1zukiqwq added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

> #7143 #5177 RAS may be a good choice to begin. cc @zhztheplayer

I want implement whole stage fallback, not single stagefallback.

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14799843

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "zjuwangg (via GitHub)" <gi...@apache.org>.
GitHub user zjuwangg edited a comment on the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

https://github.com/apache/incubator-gluten/issues/7143 https://github.com/apache/incubator-gluten/issues/5177
RAS may be a good choice to begin.
cc @zhztheplayer  Correct me if I misunderstand the purpose of RAS.

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14799812

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "PHILO-HE (via GitHub)" <gi...@apache.org>.
GitHub user PHILO-HE added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

@M1zukiqwq, "based on the characteristics of the query's execution plan", does these characteristics include whether an operator is supported by Gluten?

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14823291

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "M1zukiqwq (via GitHub)" <gi...@apache.org>.
GitHub user M1zukiqwq added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

> > > #7143 #5177 RAS may be a good choice to begin. cc @zhztheplayer
> > 
> > 
> > I want implement whole stage fallback, not single stagefallback.
> 
> What's the meaning of whole stage fallback, you mean all plan ?

It means if the execution plan meets certain conditions, the entire task will still be executed in the native Spark engine even if the gluten JAR package is loaded.

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14801173

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org


Re: [D] How to dynamically switch between native Spark and Gluten backend based on the execution plan? [incubator-gluten]

Posted by "PHILO-HE (via GitHub)" <gi...@apache.org>.
GitHub user PHILO-HE added a comment to the discussion: How to dynamically switch between native Spark and Gluten backend based on the execution plan?

@M1zukiqwq, could you share more details about your decider? I'm curious whether it's tailored to your specific workload or designed to be generalizable for common use cases .If it's workload-specific, we might consider exposing APIs that allow users to inject their own custom deciders into Gluten.  Otherwise, it may be better to contribute it directly to the Gluten project. 

GitHub link: https://github.com/apache/incubator-gluten/discussions/10954#discussioncomment-14823275

----
This is an automatically sent email for dev@gluten.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gluten.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@gluten.apache.org
For additional commands, e-mail: dev-help@gluten.apache.org