MaitreyaManohar commented on issue #12978:
URL: https://github.com/apache/hudi/issues/12978#issuecomment-2724782899

   > [@MaitreyaManohar](https://github.com/MaitreyaManohar) Is there any reason 
you used _hoodie_commit_time in the create statement, as there are hudi meta 
fields.
   
   I want to query it as a separate column so that I can use it for processing 
(I would use it in the flink table API to do some processing with 
_hoodie_commit_time)
   
   I tried to remove the _hoodie_commit_time from the CREATE table statement 
and instead tried to create a view using this command but 
   `CREATE VIEW hudi_table_view AS SELECT _hoodie_commit_time, uuid, test FROM 
hudi_table;`
   
   But this gives me this error
   ```
   [ERROR] Could not execute SQL statement. Reason:
   org.apache.calcite.sql.validate.SqlValidatorException: Column 
'_hoodie_commit_time' not found in any table
   ```
   
   Is there another way to query the `_hoodie_commit_time` without explicitly 
putting it in the `CREATE TABLE` statement?
   
   Another approach I tried was to remove the _hoodie_commit_time from the 
CREATE table statement and create another table which would act like a view 
   ```
   CREATE TABLE hudi_table_view (
     _hoodie_commit_time STRING, -- Commit time
     uuid STRING PRIMARY KEY NOT ENFORCED, -- Record key
     test BOOLEAN -- Check column
   ) 
   WITH (
     'connector' = 'hudi',
     'path' = 's3a://test-bucket/test', -- Path to your Hudi table
     'table.type' = 'COPY_ON_WRITE', -- Specify the table type (COW or MOR)
     'cdc.enabled' = 'true', -- Enable CDC
     'hoodie.datasource.write.recordkey.field' = 'uuid' -- Record key field
   );
   select * from hudi_table_view/*+ OPTIONS('read.streaming.enabled'='true')*/;
   ```
   but this was also had NULL values in the _hoodie_commit_time column
   
   
   


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