[teiid-issues] [JBoss JIRA] (TEIID-3621) HBase translator - UPDATE statement requires primary key

Steven Hawkins (JIRA) issues at jboss.org
Thu Aug 13 08:02:02 EDT 2015


    [ https://issues.jboss.org/browse/TEIID-3621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13097988#comment-13097988 ] 

Steven Hawkins commented on TEIID-3621:
---------------------------------------

> But the translator cannot assume that PK defined in VDB is same as the one in the Phoenix (ROW column in the HBase respectively)

It can if that is an explicit in the documentation of the translator - and will be the case if automatically importing the metadata.  There are lots of scenarios across all of translators where users can craft source metadata that isn't supported by the translator (invalid datatypes, even missing columns, etc.).  In this case if you want a different primary key, then a view should be introduced or you could just mark the username column with a unique constraint.

The caveat with removing the restriction would be to test if there is additional overhead with specifying all columns with the upsert.

> HBase translator - UPDATE statement requires primary key
> --------------------------------------------------------
>
>                 Key: TEIID-3621
>                 URL: https://issues.jboss.org/browse/TEIID-3621
>             Project: Teiid
>          Issue Type: Bug
>    Affects Versions: 8.7.1.6_2
>         Environment: Hbase: 1.1.1
> Phoenix: 4.5.0-HBase-1.1
>            Reporter: Juraj Duráni
>            Assignee: Kylin Soong
>
> The HBase translator requires table to have a primary key defined. Is the PK really needed? If the table has no PK defined, then all columns are PK. E.g. query *UPDATE hbase.SmallA SET StringNum = '555' WHERE hbase.SmallA.StringNum IS NULL* is translated as *UPSERT INTO smalla (stringnum, intkey) SELECT '555', smalla.intkey FROM smalla WHERE smalla.stringnum IS NULL* (intkey is PK). Teiid can simply add all columns (except those defined in 'SET'). 
> Yes, I know that HBase requires the PK to be defined, but what happen if a user decide to change PK in VDB [1]? It could be a problem whether PK is in VDB defined or not. 
> I suggest to add a hbase-translator-specific execution property which define PK in the source table and remove AssertionError [2].
> [1]
> *HBase table:* create table mytable(id integer primary key, nickname varchar(1))
> *Teiid table:* create table mytable(id integer, username varchar(1) primary key)
> Both, id and username, are valid PK (artificial/natural).
> [2]
> https://github.com/teiid/teiid/blob/master/connectors/translator-hbase/src/main/java/org/teiid/translator/hbase/HBaseSQLConversionVisitor.java#L72



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)



More information about the teiid-issues mailing list