I want to use the following query to load local data into a Hive table
using JDBC client:

load data local inpath '/local-directory-path/file.csv' into
<mytable>;// from local

we can then do something like the following if the table is already defined
in Hive metastore:

String conStr = "jdbc:hive2://hiveServer2IP:10000/default";
Class.forName("org.apache.hive.jdbc.HiveDriver");
 con = DriverManager.getConnection(conStr, "", "");
Statement stmt = con.createStatement();
stmt.executeQuery("load data local inpath '/local-directory-path/file.csv'
into <mytable>;");// from local"


The question is : what is the most common piece of code to use in a JDBC
client to create a Hive table that is specific to a dataset which we know
the schema:

I know that something like the following will define a table in Hive

stmt.executeQuery("create table " + tableName + " (key int, value string)");

But what is the commonly used way to create the schema string that the
latter command uses (e.g. (key int, value string)) ?

Reply via email to