Changeset: e2957eceda25 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e2957eceda25
Modified Files:
clients/R/MonetDB.R/NEWS
clients/R/MonetDB.R/R/dbi.R
clients/R/Tests/dbi.R
clients/R/Tests/dplyr.R
Branch: default
Log Message:
R Conncetor: test case update and quoting revert
diffs (127 lines):
diff --git a/clients/R/MonetDB.R/NEWS b/clients/R/MonetDB.R/NEWS
--- a/clients/R/MonetDB.R/NEWS
+++ b/clients/R/MonetDB.R/NEWS
@@ -1,5 +1,6 @@
0.9.9
-- dbWriteTable now quotes column names
+- dbWriteTable now quotes more reserved words as column names
+- Support for empyt MAPI result sets (Thanks, Roman)
0.9.8
- Added support for esoteric data types such as MONTH_INTERVAL (Thanks, Roman)
diff --git a/clients/R/MonetDB.R/R/dbi.R b/clients/R/MonetDB.R/R/dbi.R
--- a/clients/R/MonetDB.R/R/dbi.R
+++ b/clients/R/MonetDB.R/R/dbi.R
@@ -319,7 +319,7 @@ setMethod("dbWriteTable", "MonetDBConnec
}
if (!dbExistsTable(conn, qname)) {
fts <- sapply(value, dbDataType, dbObj=conn)
- fdef <- paste('"', make.db.names(conn, names(value)), '"', fts,
collapse=', ')
+ fdef <- paste(make.db.names(conn, names(value)), fts, collapse=', ')
ct <- paste("CREATE TABLE ", qname, " (", fdef, ")", sep= '')
dbSendUpdate(conn, ct)
}
diff --git a/clients/R/Tests/dbi.R b/clients/R/Tests/dbi.R
--- a/clients/R/Tests/dbi.R
+++ b/clients/R/Tests/dbi.R
@@ -173,6 +173,13 @@ dbRollback(conn)
# this returns a column with esoteric type MONTH_INTERVAL
stopifnot(identical(1L, as.integer(dbGetQuery(con, "select cast('2015-03-02'
as date) - cast('2015-03-01' as date)")[[1]][[1]])))
+# reserved words in data frame column names
+stopifnot(dbIsValid(conn))
+dbBegin(conn)
+dbWriteTable(conn, "evilt", data.frame(year=42, month=12, day=24),
transaction=F)
+stopifnot(dbExistsTable(conn, "evilt"))
+dbRollback(conn)
+
stopifnot(dbIsValid(conn))
#thrice to catch null pointer errors
stopifnot(identical(dbDisconnect(con),TRUE))
@@ -180,12 +187,6 @@ stopifnot(!dbIsValid(conn))
stopifnot(identical(dbDisconnect(con),TRUE))
stopifnot(identical(dbDisconnect(con),TRUE))
-# reserved words in data frame column names
-stopifnot(dbIsValid(conn))
-dbBegin(conn)
-dbWriteTable(conn, "evilt", data.frame(year=42,month=12, day=24),
transaction=F)
-stopifnot(dbExistsTable(conn, "evilt"))
-dbRollback(conn)
#test merovingian control code
diff --git a/clients/R/Tests/dplyr.R b/clients/R/Tests/dplyr.R
--- a/clients/R/Tests/dplyr.R
+++ b/clients/R/Tests/dplyr.R
@@ -98,43 +98,41 @@ print(nrow(head(anti_join(player_info, h
}))
# TODO: set ops
-
# sample functions
print(nrow(sample_n(player_info, 24L)))
print(nrow(head(sample_frac(player_info, .5), n=25L)))
-
-dbWriteTable(dps$con, "mtcars", mtcars)
-my_tbl <- tbl(dps, "mtcars")
-
-# https://github.com/hadley/dplyr/issues/1165
-my_tbl %>%
- group_by( cyl , gear ) %>%
- summarise( n = n() )
-
-# this works fin
-my_tbl %>%
- group_by( cyl , gear ) %>%
- summarise( n = n() )
-
-my_tbl %>%
- group_by( cyl , gear ) %>%
- tally %>%
- group_by( cyl ) %>%
- mutate( pct = ( 100 * n ) / sum( n ) )
-
-my_tbl %>%
- group_by( cyl , gear ) %>%
- summarise( n = n() ) %>%
- mutate( pct = 100 * n / sum( n ) )
-
-dbRemoveTable(dps$con, "mtcars")
-
-
# Arbitrary SQL -------------------------------------------------------------
# You can also provide sql as is, using the sql function:
batting2008 <- tbl(dps,
sql('SELECT * FROM "Batting" WHERE "yearID" = 2008'))
nrow(head(batting2008, n=26L))
+# https://github.com/hadley/dplyr/issues/1165
+dbWriteTable(dps$con, "mtcars", mtcars)
+my_tbl <- tbl(dps, "mtcars")
+
+my_tbl %>%
+ group_by( cyl , gear ) %>%
+ summarise( n = n())
+
+# this works fine
+my_tbl %>%
+ group_by( cyl , gear ) %>%
+ summarise( n = n())
+
+# my_tbl %>%
+# group_by( cyl , gear ) %>%
+# tally %>%
+# group_by( cyl ) %>%
+# mutate( pct = ( 100 * n ) / sum( n ) )
+
+# my_tbl %>%
+# group_by( cyl , gear ) %>%
+# summarise( n = n() ) %>%
+# mutate( pct = 100 * n / sum( n ) )
+
+dbRemoveTable(dps$con, "mtcars")
+
+
print("SUCCESS")
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list