Skip to content

Conversation

@xushiyan
Copy link
Member

@xushiyan xushiyan commented Apr 18, 2022

If schema on read is not enabled, use HadoopFsRelation.

BaseFileOnlyRelation is not able to read nested field; it reads the whole struct field like ReadSchema: struct<repo:struct<id:bigint,name:string,url:string>>

HadoopFsRelation reads ReadSchema: struct<repo:struct<name:string>>

@xushiyan xushiyan force-pushed the fallback-HadoopFsRel branch from 0354fcb to 300c4f0 Compare April 18, 2022 08:08
case HoodieFileFormat.PARQUET => new ParquetFileFormat
case HoodieFileFormat.ORC => new OrcFileFormat
},
optParams)(sparkSession)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need HoodieFileIndex or HoodieROTablePathFilter to filter old parquet file.
how about fallabck to the implement of 0.10.0

private def getBaseFileOnlyView(useHoodieFileIndex: Boolean,

val tableType = metaClient.getTableType
val queryType = parameters(QUERY_TYPE.key)
val enableSchemaOnRead = parameters.getOrElse(SCHEMA_EVOLUTION_ENABLE.key, SCHEMA_EVOLUTION_ENABLE.defaultValue.toString).toBoolean
val userSchema = if (schema == null) Option.empty[StructType] else Some(schema)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it better to use follow code.

          val enableSchemaOnRead: Boolean = try {
            !(new TableSchemaResolver(metaClient).getTableInternalSchemaFromCommitMetadata.orElse(InternalSchema.getEmptyInternalSchema)).isEmptySchema
          } catch {
            case _: Exception => false
          }

@hudi-bot
Copy link
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@xushiyan
Copy link
Member Author

close in favor of #5352

@xushiyan xushiyan closed this Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants