gnailJC commented on issue #5586:
URL: https://github.com/apache/hudi/issues/5586#issuecomment-1133541321

   > > > hi @gnailJC Thanks for the question, now `timestamp as of` only 
supports `table` operations, not `view` related operations yet. If there is a 
business scenario requirement, we can implement it, and mention a jira.
   > > 
   > > 
   > > thanks for your reply! @XuQianJin-Stars I need to create a view based on 
hudi table data on a special old instant to query the old data. so I try two 
way to get it.
   > > 
   > > 1. use `create view xx select * from hudi_tbl timestamp as of xxxx`, and 
it's not support yet we know.
   > > 2. so i try the second way, like
   > >    `CREATE external TABLE tbl_snapshot_v20220512164415876 using hudi 
options ( as.of.instant=20220513103255808 ) LOCATION 'xxxx;`
   > >    create a table first, and create a view based on this table.
   > >    but the `as.of.instant` is not work, it always query the latest 
snapshot, why?
   > > 
   > > and now I try use inc query: `CREATE external TABLE 
tbl_inc_v20220512170625756 using hudi options ( 
hoodie.datasource.query.type='incremental', 
hoodie.datasource.read.begin.instanttime=0, 
hoodie.datasource.read.end.instanttime=20220512170625756 ) LOCATION 'xxx';` and 
the `hoodie.datasource.read.end.instanttime` is work! so why the 
`as.of.instant` can't but the ` hoodie.datasource.read.end.instanttime` can 
work?
   > 
   > have a try this
   > 
   > ```
   > create table $tableName1 using hudi 
   > tblproperties(
   >    primaryKey = 'id',
   >    type = '$tableType'
   > )
   > AS location '${tmp.getCanonicalPath}/$tableName1' 
   > select id, name, price, ts from $tableName1 TIMESTAMP AS OF '$instant1' 
where id=1
   > ```
   
   CTAS can indeed achieve the expected query effect, but it will increase the 
new storage cost.
   I found the reason why 
   `CREATE external TABLE tbl_snapshot_v20220512164415876 
   using hudi
   options ( as.of.instant=20220513103255808 ) 
   LOCATION 'xxxx;` 
   does not take effect, because `as.of.instant` will be filtered out, so it 
does not achieve the purpose of querying old snapshots. As I mentioned in the 
PR. [[MINOR]: Optimize the judgment logic of SparkDataSourceOptions Key 
#5616](https://github.com/apache/hudi/pull/5616)


-- 
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]

Reply via email to