Package org.kitesdk.data

Examples of org.kitesdk.data.DatasetException


  }

  private static String getHiveType(Class<?> type) {
    String typeName = PrimitiveObjectInspectorUtils.getTypeNameFromPrimitiveJava(type);
    if (typeName == null) {
      throw new DatasetException("Unsupported FieldPartitioner type: " + type);
    }
    return typeName;
  }
View Full Code Here


    final int BUFFER_SIZE = 1024;
    BufferedReader bufferedReader;
    try {
      bufferedReader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
      throw new DatasetException(
          "Platform doesn't support UTF-8. It must!", e);
    }
    char[] buffer = new char[BUFFER_SIZE];
    StringBuilder stringBuilder = new StringBuilder(BUFFER_SIZE);
    int bytesRead = 0;
    try {
      while ((bytesRead = bufferedReader.read(buffer, 0, BUFFER_SIZE)) > 0) {
        stringBuilder.append(buffer, 0, bytesRead);
      }
    } catch (IOException e) {
      throw new DatasetException("Error reading from input stream", e);
    }
    return stringBuilder.toString();
  }
View Full Code Here

      Class<? extends SpecificRecord> specificClass, AvroKeySchema keySchema) {
    Schema schemaField;
    try {
      schemaField = (Schema) specificClass.getField("SCHEMA$").get(null);
    } catch (IllegalArgumentException e) {
      throw new DatasetException(e);
    } catch (SecurityException e) {
      throw new DatasetException(e);
    } catch (IllegalAccessException e) {
      throw new DatasetException(e);
    } catch (NoSuchFieldException e) {
      throw new DatasetException(e);
    }
    // Ensure schema is limited to keySchema's fields. The class may have more
    // fields
    // in the case that the entity is being used as a key.
    List<Field> fields = Lists.newArrayList();
View Full Code Here

      AvroEntitySchema entitySchema) {
    Schema schemaField;
    try {
      schemaField = (Schema) specificClass.getField("SCHEMA$").get(null);
    } catch (IllegalArgumentException e) {
      throw new DatasetException(e);
    } catch (SecurityException e) {
      throw new DatasetException(e);
    } catch (IllegalAccessException e) {
      throw new DatasetException(e);
    } catch (NoSuchFieldException e) {
      throw new DatasetException(e);
    }
    return new AvroEntitySchema(schemaField,
        entitySchema.getRawSchema(), entitySchema.getColumnMappingDescriptor());
  }
View Full Code Here

        // keyPart is null, let's make sure we check that the key can support a
        // null value so we can throw a friendly exception if it can't.
        Schema fieldSchema = schemaToUse.getFields().get(i).schema();
        if (fieldSchema.getType() != Schema.Type.NULL
            && fieldSchema.getType() != Schema.Type.UNION) {
          throw new DatasetException(
              "Null key field only supported in null type or union type that has a null type.");
        } else if (fieldSchema.getType() == Schema.Type.UNION) {
          boolean foundNullInUnion = false;
          for (Schema unionSchema : fieldSchema.getTypes()) {
            if (unionSchema.getType() == Schema.Type.NULL) {
              foundNullInUnion = true;
            }
          }
          if (!foundNullInUnion) {
            throw new DatasetException(
                "Null key field only supported in union type that has a null type.");
          }
        }
      }
      record.put(i, keyPart);
View Full Code Here

                .loader(loaderForJars(jars))
                .impl(transform)
                .buildChecked();
        transformFn = ctor.newInstance();
      } catch (NoSuchMethodException e) {
        throw new DatasetException(
            "Cannot find no-arg constructor for class: " + transform, e);
      }
      task = new TransformTask<Record, Record>(source, dest, transformFn);
    } else {
      task = new CopyTask<Record>(source, dest);
View Full Code Here

                  .loader(loaderForJars(jars))
                  .impl(transform)
                  .buildChecked();
          transformFn = ctor.newInstance();
        } catch (NoSuchMethodException e) {
          throw new DatasetException(
              "Cannot find no-arg constructor for class: " + transform, e);
        }
        task = new TransformTask<Record, Record>(
            csvDataset, target, transformFn);
      } else {
View Full Code Here

      EntitySerDe<?> entitySerDe, String fieldName, Object filterValue,
      CompareFilter.CompareOp equalityOperator) {
    FieldMapping fieldMapping = entitySchema.getColumnMappingDescriptor()
        .getFieldMapping(fieldName);
    if (fieldMapping.getMappingType() != MappingType.COLUMN) {
      throw new DatasetException(
          "SingleColumnValueFilter only compatible with COLUMN mapping types.");
    }

    byte[] family = fieldMapping.getFamily();
    byte[] qualifier = fieldMapping.getQualifier();
View Full Code Here

      EntitySerDe<?> entitySerDe, String fieldName, String regex,
      boolean isEqual) {
    FieldMapping fieldMapping = entitySchema.getColumnMappingDescriptor()
        .getFieldMapping(fieldName);
    if (fieldMapping.getMappingType() != MappingType.COLUMN) {
      throw new DatasetException(
          "SingleColumnValueFilter only compatible with COLUMN mapping types.");
    }

    this.filter = constructFilter(regex, isEqual, fieldMapping);
  }
View Full Code Here

              : CompareFilter.CompareOp.NOT_EQUAL, regexStringComparator);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new DatasetException("Cannot create RegexEntityFilter.", e);
    }
    throw new DatasetException("Cannot create RegexEntityFilter (no constructor found).");
  }
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.