bhat-vinay commented on issue #10110:
URL: https://github.com/apache/hudi/issues/10110#issuecomment-2020640947

   The issue is that 
`spark.read.format("hudi").load(PATH).createOrReplaceTempView(TABLE_NAME)` 
creates a temporary view (similar to the one that is created using `CREATE 
TEMPorary VIEW ...`) and it is neither a table and not a hudi managed table. 
Hence the following `CREATE INDEX ...` statement to create a functional fails 
as the object on which the index is being created is not a hudi managed table.
   
   Instead of creating a temporary view, one can use `saveAsTable(...)` method 
on the DataFrameWriter object to create a hudi managed table and then create 
functional index on those tables. Please see if this works for you:
   ```
   df.write.format("hudi").options(**hudi_options).option("path", 
"/external/table/path").mode("append").saveAsTable("table_name")
   spark.sql(s"CREATE INDEX hudi_table_func_index_datestr ON table_name USING 
column_stats(ts) options(func='from_unixtime', format='yyyy-MM-dd')")
   ```


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