Package org.kitesdk.data

Examples of org.kitesdk.data.DatasetException


  @SuppressWarnings("unchecked")
  public Converter<?, ?, ?, ?> getConverter(PType<?> ptype) {
    if (ptype instanceof AvroType) {
      return new KeyConverter<E>((AvroType<E>) ptype);
    }
    throw new DatasetException(
        "Cannot create converter for non-Avro type: " + ptype);
  }
View Full Code Here


   */
  public int position(String fieldName) {
    if (fieldPositions.containsKey(fieldName)) {
      return fieldPositions.get(fieldName);
    } else {
      throw new DatasetException("Cannot recover " + fieldName + " from key");
    }
  }
View Full Code Here

        } else {
          // This should never happen. The partitionKey is null only when
          // a keySerDe hasn't been set, which indicates we have an entity
          // without a key. That means there should be no KEY mapping types, but
          // we somehow got here.
          throw new DatasetException("[BUG] Key-mapped field and null key");
        }
      } else {
        fieldValue = entitySerDe.deserialize(fieldMapping, result);
      }
      if (fieldValue != null) {
View Full Code Here

  public Increment mapToIncrement(PartitionKey key, String fieldName,
      long amount) {
    FieldMapping fieldMapping = entitySchema.getColumnMappingDescriptor()
        .getFieldMapping(fieldName);
    if (fieldMapping == null) {
      throw new DatasetException("Unknown field in the schema: "
          + fieldName);
    }
    if (fieldMapping.getMappingType() != MappingType.COUNTER) {
      throw new DatasetException("Field is not a counter type: "
          + fieldName);
    }

    byte[] keyBytes;
    if (keySerDe == null) {
View Full Code Here

  @Override
  public long mapFromIncrementResult(Result result, String fieldName) {
    FieldMapping fieldMapping = entitySchema.getColumnMappingDescriptor()
        .getFieldMapping(fieldName);
    if (fieldMapping == null) {
      throw new DatasetException("Unknown field in the schema: "
          + fieldName);
    }
    if (fieldMapping.getMappingType() != MappingType.COUNTER) {
      throw new DatasetException("Field is not a counter type: "
          + fieldName);
    }
    return (Long) entitySerDe.deserialize(fieldMapping, result);
  }
View Full Code Here

          PutAction put = entityMappers.get(i).mapFromEntity(subEntity);
          if (keyBytes == null) {
            keyBytes = put.getPut().getRow();
          } else {
            if (!Arrays.equals(keyBytes, put.getPut().getRow())) {
              throw new DatasetException(
                  "Composite entity keys didn't serialize to the same row bytes.");
            }
          }
          puts.add(entityMappers.get(i).mapFromEntity(subEntity));
        }
View Full Code Here

      Class<E> specificClass;
      String className = schema.getFullName();
      try {
        specificClass = (Class<E>) Class.forName(className);
      } catch (ClassNotFoundException e) {
        throw new DatasetException("Could not get Class instance for "
            + className);
      }
      return new SpecificAvroRecordBuilderFactory(specificClass);
    } else {
      return (AvroRecordBuilderFactory<E>) new GenericAvroRecordBuilderFactory(
View Full Code Here

      return "in()";
    } else if (predicate instanceof RegisteredPredicate) {
      return RegisteredPredicate.toString(
          (RegisteredPredicate) predicate, schema);
    } else {
      throw new DatasetException("Unknown predicate: " + predicate);
    }
  }
View Full Code Here

    }
    predicate = In.fromString(pString, schema);
    if (predicate != null) {
      return predicate;
    }
    throw new DatasetException("Unknown predicate: " + pString);
  }
View Full Code Here

      this.values = Maps.newHashMap();
    }

    public Builder(Dataset dataset) {
      if (!dataset.getDescriptor().isPartitioned()) {
        throw new DatasetException("Dataset is not partitioned");
      }
      this.strategy = dataset.getDescriptor().getPartitionStrategy();
      this.values = Maps.newHashMap();
    }
View Full Code Here

TOP

Related Classes of org.kitesdk.data.DatasetException

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.