@@ -384,13 +384,13 @@ class CometSparkSessionExtensions
384
384
385
385
// Comet JVM + native scan for V1 and V2
386
386
case op if isCometScan(op) =>
387
- val nativeOp = QueryPlanSerde .operator2Proto(op).get
388
- CometScanWrapper (nativeOp, op)
387
+ val nativeOp = QueryPlanSerde .operator2Proto(op)
388
+ CometScanWrapper (nativeOp.get , op)
389
389
390
390
case op if shouldApplySparkToColumnar(conf, op) =>
391
391
val cometOp = CometSparkToColumnarExec (op)
392
- val nativeOp = QueryPlanSerde .operator2Proto(cometOp).get
393
- CometScanWrapper (nativeOp, cometOp)
392
+ val nativeOp = QueryPlanSerde .operator2Proto(cometOp)
393
+ CometScanWrapper (nativeOp.get , cometOp)
394
394
395
395
case op : ProjectExec =>
396
396
val newOp = transform1(op)
@@ -498,15 +498,15 @@ class CometSparkSessionExtensions
498
498
val child = op.child
499
499
val modes = aggExprs.map(_.mode).distinct
500
500
501
- if (! modes.isEmpty && modes.size != 1 ) {
501
+ if (modes.nonEmpty && modes.size != 1 ) {
502
502
// This shouldn't happen as all aggregation expressions should share the same mode.
503
503
// Fallback to Spark nevertheless here.
504
504
op
505
505
} else {
506
506
// For a final mode HashAggregate, we only need to transform the HashAggregate
507
507
// if there is Comet partial aggregation.
508
508
val sparkFinalMode = {
509
- ! modes.isEmpty && modes.head == Final && findCometPartialAgg(child).isEmpty
509
+ modes.nonEmpty && modes.head == Final && findCometPartialAgg(child).isEmpty
510
510
}
511
511
512
512
if (sparkFinalMode) {
@@ -520,7 +520,7 @@ class CometSparkSessionExtensions
520
520
// distinct aggregate functions or only have group by, the aggExprs is empty and
521
521
// modes is empty too. If aggExprs is not empty, we need to verify all the
522
522
// aggregates have the same mode.
523
- assert(modes.length == 1 || modes.length == 0 )
523
+ assert(modes.length == 1 || modes.isEmpty )
524
524
CometHashAggregateExec (
525
525
nativeOp,
526
526
op,
@@ -529,7 +529,7 @@ class CometSparkSessionExtensions
529
529
aggExprs,
530
530
resultExpressions,
531
531
child.output,
532
- if ( modes.nonEmpty) Some (modes.head) else None ,
532
+ modes.headOption ,
533
533
child,
534
534
SerializedPlan (None ))
535
535
case None =>
@@ -540,7 +540,7 @@ class CometSparkSessionExtensions
540
540
541
541
case op : ShuffledHashJoinExec
542
542
if CometConf .COMET_EXEC_HASH_JOIN_ENABLED .get(conf) &&
543
- op.children.forall(isCometNative(_) ) =>
543
+ op.children.forall(isCometNative) =>
544
544
val newOp = transform1(op)
545
545
newOp match {
546
546
case Some (nativeOp) =>
@@ -574,7 +574,7 @@ class CometSparkSessionExtensions
574
574
575
575
case op : BroadcastHashJoinExec
576
576
if CometConf .COMET_EXEC_BROADCAST_HASH_JOIN_ENABLED .get(conf) &&
577
- op.children.forall(isCometNative(_) ) =>
577
+ op.children.forall(isCometNative) =>
578
578
val newOp = transform1(op)
579
579
newOp match {
580
580
case Some (nativeOp) =>
@@ -1288,7 +1288,7 @@ object CometSparkSessionExtensions extends Logging {
1288
1288
op.isInstanceOf [CometBatchScanExec ] || op.isInstanceOf [CometScanExec ]
1289
1289
}
1290
1290
1291
- private def shouldApplySparkToColumnar (conf : SQLConf , op : SparkPlan ): Boolean = {
1291
+ def shouldApplySparkToColumnar (conf : SQLConf , op : SparkPlan ): Boolean = {
1292
1292
// Only consider converting leaf nodes to columnar currently, so that all the following
1293
1293
// operators can have a chance to be converted to columnar. Leaf operators that output
1294
1294
// columnar batches, such as Spark's vectorized readers, will also be converted to native
0 commit comments