Answer the question
In order to leave comments, you need to log in
Is it possible to automate the creation of tables in HIVE?
Good afternoon, when creating tables in HIVE, we must immediately define all the fields of the table https://cwiki.apache.org/confluence/display/Hive/L...
But provided that we have a csv file with 600+ columns, it is possible it is possible to create a table based on this file with the required number of columns? NOT by hand.
Answer the question
In order to leave comments, you need to log in
maybe spark. create a dataframe on the file, make createOrReplaceTempView and
spark.sql("create table my_table as select * from my_temp_table");
You can do this (via spark)
1) Spread the csv line
2) Determine the number of columns in it.
3) Generate sql query in spark so that the final result would be
Create table YourTabel (col1 string,col2 string, ......) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\;' STORED AS TEXTFILE;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question