-
Notifications
You must be signed in to change notification settings - Fork 228
[AURON #2080] Support Hive Parquet table to NativeParquetHiveTableScanExec #2081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
override def isEnabled(exec: SparkPlan): Boolean =
getBooleanConf("spark.auron.enable.hiveTable", defaultValue = true) |
||
| getBooleanConf("spark.auron.enable.hiveTable", defaultValue = true) | ||
|
|
||
| private def enableHiveTableScanExec: Boolean = | ||
| getBooleanConf("spark.auron.enable.parquetHiveTableScanExec", defaultValue = false) | ||
|
|
||
| override def isSupported(exec: SparkPlan): Boolean = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 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 | ||
| } | ||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
io.nettyrelocation was added in #1597 to fixNoClassDefFoundError: io/netty/buffer/Unpooledunder shaded-spark — that change bundlednetty-buffer/netty-commoninto the assembly and relocated them so they wouldn't clash. This PR removes the relocation but keeps those bundled deps (pom.xml:48-55), so netty ships at its originalio.netty.*coordinates again, which is the state #1597 fixed away. Does dropping it reopen that shaded-spark conflict? Since the relocation only affects the shaded assembly — not the unit tests or the Hive Parquet path here — it'd help to know what in this PR needs it gone, along with thearrow-memory-nettyexclusions added to the shimspom.xml.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weiqingy wei Thank you very much for the code review. I've been a bit busy these past couple of days, but I will complete the revisions as soon as possible. Thank you again for reviewing the code.