-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-16948][SQL] Use metastore schema instead of inferring schema for ORC in HiveMetastoreCatalog #14537
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
[SPARK-16948][SQL] Use metastore schema instead of inferring schema for ORC in HiveMetastoreCatalog #14537
Changes from 1 commit
5721b88
4ae92d8
75bca1b
97d21f6
4004c0a
9a8838a
eb8a955
70cf84d
c9d677b
7385a06
1746853
5f7e5ad
e8e2d70
0f901aa
0772a96
6ff7e5d
fc14e2d
9ecb2ed
fa71370
e39715e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…tion
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -287,16 +287,14 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log | |
| new Path(metastoreRelation.catalogTable.storage.locationUri.get), | ||
| partitionSpec) | ||
|
|
||
| val schema = | ||
| defaultSource.inferSchema(sparkSession, options, fileCatalog.allFiles()) | ||
|
||
| val inferredSchema = if (fileType.equals("parquet")) { | ||
|
||
| val inferredSchema = | ||
| defaultSource.inferSchema(sparkSession, options, fileCatalog.allFiles()) | ||
| inferredSchema.map { inferred => | ||
| schema.map { inferred => | ||
| ParquetFileFormat.mergeMetastoreParquetSchema(metastoreSchema, inferred) | ||
| }.getOrElse(metastoreSchema) | ||
| } else { | ||
| val inferredSchema = | ||
| defaultSource.inferSchema(sparkSession, options, fileCatalog.allFiles()) | ||
| inferredSchema.getOrElse(metastoreSchema) | ||
| schema.getOrElse(metastoreSchema) | ||
| } | ||
|
|
||
| val relation = HadoopFsRelation( | ||
|
|
||
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.
Thanks for refactoring this.
I think it makes more sense if
is called
inferredSchemaand the value of theif (fileType.equals("parquet"))expression is calledschema.