[jira] [Commented] (TRAFODION-1858) RI predicate generating string should not contain _SALT_ column

2016-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TRAFODION-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15184331#comment-15184331
 ] 

ASF GitHub Bot commented on TRAFODION-1858:
---

Github user asfgit closed the pull request at:

https://github.com/apache/incubator-trafodion/pull/347


> RI predicate generating string should not contain _SALT_ column
> ---
>
> Key: TRAFODION-1858
> URL: https://issues.apache.org/jira/browse/TRAFODION-1858
> Project: Apache Trafodion
>  Issue Type: Bug
>Reporter: liu ming
>Assignee: liu ming
>
> When table created with SALT, it cannot be used in a foreign key reference.
> To reproduce:
> >>CREATE TABLE a ( id int not null, PRIMARY KEY (id))SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>CREATE TABLE b ( id int not null, val int,
> +>  PRIMARY KEY (id),
> +>  CONSTRAINT FK FOREIGN KEY (val) REFERENCES a (id))
> +>SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>INSERT INTO a values(1);
> --- 1 row(s) inserted.
> >>INSERT INTO b values(1,1);
> *** ERROR[15001] A syntax error occurred at or before: 
> ("NEW@".VAL)=(TRAFODION.SEABASE.A."_SALT_",TRAFODION.SEABASE.A.ID);
>   ^ (43 characters from start of SQL 
> statement)
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TRAFODION-1858) RI predicate generating string should not contain _SALT_ column

2016-03-07 Thread liu ming (JIRA)

[ 
https://issues.apache.org/jira/browse/TRAFODION-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15184182#comment-15184182
 ] 

liu ming commented on TRAFODION-1858:
-

TRAFODION-1880 is created for same issue and replace this JIRA.
This JIRA will be closed with a temp ,simple solution.
TRAFODION-1880 will track the effort to find a complete total solution to this 
kind of issue.

> RI predicate generating string should not contain _SALT_ column
> ---
>
> Key: TRAFODION-1858
> URL: https://issues.apache.org/jira/browse/TRAFODION-1858
> Project: Apache Trafodion
>  Issue Type: Bug
>Reporter: liu ming
>Assignee: liu ming
>
> When table created with SALT, it cannot be used in a foreign key reference.
> To reproduce:
> >>CREATE TABLE a ( id int not null, PRIMARY KEY (id))SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>CREATE TABLE b ( id int not null, val int,
> +>  PRIMARY KEY (id),
> +>  CONSTRAINT FK FOREIGN KEY (val) REFERENCES a (id))
> +>SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>INSERT INTO a values(1);
> --- 1 row(s) inserted.
> >>INSERT INTO b values(1,1);
> *** ERROR[15001] A syntax error occurred at or before: 
> ("NEW@".VAL)=(TRAFODION.SEABASE.A."_SALT_",TRAFODION.SEABASE.A.ID);
>   ^ (43 characters from start of SQL 
> statement)
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TRAFODION-1858) RI predicate generating string should not contain _SALT_ column

2016-02-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TRAFODION-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15173031#comment-15173031
 ] 

ASF GitHub Bot commented on TRAFODION-1858:
---

Github user zellerh commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/347#discussion_r54508297
  
