calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Antonio Illescas del Olmo <jose.illes...@gmail.com>
Subject Mongo ObjectId to VARCHAR
Date Sat, 13 Feb 2016 20:11:12 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message