[
https://issues.apache.org/jira/browse/HUDI-8956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17925891#comment-17925891
]
Ekaterina Belousova commented on HUDI-8956:
-------------------------------------------
but why column dt should be in schema if you use this property?
hoodie.datasource.write.drop.partition.columns = 'true'
> insert with static partition config leads to wrong schema being written
> -----------------------------------------------------------------------
>
> Key: HUDI-8956
> URL: https://issues.apache.org/jira/browse/HUDI-8956
> Project: Apache Hudi
> Issue Type: Bug
> Reporter: Davis Zhang
> Priority: Major
> Fix For: 1.0.2
>
>
>
> {code:java}
> test("Test enable hoodie.datasource.write.drop.partition.columns when write")
> {
> withSQLConf("hoodie.sql.bulk.insert.enable" -> "false") {
> Seq("cow").foreach { tableType =>
> withRecordType()(withTempDir { tmp =>
> val tableName = generateTableName
> spark.sql(
> s"""
> | create table $tableName (
> | id int,
> | name string,
> | price double,
> | ts long,
> | dt string
> | ) using hudi
> | partitioned by (dt)
> | location '${tmp.getCanonicalPath}/$tableName'
> | tblproperties (
> | primaryKey = 'id',
> | preCombineField = 'ts',
> | type = '$tableType',
> | hoodie.datasource.write.drop.partition.columns = 'true'
> | )
> """.stripMargin)
> spark.sql(s"insert into $tableName partition(dt='2021-12-25') values
> (1, 'a1', 10, 1000)")
> spark.sql(s"insert into $tableName partition(dt='2021-12-25') values
> (2, 'a2', 20, 1000)")
> checkAnswer(s"select id, name, price, ts, dt from $tableName")(
> Seq(1, "a1", 10, 1000, "2021-12-25"),
> Seq(2, "a2", 20, 1000, "2021-12-25")
> )
> })
> }
> }
> } {code}
> extra commit metadata does not contain the partition column `dt`
> {code:java}
> "schema":
> "{\"type\":\"record\",\"name\":\"h2_record\",\"namespace\":\"hoodie.h2\",\"fields\":[{\"name\":\"id\",\"type\":[\"null\",\"int\"],\"default\":null},{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"price\",\"type\":[\"null\",\"double\"],\"default\":null},{\"name\":\"ts\",\"type\":[\"null\",\"long\"],\"default\":null}]}"{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)