--- Diff: core/sql/optimizer/BindRI.cpp ---
@@ -417,12 +450,18 @@ void RefConstraint::getPredicateText(NAString ,
 NAString *corrName) const
 {
   NAString tblText = ( (corrName == NULL) ? 
tblName.getQualifiedNameAsAnsiString() : *corrName);
+  int pos= 0;
   text += "(";
   for (CollIndex i = 0; i < keyColumns.entries(); i++)
 {
-  if (i)
+  if(isHiddenColumn(keyColumns[i]->getColName()) )
--- End diff --

Yes, I agree. There are more methods in NAColumn, These names can change 
and users can choose their own name for the division columns if they like 
(although I would not recommend that). Why are we excluding salt and division 
here? It would be best to choose the right one of the many methods in NAColumn:

  isUserColumn()
  isSystemColumn()
  isSyskeyColumn()
  isIdentityColumn()
  isIdentityColumnByDefault()
  isIdentityColumnAlways()
  isComputedColumn()
  isComputedColumnAlways()
 


> RI predicate generating string should not contain _SALT_ column
> ---
>
> Key: TRAFODION-1858
> URL: https://issues.apache.org/jira/browse/TRAFODION-1858
> Project: Apache Trafodion
>  Issue Type: Bug
>Reporter: liu ming
>Assignee: liu ming
>
> When table created with SALT, it cannot be used in a foreign key reference.
> To reproduce:
> >>CREATE TABLE a ( id int not null, PRIMARY KEY (id))SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>CREATE TABLE b ( id int not null, val int,
> +>  PRIMARY KEY (id),
> +>  CONSTRAINT FK FOREIGN KEY (val) REFERENCES a (id))
> +>SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>INSERT INTO a values(1);
> --- 1 row(s) inserted.
> >>INSERT INTO b values(1,1);
> *** ERROR[15001] A syntax error occurred at or before: 
> ("NEW@".VAL)=(TRAFODION.SEABASE.A."_SALT_",TRAFODION.SEABASE.A.ID);
>   ^ (43 characters from start of SQL 
> statement)
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TRAFODION-1858) RI predicate generating string should not contain _SALT_ column

2016-02-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TRAFODION-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15172728#comment-15172728
 ] 

ASF GitHub Bot commented on TRAFODION-1858:
---

Github user selvaganesang commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/347#discussion_r5447
  
--- Diff: core/sql/optimizer/BindRI.cpp ---
@@ -417,12 +450,18 @@ void RefConstraint::getPredicateText(NAString ,
 NAString *corrName) const
 {
   NAString tblText = ( (corrName == NULL) ? 
tblName.getQualifiedNameAsAnsiString() : *corrName);
+  int pos= 0;
   text += "(";
   for (CollIndex i = 0; i < keyColumns.entries(); i++)
 {
-  if (i)
+  if(isHiddenColumn(keyColumns[i]->getColName()) )
--- End diff --

Wonder if we can use isSystemColumn() instead. SystemColumn includes SYSKEY 
column also. Also there is a method isSysKeyColumn(), just in case you want to 
allow SYSKEY COLUMN.


> RI predicate generating string should not contain _SALT_ column
> ---
>
> Key: TRAFODION-1858
> URL: https://issues.apache.org/jira/browse/TRAFODION-1858
> Project: Apache Trafodion
>  Issue Type: Bug
>Reporter: liu ming
>Assignee: liu ming
>
> When table created with SALT, it cannot be used in a foreign key reference.
> To reproduce:
> >>CREATE TABLE a ( id int not null, PRIMARY KEY (id))SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>CREATE TABLE b ( id int not null, val int,
> +>  PRIMARY KEY (id),
> +>  CONSTRAINT FK FOREIGN KEY (val) REFERENCES a (id))
> +>SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>INSERT INTO a values(1);
> --- 1 row(s) inserted.
> >>INSERT INTO b values(1,1);
> *** ERROR[15001] A syntax error occurred at or before: 
> ("NEW@".VAL)=(TRAFODION.SEABASE.A."_SALT_",TRAFODION.SEABASE.A.ID);
>   ^ (43 characters from start of SQL 
> statement)
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TRAFODION-1858) RI predicate generating string should not contain _SALT_ column

2016-02-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TRAFODION-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15172207#comment-15172207
 ] 

ASF GitHub Bot commented on TRAFODION-1858:
---

Github user DaveBirdsall commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/347#discussion_r54446568
  
--- Diff: core/sql/optimizer/BindRI.cpp ---
@@ -408,6 +408,39 @@ void 
RefConstraint::getMatchOptionPredicateText(NAString ,
   text += ")";
 }
 
