fixed this issue by changing hive.metastore.uris value into "thrift://host.docker.internal:9083" in the hive-site.xml in spark.
hive.metastore.uris