0

I've built this temp SQL function from the databricks reference but get the apache/hive error. This is about as simple as can be and the SQL works so why the error?

%sql
create or replace temporary function fn_infinity()
returns timestamp
return 
select to_timestamp('2099-12-31T23:59:59.999+0000')

 

Error: *org.apache.spark.sql.AnalysisException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

---------------------------------------------------------------------------
Py4JJavaError                             Traceback (most recent call last)
File /databricks/spark/python/pyspark/sql/utils.py:209, in capture_sql_exception.<locals>.deco(*a, **kw)
    208 try:
--> 209     return f(*a, **kw)
    210 except Py4JJavaError as e:

File /databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/protocol.py:326, in get_return_value(answer, gateway_client, target_id, name)
    325 if answer[1] == REFERENCE_TYPE:
--> 326     raise Py4JJavaError(
    327         "An error occurred while calling {0}{1}{2}.\n".
    328         format(target_id, ".", name), value)
    329 else:

Py4JJavaError: An error occurred while calling o363.sql.
: org.apache.spark.sql.AnalysisException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

I've tried reattaching the cluster. Could it be related to Unity Catalog? Appreciate any ideas.

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
Greg
  • 41
  • 3
  • See if this [SO thread](https://stackoverflow.com/questions/22711364/java-lang-runtimeexceptionunable-to-instantiate-org-apache-hadoop-hive-metastor) is helpful. – Dipanjan Mallick Apr 06 '23 at 02:28

1 Answers1

0

as simple as -

"so in databricks, users can write to different 'catalogs' and the default one is the 'hive metastore'. looks like you might need to specify the catalog or set the catalog before you run "

%sql
--USE CATALOG 'development';
use catalog '${env.catalog}';
Greg
  • 41
  • 3