huaxingao commented on code in PR #37886: URL: https://github.com/apache/spark/pull/37886#discussion_r971441803
########## sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanPartitioningAndOrdering.scala: ########## @@ -41,8 +41,19 @@ object V2ScanPartitioningAndOrdering extends Rule[LogicalPlan] with SQLConfHelpe private def partitioning(plan: LogicalPlan) = plan.transformDown { case d @ DataSourceV2ScanRelation(relation, scan: SupportsReportPartitioning, _, None, _) => val catalystPartitioning = scan.outputPartitioning() match { - case kgp: KeyGroupedPartitioning => sequenceToOption(kgp.keys().map( - V2ExpressionUtils.toCatalystOpt(_, relation, relation.funCatalog))) + case kgp: KeyGroupedPartitioning => + val partitioning = sequenceToOption( + kgp.keys().map(V2ExpressionUtils.toCatalystOpt(_, relation, relation.funCatalog))) + if (partitioning.isEmpty) { + None + } else { + val ref = AttributeSet.fromAttributeSets(partitioning.get.map(_.references)) Review Comment: Sounds good! 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org