Package org.kiji.schema.cassandra

Examples of org.kiji.schema.cassandra.CassandraTableName


          String.format("No such column '%s' in table %s.", column, tableURI));
    }

    final ColumnId localityGroupId =
        layout.getFamilyMap().get(column.getFamily()).getLocalityGroup().getId();
    final CassandraTableName table =
        CassandraTableName.getLocalityGroupTableName(tableURI, localityGroupId);

    if (column.isFullyQualified()) {

      final Statement statement =
View Full Code Here


  /**
   * Increment the schema ID counter.
   * @param incrementAmount Amount by which to increment the counter (can be negative).
   */
  private void incrementSchemaIdCounter(long incrementAmount) {
    CassandraTableName tableName = mCounterTable;
    String incrementSign = incrementAmount >= 0 ? "+" : "-";
    String queryText = String.format("UPDATE %s SET %s = %s %s %d WHERE %s='%s';",
        tableName,
        SCHEMA_COUNTER_COLUMN_VALUE,
        SCHEMA_COUNTER_COLUMN_VALUE,
View Full Code Here

   * @param schemaId schema ID
   * @return Avro schema entry, or null if the schema ID does not exist in the table
   * @throws java.io.IOException on I/O error.
   */
  private SchemaTableEntry loadFromIdTable(long schemaId) throws IOException {
    CassandraTableName tableName = mSchemaIdTable;

    // TODO: Prepare this statement once in constructor, not every load.
    final String queryText = String.format(
        "SELECT %s FROM %s WHERE %s=%d ORDER BY %s DESC LIMIT 1",
        SCHEMA_COLUMN_VALUE,
View Full Code Here

   * @param kijiURI The KijiURI for the instance to remove.
   * @throws java.io.IOException If there is an error.
   */
  public static void uninstall(CassandraAdmin admin, KijiURI kijiURI)
      throws IOException {
    final CassandraTableName hashTableName = CassandraTableName.getSchemaHashTableName(kijiURI);
    deleteTable(admin, hashTableName);

    final CassandraTableName idTableName = CassandraTableName.getSchemaIdTableName(kijiURI);
    deleteTable(admin, idTableName);

    final CassandraTableName counterTableName =
        CassandraTableName.getSchemaCounterTableName(kijiURI);
    deleteTable(admin, counterTableName);
  }
View Full Code Here

   * Install a table for storing table layout information.
   * @param admin A wrapper around an open C* session.
   * @param uri The KijiURI of the instance for this table.
   */
  public static void install(CassandraAdmin admin, KijiURI uri) {
    CassandraTableName tableName = CassandraTableName.getMetaLayoutTableName(uri);

    // Standard C* table layout.  Use text key + timestamp as composite primary key to allow
    // selection by timestamp.

    // I did not use timeuuid here because we need to be able to write timestamps sometimes.
View Full Code Here

   */
  public static void install(CassandraAdmin admin, KijiURI kijiURI, Map<String, String> properties)
      throws IOException {
    // Install the table.  Sadly, we have to just use blobs and byte arrays here, so that we are
    // compliant with everything else in Kiji.  :(
    final CassandraTableName systemTableName = CassandraTableName.getSystemTableName(kijiURI);

    // The layout of this table is straightforward - just blob to blob!
    // TODO: Any check here first for whether the table exists?
    final String tableLayout =
        String.format("CREATE TABLE %s (%s text PRIMARY KEY, %s blob);",
View Full Code Here

  public static void uninstall(
      final CassandraAdmin admin,
      final KijiURI kijiURI
  ) throws IOException {
    // TODO: Does this actually need to do anything beyond dropping the table?
    final CassandraTableName tableName = CassandraTableName.getSystemTableName(kijiURI);
    final String delete = CQLUtils.getDropTableStatement(tableName);
    admin.execute(delete);
  }
View Full Code Here

   * Install a table for user-defined key-value pairs.
   * @param admin A wrapper around an open C* session.
   * @param uri The KijiURI of the instance for this table.
   */
  public static void install(CassandraAdmin admin, KijiURI uri) {
    CassandraTableName tableName = CassandraTableName.getMetaKeyValueTableName(uri);

    // Standard C* table layout.  Use text key + timestamp as composite primary key to allow
    // selection by timestamp.
    String tableDescription = String.format(
        "CREATE TABLE %s (%s text, %s text, %s timestamp, %s blob, PRIMARY KEY (%s, %s, %s)) "
View Full Code Here

      if (familyLayout == null) {
        throw new IllegalArgumentException(
            String.format("Unknown family '%s' in table %s.", family, tableURI));
      }

      final CassandraTableName table =
          CassandraTableName.getLocalityGroupTableName(
              tableURI,
              familyLayout.getLocalityGroup().getId());

      // In Cassandra Kiji, a write to HConstants.LATEST_TIMESTAMP should be a write with the
View Full Code Here

    synchronized (mMonitor) {
      final KijiTableLayout layout = mCapsule.getLayout();
      final CassandraKijiTable tableURI = mTable;
      for (LocalityGroupLayout localityGroup : layout.getLocalityGroups()) {
        final ColumnId localityGroupId = localityGroup.getId();
        final CassandraTableName table =
            CassandraTableName.getLocalityGroupTableName(tableURI.getURI(), localityGroupId);

        final Statement delete =
            CQLUtils.getLocalityGroupDeleteStatement(layout, table, entityId);
View Full Code Here

TOP

Related Classes of org.kiji.schema.cassandra.CassandraTableName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.