Skip to content

Commit

Permalink
don't keep the temporary frames from the head and tail call
Browse files Browse the repository at this point in the history
  • Loading branch information
spennihana committed Jul 25, 2014
1 parent f0cfd44 commit b4a9a78
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions R/h2o-package/R/Classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -1108,15 +1108,10 @@ head.H2OParsedData <- function(x, n = 6L, ...) {
stopifnot(length(n) == 1L)
n <- ifelse(n < 0L, max(numRows + n, 0L), min(n, numRows))
if(n == 0) return(data.frame())

x.slice = as.data.frame(x[seq_len(n),])
# if(ncol(x) > .MAX_INSPECT_COL_VIEW)
# warning(x@key, " has greater than ", .MAX_INSPECT_COL_VIEW, " columns. This may take awhile...")
# res = .h2o.__remoteSend(x@h2o, .h2o.__HACK_LEVELS2, source = x@key, max_ncols = .Machine$integer.max)
# for(i in 1:ncol(x)) {
# if(!is.null(res$levels[[i]]))
# x.slice[,i] <- factor(x.slice[,i], levels = res$levels[[i]])
# }

tmp_head <- x[seq_len(n),]
x.slice = as.data.frame(tmp_head)
h2o.rm(tmp_head@h2o, tmp_head@key)
return(x.slice)
}

Expand All @@ -1127,16 +1122,10 @@ tail.H2OParsedData <- function(x, n = 6L, ...) {
if(n == 0) return(data.frame())

idx <- seq.int(to = nrx, length.out = n)
x.slice <- as.data.frame(x[idx,])
tmp_tail <- x[idx,]
x.slice <- as.data.frame(tmp_tail)
h2o.rm(tmp_tail@h2o, tmp_tail@key)
rownames(x.slice) <- idx

# if(ncol(x) > .MAX_INSPECT_COL_VIEW)
# warning(x@key, " has greater than ", .MAX_INSPECT_COL_VIEW, " columns. This may take awhile...")
# res = .h2o.__remoteSend(x@h2o, .h2o.__HACK_LEVELS2, source = x@key, max_ncols = .Machine$integer.max)
# for(i in 1:ncol(x)) {
# if(!is.null(res$levels[[i]]))
# x.slice[,i] <- factor(x.slice[,i], levels = res$levels[[i]])
# }
return(x.slice)
}

Expand Down

0 comments on commit b4a9a78

Please sign in to comment.