-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HUDI-3896] Porting Nested Schema Pruning optimization for Hudi's cus…
…tom Relations (#5428) Currently, all Hudi Relations bear performance gap relative to Spark's HadoopFsRelation and the reason to that is SchemaPruning optimization rule (pruning nested schemas) that is unfortunately predicated on usage of HadoopFsRelation, meaning that it's not applied in cases when any other relation is used. This change is porting this rule to Hudi relations (MOR, Incremental, etc) by the virtue of leveraging HoodieSparkSessionExtensions mechanism injecting modified version of the original SchemaPruning rule that is adopted to work w/ Hudi's custom relations. - Added customOptimizerRules to HoodieAnalysis - Added NestedSchemaPrunning Spark's Optimizer rule - Handle Spark's Optimizer pruned data schema (to effectively prune nested schemas) - Enable HoodieClientTestHarness to inject HoodieSparkSessionExtensions - Injecting Spark Session extensions for TestMORDataSource, TestCOWDataSource - Disabled fallback to HadoopFsRelation
- Loading branch information
Alexey Kudinkin
authored
Jul 21, 2022
1 parent
2394c62
commit de37774
Showing
42 changed files
with
1,221 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...ient/hudi-spark-client/src/main/scala/org/apache/spark/sql/HoodieCatalystPlansUtils.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.sql | ||
|
||
import org.apache.spark.sql.catalyst.{AliasIdentifier, TableIdentifier} | ||
import org.apache.spark.sql.catalyst.analysis.UnresolvedRelation | ||
import org.apache.spark.sql.catalyst.expressions.Expression | ||
import org.apache.spark.sql.catalyst.plans.JoinType | ||
import org.apache.spark.sql.catalyst.plans.logical.{Join, LogicalPlan} | ||
|
||
trait HoodieCatalystPlansUtils { | ||
|
||
def createExplainCommand(plan: LogicalPlan, extended: Boolean): LogicalPlan | ||
|
||
/** | ||
* Convert a AliasIdentifier to TableIdentifier. | ||
*/ | ||
def toTableIdentifier(aliasId: AliasIdentifier): TableIdentifier | ||
|
||
/** | ||
* Convert a UnresolvedRelation to TableIdentifier. | ||
*/ | ||
def toTableIdentifier(relation: UnresolvedRelation): TableIdentifier | ||
|
||
/** | ||
* Create Join logical plan. | ||
*/ | ||
def createJoin(left: LogicalPlan, right: LogicalPlan, joinType: JoinType): Join | ||
|
||
/** | ||
* Test if the logical plan is a Insert Into LogicalPlan. | ||
*/ | ||
def isInsertInto(plan: LogicalPlan): Boolean | ||
|
||
/** | ||
* Get the member of the Insert Into LogicalPlan. | ||
*/ | ||
def getInsertIntoChildren(plan: LogicalPlan): | ||
Option[(LogicalPlan, Map[String, Option[String]], LogicalPlan, Boolean, Boolean)] | ||
|
||
/** | ||
* if the logical plan is a TimeTravelRelation LogicalPlan. | ||
*/ | ||
def isRelationTimeTravel(plan: LogicalPlan): Boolean | ||
|
||
/** | ||
* Get the member of the TimeTravelRelation LogicalPlan. | ||
*/ | ||
def getRelationTimeTravel(plan: LogicalPlan): Option[(LogicalPlan, Option[Expression], Option[String])] | ||
|
||
/** | ||
* Create a Insert Into LogicalPlan. | ||
*/ | ||
def createInsertInto(table: LogicalPlan, partition: Map[String, Option[String]], | ||
query: LogicalPlan, overwrite: Boolean, ifPartitionNotExists: Boolean): LogicalPlan | ||
|
||
/** | ||
* Create Like expression. | ||
*/ | ||
def createLike(left: Expression, right: Expression): Expression | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.