Data exchange – LOAD
To move data in Hive, it uses the LOAD
keyword. Move here means the original data is moved to the target table/partition and does not exist in the original place anymore. The following is an example of how to move data to the Hive table or partition from local or HDFS files. The LOCAL
keyword specifies where the files are located in the host. If the LOCAL
keyword is not specified, the files are loaded from the full Uniform
Resource Identifier (URI) specified after INPATH
or the value from the fs.default.name
Hive property by default. The path after
INPATH
can be a relative path or an absolute path. The path either points to a file or a folder (all files in the folder) to be loaded, but the subfolder is not allowed in the path specified. If the data is loaded into a partition table, the partition column must be specified. The OVERWRITE
keyword is used to decide whether to append or replace the existing data in the target table/partition.
The following are the examples...