Search in sources :

Example 1 with SplitStoreFromJavaRDDOfElements

use of uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements in project Gaffer by gchq.

the class SplitStoreFromJavaRDDOfElementsHandlerTest method throwsExceptionWhenMaxSampleSizeIsLessThanOne.

@Test
public void throwsExceptionWhenMaxSampleSizeIsLessThanOne() throws OperationException {
    final SplitStoreFromJavaRDDOfElements splitStoreHandler = new SplitStoreFromJavaRDDOfElements.Builder().input(javaRDD).maxSampleSize(-1).build();
    assertThatIllegalArgumentException().isThrownBy(() -> graph.execute(splitStoreHandler, user)).withMessageContaining("maxSampleSize must be null or greater than 0");
}
Also used : SplitStoreFromJavaRDDOfElements(uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements) Test(org.junit.jupiter.api.Test)

Example 2 with SplitStoreFromJavaRDDOfElements

use of uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements in project Gaffer by gchq.

the class SplitStoreFromJavaRDDOfElementsHandlerTest method throwsExceptionWhenFractionToSampleIsGreaterThanOne.

@Test
public void throwsExceptionWhenFractionToSampleIsGreaterThanOne() throws OperationException {
    final SplitStoreFromJavaRDDOfElements splitStoreHandler = new SplitStoreFromJavaRDDOfElements.Builder().input(javaRDD).fractionToSample(1.000000001d).build();
    assertThatIllegalArgumentException().isThrownBy(() -> graph.execute(splitStoreHandler, user)).withMessageContaining("fractionToSample must be null or between 0 exclusive and 1 inclusive");
}
Also used : SplitStoreFromJavaRDDOfElements(uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements) Test(org.junit.jupiter.api.Test)

Example 3 with SplitStoreFromJavaRDDOfElements

use of uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements in project Gaffer by gchq.

the class SplitStoreFromJavaRDDOfElementsHandlerTest method throwsExceptionWhenNumSplitPointsIsLessThanOne.

@Test
public void throwsExceptionWhenNumSplitPointsIsLessThanOne() throws OperationException {
    final SplitStoreFromJavaRDDOfElements splitStoreHandler = new SplitStoreFromJavaRDDOfElements.Builder().input(javaRDD).numSplits(-1).build();
    assertThatIllegalArgumentException().isThrownBy(() -> graph.execute(splitStoreHandler, user)).withMessageContaining("numSplits must be null or greater than 0");
}
Also used : SplitStoreFromJavaRDDOfElements(uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements) Test(org.junit.jupiter.api.Test)

Example 4 with SplitStoreFromJavaRDDOfElements

use of uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements in project Gaffer by gchq.

the class SplitStoreFromJavaRDDOfElementsHandlerTest method throwsExceptionWhenFractionToSampleIsZero.

@Test
public void throwsExceptionWhenFractionToSampleIsZero() throws OperationException {
    final SplitStoreFromJavaRDDOfElements splitStoreHandler = new SplitStoreFromJavaRDDOfElements.Builder().input(javaRDD).fractionToSample(0d).build();
    assertThatIllegalArgumentException().isThrownBy(() -> graph.execute(splitStoreHandler, user)).withMessageContaining("fractionToSample must be null or between 0 exclusive and 1 inclusive");
}
Also used : SplitStoreFromJavaRDDOfElements(uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements) Test(org.junit.jupiter.api.Test)

Example 5 with SplitStoreFromJavaRDDOfElements

use of uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements in project Gaffer by gchq.

the class SplitStoreFromJavaRDDOfElementsHandlerTest method throwsExceptionWhenFractionToSampleLessThanZero.

@Test
public void throwsExceptionWhenFractionToSampleLessThanZero() throws OperationException {
    final SplitStoreFromJavaRDDOfElements splitStoreHandler = new SplitStoreFromJavaRDDOfElements.Builder().input(javaRDD).fractionToSample(-0.00000001d).build();
    assertThatIllegalArgumentException().isThrownBy(() -> graph.execute(splitStoreHandler, user)).withMessageContaining("fractionToSample must be null or between 0 exclusive and 1 inclusive");
}
Also used : SplitStoreFromJavaRDDOfElements(uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements) Test(org.junit.jupiter.api.Test)

Aggregations

SplitStoreFromJavaRDDOfElements (uk.gov.gchq.gaffer.spark.operation.javardd.SplitStoreFromJavaRDDOfElements)6 Test (org.junit.jupiter.api.Test)5 Arrays.asList (java.util.Arrays.asList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Random (java.util.Random)1 Key (org.apache.accumulo.core.data.Key)1 Text (org.apache.hadoop.io.Text)1 JavaRDD (org.apache.spark.api.java.JavaRDD)1 FlatMapFunction (org.apache.spark.api.java.function.FlatMapFunction)1 AccumuloStore (uk.gov.gchq.gaffer.accumulostore.AccumuloStore)1 AccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter)1 Pair (uk.gov.gchq.gaffer.commonutil.pair.Pair)1 Element (uk.gov.gchq.gaffer.data.element.Element)1 OperationException (uk.gov.gchq.gaffer.operation.OperationException)1 AbstractSplitStoreFromRDDOfElementsHandler (uk.gov.gchq.gaffer.sparkaccumulo.operation.handler.AbstractSplitStoreFromRDDOfElementsHandler)1 Context (uk.gov.gchq.gaffer.store.Context)1 Store (uk.gov.gchq.gaffer.store.Store)1 Schema (uk.gov.gchq.gaffer.store.schema.Schema)1