Skip to content

Commit 1755012

Browse files
committed
Merge branch 'master' of https://github.com/0xdata/h2o
2 parents b94e554 + 6580638 commit 1755012

File tree

3 files changed

+57
-7
lines changed

3 files changed

+57
-7
lines changed

R/tests/testdir_munging/exec/runit_NOPASS_pub-685.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f")))
33
source('../../findNSourceUtils.R')
44

55
# use this for interactive setup
6-
library(h2o)
7-
library(testthat)
8-
h2o.setLogPath(getwd(), "Command")
9-
h2o.setLogPath(getwd(), "Error")
10-
h2o.startLogging()
11-
conn = h2o.init()
6+
# library(h2o)
7+
# library(testthat)
8+
# h2o.setLogPath(getwd(), "Command")
9+
# h2o.setLogPath(getwd(), "Error")
10+
# h2o.startLogging()
11+
# conn = h2o.init()
1212

1313

1414
test.apply <- function(conn) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f")))
3+
source('../../findNSourceUtils.R')
4+
5+
# use this for interactive setup
6+
# library(h2o)
7+
# library(testthat)
8+
# h2o.setLogPath(getwd(), "Command")
9+
# h2o.setLogPath(getwd(), "Error")
10+
# h2o.startLogging()
11+
# conn = h2o.init()
12+
13+
14+
test.apply_w_quantile <- function(conn) {
15+
16+
a_initial = as.data.frame(cbind(
17+
c(1,0,1,0,1,0,1,0,1,0),
18+
c(2,2,2,2,2,2,2,2,2,2),
19+
c(3,3,3,3,3,3,3,3,3,3),
20+
c(3,2,3,2,3,2,3,2,3,2)
21+
))
22+
23+
a = a_initial
24+
# two ways to do it
25+
26+
# func6 = function(x) { quantile(x[,1] , c(0.9) ) }
27+
func6 = function(x) { quantile(x , c(0.9) ) }
28+
# push the function to h2o also!, with same name
29+
h2o.addFunction(conn, func6)
30+
b = apply(a, c(2), func6)
31+
a.h2o <- as.h2o(conn, a_initial, key="r.hex")
32+
b.h2o = apply(a.h2o, c(2), func6)
33+
b.h2o.R = as.matrix(b.h2o)
34+
b
35+
b.h2o.R
36+
expect_that(all(b == b.h2o.R), equals(T))
37+
38+
b = apply(a, c(2), function(x) quantile(x , c(0.9) ))
39+
a.h2o <- as.h2o(conn, a_initial, key="r.hex")
40+
b.h2o = apply(a.h2o, c(2), function(x) quantile(x[,1] , c(0.9) ))
41+
b.h2o.R = as.matrix(b.h2o)
42+
b
43+
b.h2o.R
44+
expect_that(all(b == b.h2o.R), equals(T))
45+
46+
testEnd()
47+
}
48+
49+
doTest("Test for apply with quantile.", test.apply_w_quantile)
50+

py/testdir_single_jvm_fvec/test_exec2_apply_phrases.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_exec2_apply_phrases(self):
103103
# (None, "function(x) { cbind( mean(x[,1]), mean(x[,%s]) ) }" % col),
104104
(None, "func4=function(x) { mean( x[,%s]) }" % col),
105105
(None, "func5=function(x) { sd( x[,%s]) }" % col),
106-
# (None, "func6=function(x) { quantile(x[,%s] , c(0.9) ) }" % col),
106+
(None, "func6=function(x) { quantile(x[,%s] , c(0.9) ) }" % col),
107107
]
108108
for resultKey, execExpr in initList:
109109
h2e.exec_expr(h2o.nodes[0], execExpr, resultKey=resultKey, timeoutSecs=60)

0 commit comments

Comments
 (0)