calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <jh...@apache.org>
Subject Re: Mongo ObjectId to VARCHAR
Date Sun, 14 Feb 2016 18:54:28 GMT
I don’t think there is a way to do this. We need to add a feature to Calcite.

I saw you logged https://issues.apache.org/jira/browse/CALCITE-1088 and https://issues.apache.org/jira/browse/CALCITE-1089.
 Thanks for those. You set fixVersion = 1.7 but I’m going to clear that field.

Julian



> On Feb 13, 2016, at 12:11 PM, Jose Antonio Illescas del Olmo <jose.illescas@gmail.com>
wrote:
> 
> How can define a mongo json model to convert ObjectId to VARCHAR?
> 
>      cast(_MAP[\'_id\'] AS varchar(24)) AS id
> 
> throws error:
> 
>> select id from countries;
> +--------------------------+
> |            ID            |
> +--------------------------+
> java.lang.ClassCastException: org.bson.types.ObjectId cannot be cast to
> java.lang.String
> at
> org.apache.calcite.avatica.util.AbstractCursor$StringAccessor.getString(AbstractCursor.java:727)
> at
> org.apache.calcite.avatica.AvaticaResultSet.getString(AvaticaResultSet.java:236)
> at sqlline.Rows$Row.<init>(Rows.java:183)
> at sqlline.IncrementalRows.hasNext(IncrementalRows.java:63)
> at sqlline.TableOutputFormat.print(TableOutputFormat.java:33)
> at sqlline.SqlLine.print(SqlLine.java:1652)
> at sqlline.Commands.execute(Commands.java:833)
> at sqlline.Commands.sql(Commands.java:732)
> at sqlline.SqlLine.dispatch(SqlLine.java:807)
> at sqlline.SqlLine.begin(SqlLine.java:681)
> at sqlline.SqlLine.start(SqlLine.java:398)
> at sqlline.SqlLine.main(SqlLine.java:292)


Mime
View raw message