[Bug] AVRO table - [TABLE_OR_VIEW_NOT_FOUND]
- Dominant language
- Scala
- Stars
- 2.4k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
### Search before asking
- [X] I have searched in the [issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no similar issues.
### Describe the bug
There is an issue when querying an Avro table through Kyuubi. The table is visible from the Spark side, and it is possible to execute a SELECT statement to retrieve data. The table also appears in the list of tables in Kyuubi, for example, when viewed through DBeaver. However, when attempting to query the table from Kyuubi, the following error occurs:
```SQL Error: org.apache.kyuubi.KyuubiSQLException: org.apache.kyuubi.KyuubiSQLException: Error operating ExecuteStatement: org.apache.spark.sql.AnalysisException: [TABLE_OR_VIEW_NOT_FOUND] The table or view `spark_catalog`.`default`.`avro1` cannot be found.```
The table is created from JupyterHub using the following Spark SQL command:
```
spark.sql(f'''
CREATE TABLE {table_name}
USING avro
OPTIONS (path '{path}')
''')
```
Where:
```{table_name}``` is the name of the table,
```{path}``` is the path to the Avro file on S3.
Kyuubi is integrated with the Hive Metastore, and the metadata is stored in a PostgreSQL database. Entries related to this table are visible in the PostgreSQL database; however, the metadata_location entry is missing. For Iceberg tables, everything works correctly, and the metadata_location is present in the PostgreSQL database.
This suggests that while the table's metadata exists in PostgreSQL, there is a specific problem with the Avro table's metadata_location not being recorded or managed correctly. The discrepancy between how Avro and Iceberg tables are handled may point to an issue in the integration between Kyuubi, Spark, Hive Metastore, and PostgreSQL.
### Affects Version(s)
v1.9.1
### Kyuubi Server Log Output
_No response_
### Kyuubi Engine Log Output
_No response_
### Kyuubi Server Configurations
_No response_
### Kyuubi Engine Configurations
_No response_
### Additional context
_No response_
### Are you willing to submit PR?
- [ ] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
- [ ] No. I cannot submit a PR at this time.
Contributor guide
Research direction
Reproduce the issue by creating an Avro table with the shown Spark SQL command, then query it through Kyuubi and compare it with an Iceberg table. Inspect the Hive Metastore entries in PostgreSQL, focusing on the missing metadata_location, and review the Kyuubi and engine logs if available. Done means Avro tables can be queried through Kyuubi with their metadata handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, postgresql, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100