You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "Tao Meng (Jira)" <ji...@apache.org> on 2023/02/23 10:25:00 UTC

[jira] [Created] (HUDI-5835) spark cannot read mor table after execute update statement

Tao Meng created HUDI-5835:
------------------------------

             Summary: spark cannot read mor table after execute update statement
                 Key: HUDI-5835
                 URL: https://issues.apache.org/jira/browse/HUDI-5835
             Project: Apache Hudi
          Issue Type: Bug
          Components: spark
    Affects Versions: 0.13.0
            Reporter: Tao Meng


avro schema create by sparksql will miss avro name and namespace, 

This will lead the read schema and write schema of the log file to be incompatible

```

test("Test upsert table") {
withTempDir { tmp =>
val tableName = generateTableName

val tablePath = new Path(tmp.getCanonicalPath, tableName)
// create table
spark.sql(
s"""
|create table $tableName (
| id int,
| name string,
| price double,
| ts long,
| ff decimal(38, 10)
|) using hudi
| location '${tablePath.toString}'
| tblproperties (
| type = 'mor',
| primaryKey = 'id',
| preCombineField = 'ts'
| )
""".stripMargin)

// insert data to table
spark.sql(s"insert into $tableName select 1, 'a1', 10, 1000, 10.0")
checkAnswer(s"select id, name, price, ts from $tableName")(
Seq(1, "a1", 10.0, 1000)
)

spark.sql(s"update $tableName set price = 22 where id = 1")
checkAnswer(s"select id, name, price, ts from $tableName")(
Seq(1, "a1", 22.0, 1000)
)
}
}

```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)