+//helper function to check if the given column name is reserved hidden 
coloum
+static NABoolean isHiddenColumn(const char *colname)
+{
+  int len = strlen(colname);
+  if(strcmp(colname , "_SALT_") ==0) 
+return TRUE;
+  //check for DIVISION column
+  //pattern _DIVISION_%d_
+  //must longer than 12
+  if(len >= 12) {
+//must end with _
+if(colname[len] == '_')
--- End diff --

colname[len] will always be '\0' since len is the strlen of colname. I 
think you meant, colname[len-1] here.


> RI predicate generating string should not contain _SALT_ column
> ---
>
> Key: TRAFODION-1858
> URL: https://issues.apache.org/jira/browse/TRAFODION-1858
> Project: Apache Trafodion
>  Issue Type: Bug
>Reporter: liu ming
>Assignee: liu ming
>
> When table created with SALT, it cannot be used in a foreign key reference.
> To reproduce:
> >>CREATE TABLE a ( id int not null, PRIMARY KEY (id))SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>CREATE TABLE b ( id int not null, val int,
> +>  PRIMARY KEY (id),
> +>  CONSTRAINT FK FOREIGN KEY (val) REFERENCES a (id))
> +>SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>INSERT INTO a values(1);
> --- 1 row(s) inserted.
> >>INSERT INTO b values(1,1);
> *** ERROR[15001] A syntax error occurred at or before: 
> ("NEW@".VAL)=(TRAFODION.SEABASE.A."_SALT_",TRAFODION.SEABASE.A.ID);
>   ^ (43 characters from start of SQL 
> statement)
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TRAFODION-1858) RI predicate generating string should not contain _SALT_ column

2016-02-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TRAFODION-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15171622#comment-15171622
 ] 

ASF GitHub Bot commented on TRAFODION-1858:
---

GitHub user traflm opened a pull request:

https://github.com/apache/incubator-trafodion/pull/347

[TRAFODION-1858] RI predicate generating string should not contain _S…

…ALT_ column

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/traflm/incubator-trafodion TRAFODION-1858

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafodion/pull/347.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #347


commit 4bc4e60de830279acb1784144dbfc7492250e99b
Author: Cloud User 
Date:   2016-02-29T09:13:30Z

[TRAFODION-1858] RI predicate generating string should not contain _SALT_ 
column




> RI predicate generating string should not contain _SALT_ column
> ---
>
> Key: TRAFODION-1858
> URL: https://issues.apache.org/jira/browse/TRAFODION-1858
> Project: Apache Trafodion
>  Issue Type: Bug
>Reporter: liu ming
>Assignee: liu ming
>
> When table created with SALT, it cannot be used in a foreign key reference.
> To reproduce:
> >>CREATE TABLE a ( id int not null, PRIMARY KEY (id))SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>CREATE TABLE b ( id int not null, val int,
> +>  PRIMARY KEY (id),
> +>  CONSTRAINT FK FOREIGN KEY (val) REFERENCES a (id))
> +>SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>INSERT INTO a values(1);
> --- 1 row(s) inserted.
> >>INSERT INTO b values(1,1);
> *** ERROR[15001] A syntax error occurred at or before: 
> ("NEW@".VAL)=(TRAFODION.SEABASE.A."_SALT_",TRAFODION.SEABASE.A.ID);
>   ^ (43 characters from start of SQL 
> statement)
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TRAFODION-1858) RI predicate generating string should not contain _SALT_ column

2016-02-27 Thread liu ming (JIRA)

[ 
https://issues.apache.org/jira/browse/TRAFODION-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15170648#comment-15170648
 ] 

liu ming commented on TRAFODION-1858:
-

in core/sql/optimizer/BindRI.cpp
RefConstraint::getPredicateText()
one should check the column name, if it is "_SALT_", ignore it.
I assume there are other 'hidden' column as well. Need to get a list of them.

> RI predicate generating string should not contain _SALT_ column
> ---
>
> Key: TRAFODION-1858
> URL: https://issues.apache.org/jira/browse/TRAFODION-1858
> Project: Apache Trafodion
>  Issue Type: Bug
>Reporter: liu ming
>Assignee: liu ming
>
> When table created with SALT, it cannot be used in a foreign key reference.
> To reproduce:
> >>CREATE TABLE a ( id int not null, PRIMARY KEY (id))SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>CREATE TABLE b ( id int not null, val int,
> +>  PRIMARY KEY (id),
> +>  CONSTRAINT FK FOREIGN KEY (val) REFERENCES a (id))
> +>SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>INSERT INTO a values(1);
> --- 1 row(s) inserted.
> >>INSERT INTO b values(1,1);
> *** ERROR[15001] A syntax error occurred at or before: 
> ("NEW@".VAL)=(TRAFODION.SEABASE.A."_SALT_",TRAFODION.SEABASE.A.ID);
>   ^ (43 characters from start of SQL 
> statement)
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)