Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions spark-extension-shims-spark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,27 @@
<artifactId>spark-core_${scalaVersion}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-catalyst_${scalaVersion}</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_${scalaVersion}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-api</artifactId>
<version>${hadoopVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scalaVersion}</artifactId>
Expand Down Expand Up @@ -103,15 +119,42 @@
<artifactId>spark-core_${scalaVersion}</artifactId>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-core</artifactId>
<version>${arrowVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-catalyst_${scalaVersion}</artifactId>
<type>test-jar</type>
<exclusions>
<exclusion>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
</exclusion>
</exclusions>

</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scalaVersion}</artifactId>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_${scalaVersion}</artifactId>
<type>test-jar</type>
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.hive.shims</groupId>-->
<!-- <artifactId>hive-shims-common</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.hive.shims</groupId>-->
<!-- <artifactId>hive-shims-0.23</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# 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.
#

org.apache.spark.sql.hive.execution.auron.plan.HiveConvertProvider
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* 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.hive.execution.auron.plan

import org.apache.spark.internal.Logging
import org.apache.spark.sql.auron.{AuronConverters, AuronConvertProvider}
import org.apache.spark.sql.auron.AuronConverters.getBooleanConf
import org.apache.spark.sql.execution.SparkPlan
import org.apache.spark.sql.hive.client.HiveClientImpl
import org.apache.spark.sql.hive.execution.HiveTableScanExec

class HiveConvertProvider extends AuronConvertProvider with Logging {
override def isEnabled: Boolean =
getBooleanConf("spark.auron.enable.hiveTable", defaultValue = true)

private def enableHiveTableScanExec: Boolean =
getBooleanConf("spark.auron.enable.parquetHiveTableScanExec", defaultValue = false)

override def isSupported(exec: SparkPlan): Boolean =
exec match {
case e: HiveTableScanExec
if enableHiveTableScanExec &&
e.relation.tableMeta.provider.isDefined &&
e.relation.tableMeta.provider.get.equals("hive") =>
true
case _ => false
}

override def convert(exec: SparkPlan): SparkPlan = {
exec match {
case hiveExec: HiveTableScanExec
if enableHiveTableScanExec
&& HiveTableUtil.isParquetTable(hiveExec) =>
convertParquetHiveTableScanExec(hiveExec)
case _ => exec
}
}

private def convertParquetHiveTableScanExec(hiveExec: HiveTableScanExec): SparkPlan = {
AuronConverters.addRenameColumnsExec(NativeParquetHiveTableScanExec(hiveExec))
}
}

object HiveTableUtil {
private val parquetFormat = "MapredParquetInputFormat"

def isParquetTable(basedHiveScan: HiveTableScanExec): Boolean = {
if (HiveClientImpl
.toHiveTable(basedHiveScan.relation.tableMeta)
.getInputFormatClass
.getSimpleName
.equalsIgnoreCase(parquetFormat)) {
true
} else {
false
}
}

}
Loading
Loading