You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Functions CAST and CONVERT are not fully supported. A user should be able to convert data between the following types: integer, double, [var]char, date, datetime, time.
Describe the solution you'd like
Support them according to the standard: cast, convert.
Describe alternatives you've considered STR function could be used to convert data into strings, but it also not supported.
curl -XPOST http://localhost:9200/_plugins/_sql -H 'Content-Type: application/json' -d '{"query": "SELECT cast(25.5 as varchar)"}'
{
"error": {
"reason": "There was internal problem at backend",
"details": "class com.alibaba.druid.sql.ast.expr.SQLNumberExpr cannot be cast to class com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr (com.alibaba.druid.sql.ast.expr.SQLNumberExpr and com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr are in unnamed module of loader java.net.FactoryURLClassLoader @1a01d7f0)",
"type": "ClassCastException"
},
"status": 503
}
CONVERT:
curl -XPOST http://localhost:9200/_plugins/_sql -H 'Content-Type: application/json' -d '{"query": "SELECT convert(varchar, 25.5)"}'
{
"error": {
"reason": "Invalid SQL query",
"details": "Cannot invoke \"com.alibaba.druid.sql.ast.statement.SQLTableSource.getAlias()\" because the return value of \"com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.getFrom()\" is null",
"type": "NullPointerException"
},
"status": 400
}
curl -XPOST http://localhost:9200/_plugins/_sql -H 'Content-Type: application/json' -d '{"query": "SELECT convert(double, \"25.5\")"}'
{
"error": {
"reason": "Invalid SQL query",
"details": "Cannot invoke \"com.alibaba.druid.sql.ast.statement.SQLTableSource.getAlias()\" because the return value of \"com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.getFrom()\" is null",
"type": "NullPointerException"
},
"status": 400
}
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Functions
CAST
andCONVERT
are not fully supported. A user should be able to convert data between the following types: integer, double, [var]char, date, datetime, time.Describe the solution you'd like
Support them according to the standard: cast, convert.
Describe alternatives you've considered
STR
function could be used to convert data into strings, but it also not supported.Additional context
String to float
CAST
works:But not in vice-versa:
CONVERT
:The text was updated successfully, but these errors were encountered: