Why cannot I query newly inserted data in an ORC Hive table using Spark SQL? This problem occurs in the following scenarios:
To improve Spark performance, ORC metadata is cached. When the ORC table is updated by Hive or another means, the cached metadata remains unchanged, resulting in Spark SQL failing to query the newly inserted data.
For an ORC Hive partition table, if the partition information remains unchanged after data is inserted, the cached metadata is not updated. As a result, the newly inserted data cannot be queried by Spark SQL.
Solution
table_name indicates the name of the table to be updated. The table must exist. Otherwise, an error is reported.
When the query statement is executed, the latest inserted data can be obtained.