Using a managed table to load local data 

If you do not need to store data in a Cassandra table, use a managed table instead of an external table. The data can be located in the Cassandra File System (CFS) or on the file system.

If you do not need to store data in a Cassandra table, use a managed table instead of an external table. The data can be located in the Cassandra File System (CFS) or on the file system. You load the data into the managed table as shown in this example:

  1. Create a managed table:
    hive>  CREATE TABLE invites (foo INT, bar STRING )
           PARTITIONED BY  (ds STRING );
  2. Load data into a table using the LOAD DATA command. The HiveQL Manual provides more information about the HiveQL syntax.

    For example, on the Mac OS X:

    hive>  LOAD DATA LOCAL INPATH 'install_location/resources/hive/examples/files/kv2.txt' OVERWRITE INTO TABLE invites PARTITION  ( ds = '2008-08-15' );
    
    hive>  LOAD DATA LOCAL INPATH  'install_location/resources/hive/examples/files/kv3.txt' OVERWRITE INTO TABLE invites PARTITION  ( ds = '2008-08-08' );
    
    hive>  SELECT count (* ), ds FROM invites GROUP BY ds;
Note: The paths to the Hive example files shown in the example LOAD commands above are for the tarball distribution.