apache / kyuubi

Apache Kyuubi is a distributed and multi-tenant gateway to provide serverless SQL on data warehouses and lakehouses.
https://kyuubi.apache.org/
Apache License 2.0
2.11k stars 915 forks source link

[Bug] AVRO table - [TABLE_OR_VIEW_NOT_FOUND] #6649

Open prsklark opened 2 months ago

prsklark commented 2 months ago

Code of Conduct

Search before asking

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?

github-actions[bot] commented 2 months ago

Hello @prsklark, Thanks for finding the time to report the issue! We really appreciate the community's efforts to improve Apache Kyuubi.