comphead commented on code in PR #3989:
URL: https://github.com/apache/datafusion-comet/pull/3989#discussion_r3111992502
##########
spark/src/main/scala/org/apache/spark/sql/comet/execution/shuffle/CometShuffleExchangeExec.scala:
##########
@@ -223,39 +222,90 @@ object CometShuffleExchangeExec
with SQLConfHelper {
override def getSupportLevel(op: ShuffleExchangeExec): SupportLevel = {
- if (nativeShuffleSupported(op) || columnarShuffleSupported(op)) {
- Compatible()
- } else {
- Unsupported()
- }
+ if (shuffleSupported(op).isDefined) Compatible() else Unsupported()
}
override def createExec(
nativeOp: OperatorOuterClass.Operator,
op: ShuffleExchangeExec): CometNativeExec = {
- if (nativeShuffleSupported(op) &&
op.children.forall(_.isInstanceOf[CometNativeExec])) {
- // Switch to use Decimal128 regardless of precision, since Arrow native
execution
- // doesn't support Decimal32 and Decimal64 yet.
- conf.setConfString(CometConf.COMET_USE_DECIMAL_128.key, "true")
- CometSinkPlaceHolder(
- nativeOp,
- op,
- CometShuffleExchangeExec(op, shuffleType = CometNativeShuffle))
-
- } else if (columnarShuffleSupported(op)) {
- CometSinkPlaceHolder(
- nativeOp,
- op,
- CometShuffleExchangeExec(op, shuffleType = CometColumnarShuffle))
- } else {
- throw new IllegalStateException()
+ shuffleSupported(op) match {
+ case Some(CometNativeShuffle) if
op.children.forall(_.isInstanceOf[CometNativeExec]) =>
+ // Switch to use Decimal128 regardless of precision, since Arrow
native execution
+ // doesn't support Decimal32 and Decimal64 yet.
+ conf.setConfString(CometConf.COMET_USE_DECIMAL_128.key, "true")
+ CometSinkPlaceHolder(
+ nativeOp,
+ op,
+ CometShuffleExchangeExec(op, shuffleType = CometNativeShuffle))
+ case Some(CometColumnarShuffle) =>
+ CometSinkPlaceHolder(
+ nativeOp,
+ op,
+ CometShuffleExchangeExec(op, shuffleType = CometColumnarShuffle))
+ case Some(CometNativeShuffle) =>
+ // Native was chosen but children are not native - fall through to
columnar if possible.
+ // This can happen when getSupportLevel selected native but a later
pass changed the plan.
+ throw new IllegalStateException(
+ "shuffleSupported chose native shuffle but children are not all
CometNativeExec")
+ case None =>
+ throw new IllegalStateException()
Review Comment:
perhaps it is time to add some meaningful message 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]