[teiid-issues] [JBoss JIRA] (TEIID-2848) MongoDB: Provide Array support
Ramesh Reddy (JIRA)
issues at jboss.org
Tue Sep 9 19:21:19 EDT 2014
[ https://issues.jboss.org/browse/TEIID-2848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000624#comment-13000624 ]
Ramesh Reddy commented on TEIID-2848:
-------------------------------------
You need to use Object[] there like
{code}
CREATE FOREIGN TABLE Customer (
customer_id integer,
FirstName varchar(25),
LastName varchar(25),
Score object[],
PRIMARY KEY (FirstName, LastName)
) OPTIONS(UPDATABLE 'TRUE');
{code}
here you can use
{code}
select * from Customer
{code}
If you want to decode the each element of the Object[] then you need to use the ARRAYTABLE, for Ex:
{code}
select c.customer_id, c.FirstName, c.LastName, x,col1, x,col2, x.col3 FROM (select customer_id, FirstName, LastName, Score) c, ARRATTABLE(c.Score COLUMNS col1 integer, col2 string, col3 double) x
{code}
If you want, you can create a view out the above SQL and normalize the schema.
> MongoDB: Provide Array support
> -------------------------------
>
> Key: TEIID-2848
> URL: https://issues.jboss.org/browse/TEIID-2848
> Project: Teiid
> Issue Type: Enhancement
> Components: Misc. Connectors
> Reporter: Ramesh Reddy
> Assignee: Ramesh Reddy
> Labels: CR1
> Fix For: 8.8, 8.7.1
>
>
> Provide array support for primitive data types in MongoDB translator. The arrays are supported but as embedded documents in the one-2-many situation.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
More information about the teiid-issues
mailing list