Github user windpiger commented on a diff in the pull request:
https://github.com/apache/spark/pull/16787#discussion_r100070021
--- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveUtils.scala
---
@@ -463,117 +459,6 @@ private[spark] object HiveUtils extends Logging {
case (other, tpe) if primitiveTypes contains tpe => other.toString
}
- /** Converts the native StructField to Hive's FieldSchema. */
- private def toHiveColumn(c: StructField): FieldSchema = {
- val typeString = if (c.metadata.contains(HiveUtils.hiveTypeString)) {
- c.metadata.getString(HiveUtils.hiveTypeString)
- } else {
- c.dataType.catalogString
- }
- new FieldSchema(c.name, typeString, c.getComment.orNull)
- }
-
- /** Builds the native StructField from Hive's FieldSchema. */
- private def fromHiveColumn(hc: FieldSchema): StructField = {
- val columnType = try {
- CatalystSqlParser.parseDataType(hc.getType)
- } catch {
- case e: ParseException =>
- throw new SparkException("Cannot recognize hive type string: " +
hc.getType, e)
- }
-
- val metadata = new
MetadataBuilder().putString(HiveUtils.hiveTypeString, hc.getType).build()
- val field = StructField(
- name = hc.getName,
- dataType = columnType,
- nullable = true,
- metadata = metadata)
- Option(hc.getComment).map(field.withComment).getOrElse(field)
- }
-
- // TODO: merge this with HiveClientImpl#toHiveTable
- /** Converts the native table metadata representation format
CatalogTable to Hive's Table. */
- def toHiveTable(catalogTable: CatalogTable): HiveTable = {
--- End diff --
this method has been deleted, and use HiveClientImpl.toHiveTable which use
shim to set location. In HiveClientImpl, the hive version maybe not same with
the default hive(1.2.1), so it use run time shim to setDataLocation. while
here deleted HiveUtils.toHiveTable just for runtime hive execution not to
interact with metastore.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]