Exemplo n.º 1
0
def testDoubleRDDToH2OFrame(spark, hc):
    rdd = spark.sparkContext.parallelize([0.5, 1.3333333333, 178])
    h2o_frame = hc.asH2OFrame(rdd)
    assert h2o_frame[0, 0] == 0.5
    assert pytest.approx(h2o_frame[1, 0]) == 1.3333333333
    assert h2o_frame[2, 0] == 178
    unit_test_utils.asert_h2o_frame(h2o_frame, rdd)
Exemplo n.º 2
0
def testNumericRDDtoH2OFrameWithValueTooBig(spark, hc):
    min = _jvm().Long.MIN_VALUE - 1
    max = _jvm().Long.MAX_VALUE + 1
    rdd = spark.sparkContext.parallelize([1, min, max])
    h2o_frame = hc.asH2OFrame(rdd)
    assert h2o_frame[0, 0] == str(1)
    assert h2o_frame[1, 0] == str(min)
    assert h2o_frame[2, 0] == str(max)
    unit_test_utils.asert_h2o_frame(h2o_frame, rdd)
Exemplo n.º 3
0
def testLongRDDToH2OFrame(spark, hc):
    min = _jvm().Integer.MIN_VALUE - 1
    max = _jvm().Integer.MAX_VALUE + 1
    rdd = spark.sparkContext.parallelize([1, min, max])
    h2o_frame = hc.asH2OFrame(rdd)
    assert h2o_frame[0, 0] == 1
    assert h2o_frame[1, 0] == min
    assert h2o_frame[2, 0] == max
    unit_test_utils.asert_h2o_frame(h2o_frame, rdd)
Exemplo n.º 4
0
def testStringRDDToH2OFrame(spark, hc):
    rdd = spark.sparkContext.parallelize(["a", "b", "c"])
    h2o_frame = hc.asH2OFrame(rdd)
    assert h2o_frame[0, 0] == "a"
    assert h2o_frame[2, 0] == "c"
    unit_test_utils.asert_h2o_frame(h2o_frame, rdd)
Exemplo n.º 5
0
def testBooleanRDDToH2OFrame(spark, hc):
    rdd = spark.sparkContext.parallelize([True, False, True, True, False])
    h2o_frame = hc.asH2OFrame(rdd)
    assert h2o_frame[0, 0] == 1
    assert h2o_frame[1, 0] == 0
    unit_test_utils.asert_h2o_frame(h2o_frame, rdd)
Exemplo n.º 6
0
def testIntegerRDDToH2OFrame(spark, hc):
    rdd = spark.sparkContext.parallelize([num for num in range(0, 100)])
    h2o_frame = hc.asH2OFrame(rdd)
    assert h2o_frame[0, 0] == 0
    unit_test_utils.asert_h2o_frame(h2o_frame, rdd)
Exemplo n.º 7
0
def testFloatRDDToH2OFrame(spark, hc):
    rdd = spark.sparkContext.parallelize([0.5, 1.3333333333, 178])
    h2o_frame = hc.asH2OFrame(rdd)
    assert h2o_frame[0, 0] == 0.5
    assert h2o_frame[1, 0] == 1.3333333333
    unit_test_utils.asert_h2o_frame(h2o_frame, rdd)