xushiyan edited a comment on pull request #4720:
URL: https://github.com/apache/hudi/pull/4720#issuecomment-1062053812
@fedsp it's a spark bundle or version mismatch problem where the syntax is
not recognized. Maybe previous version from the branch has some misconfig but
now it's resolved. I verified the feature in spark 3.2.1
```
➜ mvn -T 2.5C clean install -DskipTests -Djacoco.skip=true
-Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dscala-2.12 -Dspark3
// test using
packaging/hudi-spark-bundle/target/hudi-spark3.2.1-bundle_2.12-0.11.0-SNAPSHOT.jar
// Spark 3.2.1
// COW
spark.sql("""
create table hudi_cow_pt_tbl (
id bigint,
name string,
ts bigint,
dt string,
hh string
) using hudi
tblproperties (
type = 'cow',
primaryKey = 'id',
preCombineField = 'ts'
)
partitioned by (dt, hh)
location '/tmp/hudi/hudi_cow_pt_tbl';
""")
spark.sql("insert into hudi_cow_pt_tbl select 1, 'a0', 1000, '2021-12-09',
'10'")
spark.sql("select * from hudi_cow_pt_tbl").show()
spark.sql("insert into hudi_cow_pt_tbl select 1, 'a1', 1001, '2021-12-09',
'10'")
spark.sql("select * from hudi_cow_pt_tbl").show()
// time travel based on first commit time
spark.sql("select * from hudi_cow_pt_tbl timestamp as of '20220308175415995'
where id = 1").show()
// time travel based on different timestamp formats
spark.sql("select * from hudi_cow_pt_tbl timestamp as of '2022-03-08
17:54:15.995' where id = 1").show()
spark.sql("select * from hudi_cow_pt_tbl timestamp as of '2022-03-09' where
id = 1").show()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]