Skip to content

Conversation

@dongkelun
Copy link
Contributor

@dongkelun dongkelun commented Aug 16, 2022

Create table

use hudi;
CREATE TABLE  test_hudi_table_mor (
  id int,
  name string,
  price double,
  ts long,
  dt string
) using hudi
options (
  primaryKey = 'id',
  preCombineField = 'ts',
  type = 'mor'
 )
 partitioned by (dt);

Create _rt table

CREATE TABLE test_hudi_table_mor_rt
using hudi
OPTIONS (
  'hoodie.query.as.ro.table' = 'false'
)
location 'hdfs://cluster1/warehouse/tablespace/managed/hive/hudi.db/test_hudi_table_mor';

Failed exception:

WARN CreateHoodieTableCommand: Failed to create catalog table in metastore: org.apache.hadoop.hive.ql.metadata.HiveException: at least one column must be specified for the table

Related pr: [HUDI-4149] Drop-Table fails when underlying table directory is broken

Change Logs

Describe context and summary for this change. Highlight if any code was copied.

Impact

Describe any public API or user-facing feature change or any performance impact.

Risk level: none | low | medium | high

Choose one. If medium or high, explain what verification was done to mitigate the risks.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@dongkelun
Copy link
Contributor Author

@hudi-bot run azure

@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

@dongkelun dongkelun changed the title [HUDI-4629] Create hive table from existing hoodie Table failed when the table schema is not defined [HUDI-4629] Create hive table from existing hoodie table failed when the table schema is not defined Aug 17, 2022
lazy val tableSchema: StructType = if (table.schema.nonEmpty) {
table.schema
} else {
val schemaFromMetaOpt = loadTableSchemaByMetaClient()
Copy link
Member

Choose a reason for hiding this comment

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

this already handled in parseSchemaAndConfigs() , isn't it?

Copy link
Member

Choose a reason for hiding this comment

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

@jinxing64 can you also have a look pls? given this is based on your previous change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this already handled in parseSchemaAndConfigs() , isn't it?
yes

@yihua yihua added engine:hive Hive integration area:sql SQL interfaces priority:critical Production degraded; pipelines stalled labels Sep 6, 2022
@xushiyan xushiyan added priority:high Significant impact; potential bugs and removed priority:critical Production degraded; pipelines stalled labels Sep 19, 2022
* Table schema
*/
lazy val tableSchema: StructType = table.schema
lazy val tableSchema: StructType = if (table.schema.nonEmpty) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer to call loadTableSchemaByMetaClient directly without having to decide if table.schema is empty.
Parsing the metadata on spark does not need to depend on the meta from metastore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YannByron The table.schema is not obtained from the hive metastore, but is specified by the user. Only when the user does not specify a schema, we can parse and obtain the schema from the file through the method loadTableSchemaByMetaClient

@nsivabalan nsivabalan added the release-0.12.2 Patches targetted for 0.12.2 label Dec 6, 2022
@codope codope removed the release-0.12.2 Patches targetted for 0.12.2 label Dec 7, 2022
@github-actions github-actions bot added the size:S PR with lines of changes in (10, 100] label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:sql SQL interfaces engine:hive Hive integration priority:high Significant impact; potential bugs size:S PR with lines of changes in (10, 100]

Projects

Status: 🏁 Triaged
Status: 🏗 Under discussion

Development

Successfully merging this pull request may close these issues.

7 participants