Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with top_n #6

Open
earino opened this issue Sep 23, 2015 · 2 comments
Open

Issue with top_n #6

earino opened this issue Sep 23, 2015 · 2 comments

Comments

@earino
Copy link

earino commented Sep 23, 2015

I am now using Vertica and vRODBC, I attempt the following simple pipeline:

highlights_table %>% 
    group_by(isbn) %>% 
    summarise(count=n()) %>% 
    arrange(desc(count)) %>% 
    top_n(10) 

and I receive

1       42601 4856 ERROR 4856:  Syntax error at or near "DESC" at character 67\n

This generates the query:

> q$query
<Query> SELECT "isbn", "count"
FROM (SELECT "isbn", "count", rank("count" DESC) OVER () AS "zzz25"
FROM (SELECT "isbn", count(*) AS "count"
FROM vst_notes."highlights"
GROUP BY "isbn") AS "zzz24"
ORDER BY "count" DESC) AS "zzz26"
WHERE "zzz25" <= 10.0
ORDER BY "count" DESC
An object of class "VerticaConnection"
Slot "conn":
vRODBC Connection 6
Details:
  case=nochange
  DSN=devvertica

Slot "type":
[1] "ODBC"

Which is invalid SQL. Is top_n not implemented?

@earino
Copy link
Author

earino commented Sep 23, 2015

FYI, I know I shouldn't name the variable "count", so here is an example where I call it: "mysuperspecialvariable":

> highlights_table %>% group_by(isbn) %>% summarise(mysuperspecialvariable=n()) %>% top_n(10) 
Selecting by mysuperspecialvariable
Source: Vertica ODBC Connection
-----+DSN: devvertica
-----+Host: LVICVERTICAT01
-----+DB Version: 07.01.0002
-----+ODBC Version: 03.80
From: <derived table> [?? x 2]
Filter: min_rank(desc(mysuperspecialvariable)) <= 10 

   X.42601.4856.ERROR.4856...Syntax.error.at.or.near...DESC...at.character.118.n.
                                                                           (fctr)
1       42601 4856 ERROR 4856:  Syntax error at or near "DESC" at character 118\n
..                                                                            ...
Variables not shown:
  X..vRODBC..ERROR..Could.not.SQLExecDirect..SELECT...isbn......mysuperspecialvariable...nFROM..SELECT...isbn......mysuperspecialvariable....rank...mysuperspecialvariable...DESC..OVER....AS...zzz63...nFROM..SELECT...isbn....count....AS...mysuperspecial
  ... (fctr)

@etduwx
Copy link
Contributor

etduwx commented Sep 23, 2015

@earino ,

Thanks for reporting this; I'll take a look.

Best,
Ed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants