<property> <name>hive.exec.dynamic.partition.mode</name> <value>nonstrict</value> <description> In strict mode, the user must specify at least one static partition in case the user accidentally overwrites all partitions. In nonstrict mode all partitions are allowed to be dynamic. </description> </property>
val spark = SparkSession.builder().appName("spark on hive"). config("spark.sql.warehouse.dir", "hdfs://hc1/spark"). enableHiveSupport().getOrCreate() spark.sql("CREATE TABLE test_df (v1 STRING, v2 STRING, v3 DOUBLE)" + "ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE") spark.sql("LOAD DATA LOCAL INPATH '/home/tester/test_df.csv' OVERWRITE INTO TABLE test_df")
val hiveDF = spark.sql("select * from test_df") hiveDF.show(2) # +-------------------+---+----+ # | v1| v2| v3| # +-------------------+---+----+ # |-0.0170655635959667| e|null| # | 0.441907768470412| d|null| # +-------------------+---+----+ # only showing top 2 rows