Open ghost opened 5 years ago
you can try:
hive.executeUpdate("CREATE TABLE default.test2 (dvc string) STORED AS ORC")
val df = hive.table("default.test2")
or
hive.setDatabase("default")
hive.createTable("test2").column("dvc", "string").create()
val df = hive.table("default.test2")
When I run this I get:
scala> val df = hive.table("test2")
19/04/07 16:08:09 ERROR HiveWarehouseDataSourceReader: Unable to read table schema
java.lang.RuntimeException: java.lang.IllegalArgumentException: Expected test2 to be in the form db.table
hive.executeQuery is for reading from the query. If you want to create table use queryUpdate. It's for Alter, Update, Create etc.
More details go to: https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.5/integrating-hive/content/hive-read-write-operations.html
Code:
val df = hive.executeQuery("CREATE TABLE default.test2 (dvc string) STORED AS ORC")