Skip to content

Commit

Permalink
get dim_desc from trunc_mat
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Müller committed Mar 18, 2016
1 parent 3a77c13 commit ae91470
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/tbl-sql.r
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ as.data.frame.tbl_sql <- function(x, row.names = NULL, optional = NULL,

#' @export
print.tbl_sql <- function(x, ..., n = NULL, width = NULL) {
cat("Source: query ", dim_desc(x), "\n", sep = "")
cat("Source: query ")
xm <- trunc_mat(x, n = n, width = width)
cat(dim_desc(xm), "\n", sep = "")

This comment has been minimized.

Copy link
@hadley

hadley Mar 18, 2016

Doesn't this mean it always prints the size of the retrieved table? i.e. we lose the fact that the complete number of rows is not known.

This comment has been minimized.

Copy link
@krlmlr

krlmlr Mar 18, 2016

Owner

dim_desc() would be a generic and do the right thing for trunc_mat objects.

This comment has been minimized.

Copy link
@hadley

hadley Mar 18, 2016

I don't like this approach

This comment has been minimized.

Copy link
@krlmlr

krlmlr Mar 18, 2016

Owner

I've had a hard time understanding why. If you could be a bit more specific...


cat("Database: ", src_desc(x$src), "\n", sep = "")

grps <- op_grps(x$ops)
Expand All @@ -64,7 +67,7 @@ print.tbl_sql <- function(x, ..., n = NULL, width = NULL) {

cat("\n")

print(trunc_mat(x, n = n, width = width))
print(xm)
invisible(x)
}

Expand Down

0 comments on commit ae91470

Please sign in to comment.