Can I import CSV or any other flat files in to hive without creating and defining table structure first in hive. Say my csv file is having 200 columns and needs to be imported into hive table. So I have to first create a table in hive and define all the column names and datatype within that hive table and import. Is there any way in which I can directly import in to hive and it automatically creates tables structure from first line say, similar to sqoop import?
Navigate to the file you want to import, right-click it, select Import into Hive, and select how to import it: Import as CSV, Import as Apache Avro, or Import as Apache Parquet.
use sqoop with a "hive-import" switch & it will create your table for you http://archive.cloudera.com/cdh/3/sqoop/SqoopUserGuide.html#_importing_data_into_hive
Check your hive-site.xml for the value of the property javax.jdo.option.ConnectionURL. If you do not define this explicitly, the default value will use a relative path for creation of hive metastore (jdbc:derby:;databaseName=metastore_db;create=true) which will be different depending upon where you launch the process from. This would explain why you cannot see the table via show tables.
The way to overcome it would be to define this property value in your hive-site.xml using an absolute path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With