def test_rdd_float_h2o_frame(self): hc = self._hc rdd = self._spark.sparkContext.parallelize([0.5, 1.3333333333, 178]) h2o_frame = hc.as_h2o_frame(rdd) self.assertEquals(h2o_frame[0, 0], 0.5, "Value should match") self.assertEquals(h2o_frame[1, 0], 1.3333333333, "Value should match") unit_test_utils.asert_h2o_frame(self, h2o_frame, rdd)
def test_rdd_str_h2o_frame(self): hc = self._hc rdd = self._spark.sparkContext.parallelize(["a", "b", "c"]) h2o_frame = hc.as_h2o_frame(rdd) self.assertEquals(h2o_frame[0, 0], "a", "Value should match") self.assertEquals(h2o_frame[2, 0], "c", "Value should match") unit_test_utils.asert_h2o_frame(self, h2o_frame, rdd)
def test_rdd_int_h2o_frame(self): hc = self._hc rdd = self._spark.sparkContext.parallelize( [num for num in range(0, 100)]) h2o_frame = hc.as_h2o_frame(rdd) self.assertEquals(h2o_frame[0, 0], 0, "Value should match") unit_test_utils.asert_h2o_frame(self, h2o_frame, rdd)
def test_rdd_bool_to_h2o_frame(self): hc = self._hc rdd = self._spark.sparkContext.parallelize([True, False, True, True, False]) h2o_frame = hc.as_h2o_frame(rdd) self.assertEquals(h2o_frame[0, 0], 1, "Value should match") self.assertEquals(h2o_frame[1, 0], 0, "Value should match") unit_test_utils.asert_h2o_frame(self, h2o_frame, rdd)
def test_rdd_long_h2o_frame(self): hc = self._hc min = hc._jvm.Integer.MIN_VALUE - 1 max = hc._jvm.Integer.MAX_VALUE + 1 rdd = self._spark.sparkContext.parallelize([1, min, max]) h2o_frame = hc.as_h2o_frame(rdd) self.assertEquals(h2o_frame[0, 0], 1, "Value should match") self.assertEquals(h2o_frame[1, 0], min, "Value should match") self.assertEquals(h2o_frame[2, 0], max, "Value should match") unit_test_utils.asert_h2o_frame(self, h2o_frame, rdd)