Skip to content

HANA DB: SHORTTEXT casting not supported anymore? #1027

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

Closed
lschneiderbauer opened this issue Oct 20, 2022 · 5 comments · Fixed by #1070
Closed

HANA DB: SHORTTEXT casting not supported anymore? #1027

lschneiderbauer opened this issue Oct 20, 2022 · 5 comments · Fixed by #1070
Labels
bug an unexpected problem or unintended behavior func trans 🌍 Translation of individual functions to SQL
Milestone

Comments

@lschneiderbauer
Copy link

I updated the Hana driver recently, and I noticed that some previously working dbplyr queries are failing now.

In particular, a data type conversion using as.character seems to be failing with the SQL error message

Error in `collect()`:
! Failed to collect lazy table.
Caused by error in `new_result()`:
! nanodbc/nanodbc.cpp:1412: 42000: [SAP AG][LIBODBCHDB DLL][HDBODBC] Syntax error or access violation;257 sql syntax error: incorrect syntax near "SHORTTEXT": line 1 col 27 (at pos 27) 

An explicit example which returns that error:

some_lazy_table %>% select(some_number) %>% mutate(some_text = as.character(some_number))

which generates the SQL

SELECT "some_number", CAST("some_number" AS SHORTTEXT) AS "some_text"
FROM "MYSCHEMA"."some_lazy_table"

When looking up the specs for CAST, SHORTTEXT is also not mentioned as allowed data type, so I wonder if it was ever supported in the first place.

@lschneiderbauer
Copy link
Author

Or is it more likely, that that's a bug of the driver?

@hadley
Copy link
Member

hadley commented Nov 21, 2022

Can you suggest what should it be cast to instead?

@lschneiderbauer
Copy link
Author

TO_VARCHAR as well as CAST (col AS VARCHAR) works in my case.
That is my suggestion.

@hadley
Copy link
Member

hadley commented Nov 28, 2022

Would you mind provide a link to the docs of those functions?

@lschneiderbauer
Copy link
Author

lschneiderbauer commented Nov 29, 2022

I don't mind (the link is already in my initial comment):
CAST
TO_VARCHAR

Or are you looking for something else?

@hadley hadley added bug an unexpected problem or unintended behavior func trans 🌍 Translation of individual functions to SQL labels Dec 5, 2022
@hadley hadley added this to the 2.3.0 milestone Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior func trans 🌍 Translation of individual functions to SQL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants