Creating Column Families

There are several methods that you can use to create column families in MapR-DB tables.

Permissions Required

  • readAce and writeAce on the volume
  • lookupdir on directories in the path to the table
  • createrenamefamilyperm on the table

Methods Common to Both Table Types

These methods allow you to create column families in both binary tables and JSON tables.

Restriction: If any existing column family in a JSON table, including the default column family, uses a time-to-live that is greater than 0, you cannot create any additional column families in that table. See Setting TTL for Data.

maprcli command

The basic command to create a column family is:
maprcli table cf create -path <path> -cfname <name_of_column_family>
For the full list of options for this command, see table cf create.
To create a column family in a JSON table, include the parameters -jsonpath and -force :
maprcli table cf create -path <path> -cfname <name_of_column_family> -jsonpath 
<path> -force true

The format of the value of the -path parameter depends on whether you are creating a table on a local cluster or a remote cluster:

  • For a path on the local cluster, start the path at the volume mount point. For example, for a table named test under a volume with a mount point at /volume1, specify the following path: /volume1/test
  • For a path on a remote cluster, you must also specify the cluster name in the path. For example, for a table named customer under volume1 in the sanfrancisco cluster, specify the following path:/mapr/sanfrancisco/volume1/customer
The -jsonpath parameter specifies the path to the column family. The path is in dotted notation. For example, suppose the table contained JSON documents that were of this general structure:
{
     "_id" : "ID",
     "a" :
          {
               "b" : 
                    {
                         "c" : "value",
                    },
               "e" : "value"
          }
}
You want to create a column family at the field d in the new path a.b.d because you plan to store image files in fields in that column family.
Important: Ensure that the field at which you want to create the column family does not yet exist. If the field does exist, it could become inaccessible after the column family is created.

By default, every time you try to create a non-default column family in a JSON table, this command fails and returns a warning message that you should ensure there is no existing data at the specified path. Set the -force parameter to true if you want to override this warning mechanism and create a column family.

MCS

  1. Open the table in which you want to create the column family.
  2. Click the Column Families tab.

    Figure: Where to find the Column Families tab

  3. Click the New Column Family button.

The Create Column Family window opens.

Method for Binary Tables Only

HBase Shell

After starting the HBase shell, run the alter command. Type help to see a list of commands and their syntax.