hive fundamentals or the basic operation of the command

1, hive create a standard table (after all can follow this created):

  create table records (year STRING,temperature INT,quality INT)

  row format delimted fields terminated by ‘\t’;

Analysis: The first line declares a table records, including three (three fields): year, temperature, quality. Specify the data type: string, int, int. // The first line parsing and creating tables as MySQL

   HiveQL second line is unique, each line in the data file is separated by a tab delimited text. If the text introduced by the local or import hive i.e. each row must hdfs three fields, each field separated by tab characters in this format, each line separated by line feed

  PS: table name records in hdfs in fact, a directory name;

 

2, the data files into the hive

  load data local inpath “/home/hdc/sample.txt”

  overwrite into table records;

Analysis: The sample introduced into the local file records in the table, which can be added from time to increase overwrite, if the rate corresponding to represent hive delete all files in the list already, then sent to the next file sample.txt records;

   If left represents the hive simply put sample.txt file to the directory (if this directory has the same name as the file is replaced).

 

Guess you like

Origin www.cnblogs.com/hdc520/p/11077705.html