Package org.kiji.schema

Examples of org.kiji.schema.InternalKijiError


                  new CassandraColumnName(
                      mFamilyColumn.getFamily(),
                      ByteUtils.toBytes(row.getBytes(CQLUtils.QUALIFIER_COL))));
        } catch (NoSuchColumnException e) {
          // There should be no columns that we can't decode, so this signals a logic error
          throw new InternalKijiError(e);
        }
      }

      final long version = row.getLong(CQLUtils.VERSION_COL);
View Full Code Here


      case DEVELOPER: {
        if (!mRegisteredWriters.contains(writerSchema)) {
          LOG.info("Writer schema {} is currently not registered for column {}, registering now.",
              writerSchema, mCellSpec.getColumnURI());
          if (mCellSpec.getColumnURI() == null) {
            throw new InternalKijiError("CellSpec has no column URI: " + mCellSpec);
          }

          registerWriterSchema(mCellSpec.getColumnURI(), writerSchema);
        }
        break;
View Full Code Here

                    .withWriter(column, writerSchema)
                    .withWritten(column, writerSchema)
                    .build();
              } catch (InvalidLayoutException ile) {
                LOG.error("Internal error while updating table layout in DEVELOPER mode: {}", ile);
                throw new InternalKijiError(ile);
              } catch (IOException ioe) {
                LOG.error("I/O error while updating table layout in DEVELOPER mode: {}", ioe);
                throw new KijiIOException(ioe);
              }
            }
View Full Code Here

        if (!mValueFlag.isEmpty()) {
          exitWithErrorMessage("Cannot specify --value while --do=get");
        }
        break;
      }
      default: throw new InternalKijiError(String.format("Unknown DoMode: %s", mDoMode));
    }
    if (!mFamilyFlag.isEmpty() && !mURI.getColumns().isEmpty()) {
      exitWithErrorMessage("--in-family requires that no columns are specified in --target");
    }
  }
View Full Code Here

            // fall back on using the writer schema:
            setUseWriterSchema();
          }
          break;
        }
        default: throw new InternalKijiError("Unknown Avro cell type: " + mCellSchema);
      }
    }
    return this;
  }
View Full Code Here

        try {
          switch (mDoMode) {
            case SET: return set();
            case REMOVE: return remove();
            case GET: return get();
            default: throw new InternalKijiError("Unknown NotesTool DoMode: " + mDoMode);
          }
        } finally {
          mAnnotator.close();
        }
      } finally {
View Full Code Here

    Preconditions.checkState(isAvro());
    switch (mAvroReaderSchema) {
      case DEFAULT: return getDefaultReaderSchema();
      case EXPLICIT: return mReaderSchema;
      case WRITER: return null;
      default: throw new InternalKijiError("Invalid Avro reader schema: " + mAvroReaderSchema);
    }
  }
View Full Code Here

      new HBaseDataRequestAdapter(
          mRowFilter.getDataRequest(),
          HBaseColumnNameTranslator.from(mTableLayout))
          .applyToScan(scan, mTableLayout);
    } catch (InvalidLayoutException e) {
      throw new InternalKijiError(e);
    }

    // Set the filter.
    final KijiRowFilter.Context context =
        new KijiRowFilterContext(HBaseColumnNameTranslator.from(mTableLayout));
View Full Code Here

              schema));
        }
        break;
      }
      default:
        throw new InternalKijiError("Unhandled cell type: " + schema);
    }

    // Validate Avro schema through loading and parsing:
    try {
      CellSpec.readAvroSchema(schema);
View Full Code Here

            // If the FamilyLayout changed from group-type to map-type between table layout versions
            // that is an incompatible change.
            incompatabilityMessages.add(String.format(
                "Family: %s changed from group-type to map-type.", refFamilyLayout.getName()));
          } else {
            throw new InternalKijiError(String.format(
                "Family: %s is neither map-type nor group-type.", refFamilyLayout.getName()));
          }
        } else {
          // If the reference FamilyLayout is null this indicates a new family, which is inherently
          // compatible, but we still have to validate that the new readers and writers are
          // internally compatible.
          incompatabilityMessages.addAll(addColumnNamestoIncompatibilityMessages(
              flayout.getName(), null, validateCellSchema(null, cellSchema)));
        }
      } else if (flayout.isGroupType()) {
        // Check for a matching family from the reference layout.
        FamilyLayout refFamilyLayout = null;
        if (refLGLayout != null) {
          final String refFamilyName = refLGLayout.getFamilyIdNameMap().get(familyId);
          if (refFamilyName != null) {
            refFamilyLayout = refLGLayout.getFamilyMap().get(refFamilyName);
          }
        }

        if (refFamilyLayout != null) {
          if (refFamilyLayout.isGroupType()) {
            // If there is a matching reference family and it is the same family type, iterate
            // through the columns checking schema compatibility.  Only checks columns from the new
            // layout because removed columns are inherently valid.
            for (ColumnLayout columnLayout : flayout.getColumns()) {
              final CellSchema cellSchema = columnLayout.getDesc().getColumnSchema();

              final String refColumnName =
                  refFamilyLayout.getColumnIdNameMap().get(columnLayout.getId());
              ColumnLayout refColumnLayout = null;
              if (refColumnName != null) {
                // If there is a column from the reference layout with the same column ID, get its
                // layout.
                refColumnLayout = refFamilyLayout.getColumnMap().get(refColumnName);
              }
              // If there is a column from the reference layout with the same column ID, get its
              // CellSchema.
              final CellSchema refCellSchema =
                  (refColumnLayout == null) ? null : refColumnLayout.getDesc().getColumnSchema();

              // If there is no matching column, refCellSchema will be null and this will only test
              // that the new reader and writer schemas are internally compatible.
              incompatabilityMessages.addAll(addColumnNamestoIncompatibilityMessages(
                  flayout.getName(),
                  columnLayout.getName(),
                  validateCellSchema(refCellSchema, cellSchema)));
            }
          } else if (refFamilyLayout.isMapType()) {
            // If the FamilyLayout changed from map-type to group-type between table layout versions
            // that is an incompatible change.
            incompatabilityMessages.add(String.format(
                "Family: %s changed from map-type to group-type.", refFamilyLayout.getName()));
          } else {
            throw new InternalKijiError(String.format(
                "Family: %s is neither map-type nor group-type.", refFamilyLayout.getName()));
          }
        } else {
          // If the reference FamilyLayout is null this indicates a new family, which is inherently
          // compatible, but we still have to validate that the new readers and writers are
          // internally compatible.
          for (ColumnLayout columnLayout : flayout.getColumns()) {
            final CellSchema cellSchema = columnLayout.getDesc().getColumnSchema();
            incompatabilityMessages.addAll(addColumnNamestoIncompatibilityMessages(
                flayout.getName(), columnLayout.getName(), validateCellSchema(null, cellSchema)));
          }
        }

      } else {
        throw new InternalKijiError(String.format(
            "Family: %s is neither map-type nor group-type.", flayout.getName()));
      }
    }

    // If there were any incompatibility errors, throw an exception.
View Full Code Here

TOP

Related Classes of org.kiji.schema.InternalKijiError

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.