[teiid-issues] [JBoss JIRA] Commented: (TEIID-1283) Race condition results in bad resultset for query on union

Howard Abrams (JIRA) jira-events at lists.jboss.org
Thu Oct 14 19:40:39 EDT 2010


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

Howard Abrams commented on TEIID-1283:
--------------------------------------

Sorry for the delay; I wasn't notified of your comment.

Here is the actual code, but I don't think it will be any more help than my example code:

                PreparedStatement prep = this.connection.prepareStatement("SELECT name, visibleName, headerTemplate FROM metadata.objects WHERE name=?");
                prep.setString(1, name);
                ResultSet r = prep.executeQuery();
                if (r.next())
                {
                    rval.setName(r.getString(1));

Here is the query plan:

SortNode
  + Output Columns:
    0: name (string)
    1: visibleName (string)
    2: headerTemplate (string)
  + Statistics:
    0: Node Output Rows: 1
    1: Node Process Time: 0
    2: Node Cumulative Process Time: 0
    3: Node Cumulative Next Batch Process Time: 2
    4: Node Next Batch Calls: 2
    5: Node Blocks: 1
  + Cost Estimates:Estimated Node Cardinality: -1.0
  + Child 0:
    UnionAllNode
      + Output Columns:
        0: name (string)
        1: visibleName (string)
        2: headerTemplate (string)
      + Statistics:
        0: Node Output Rows: 1
        1: Node Process Time: 0
        2: Node Cumulative Process Time: 0
        3: Node Cumulative Next Batch Process Time: 1
        4: Node Next Batch Calls: 4
        5: Node Blocks: 3
      + Child 0:
        ProjectNode
          + Output Columns:
            0: name (string)
            1: visibleName (string)
            2: headerTemplate (string)
          + Statistics:
            0: Node Output Rows: 1
            1: Node Process Time: 0
            2: Node Cumulative Process Time: 2
            3: Node Cumulative Next Batch Process Time: 1
            4: Node Next Batch Calls: 2
            5: Node Blocks: 1
          + Cost Estimates:Estimated Node Cardinality: -1.0
          + Child 0:
            JoinNode
              + Output Columns:
                0: name (string)
                1: visibleName (string)
                2: headerTemplate (string)
              + Statistics:
                0: Node Output Rows: 1
                1: Node Process Time: 1
                2: Node Cumulative Process Time: 2
                3: Node Cumulative Next Batch Process Time: 1
                4: Node Next Batch Calls: 2
                5: Node Blocks: 1
              + Cost Estimates:Estimated Node Cardinality: -1.0
              + Child 0:
                ProjectNode
                  + Output Columns:file (clob)
                  + Statistics:
                    0: Node Output Rows: 1
                    1: Node Process Time: 0
                    2: Node Cumulative Process Time: 1
                    3: Node Cumulative Next Batch Process Time: 0
                    4: Node Next Batch Calls: 2
                    5: Node Blocks: 1
                  + Cost Estimates:Estimated Node Cardinality: -1.0
                  + Child 0:
                    AccessNode
                      + Output Columns:
                        0: file (clob)
                        1: filePath (string)
                      + Statistics:
                        0: Node Output Rows: 1
                        1: Node Process Time: 1
                        2: Node Cumulative Process Time: 1
                        3: Node Cumulative Next Batch Process Time: 0
                        4: Node Next Batch Calls: 2
                        5: Node Blocks: 1
                      + Cost Estimates:Estimated Node Cardinality: -1.0
                      + Query:EXEC file.getTextFiles('metadata-objects.txt')
                      + Model Name:file
                  + Select Columns:file.getTextFiles.ResultSet.file
              + Child 1:
                SelectNode
                  + Output Columns:
                    0: name (string)
                    1: visibleName (string)
                    2: headerTemplate (string)
                  + Statistics:
                    0: Node Output Rows: 1
                    1: Node Process Time: 0
                    2: Node Cumulative Process Time: 1
                    3: Node Cumulative Next Batch Process Time: 1
                    4: Node Next Batch Calls: 1
                    5: Node Blocks: 0
                  + Cost Estimates:Estimated Node Cardinality: -1.0
                  + Child 0:
                    TextTableNode
                      + Output Columns:
                        0: name (string)
                        1: visibleName (string)
                        2: headerTemplate (string)
                      + Statistics:
                        0: Node Output Rows: 5
                        1: Node Process Time: 1
                        2: Node Cumulative Process Time: 1
                        3: Node Cumulative Next Batch Process Time: 1
                        4: Node Next Batch Calls: 1
                        5: Node Blocks: 0
                      + Cost Estimates:Estimated Node Cardinality: -1.0
                  + Criteria:OBJECTS.name = 'preferences.preference'
              + Join Strategy:NESTED TABLE JOIN
              + Join Type:CROSS JOIN
              + Join Criteria
          + Select Columns:
            0: OBJECTS.name
            1: OBJECTS.visibleName
            2: OBJECTS.headerTemplate
      + Child 1:
        AccessNode
          + Output Columns:
            0: NAME (string)
            1: VISIBLE_NAME (string)
            2: HEADERTEMPLATE (string)
          + Statistics:
            0: Node Output Rows: 0
            1: Node Process Time: 0
            2: Node Cumulative Process Time: 0
            3: Node Cumulative Next Batch Process Time: 0
            4: Node Next Batch Calls: 3
            5: Node Blocks: 3
          + Cost Estimates:Estimated Node Cardinality: -1.0
          + Query:SELECT cia_metadata.CHORUS_META_OBJECT.NAME, cia_metadata.CHORUS_META_OBJECT.VISIBLE_NAME, cia_metadata.CHORUS_META_OBJECT.HEADERTEMPLATE FROM cia_metadata.CHORUS_META_OBJECT WHERE cia_metadata.CHORUS_META_OBJECT.NAME = 'preferences.preference'
          + Model Name:cia_metadata
  + Sort Mode:DUP_REMOVE


> Race condition results in bad resultset for query on union
> ----------------------------------------------------------
>
>                 Key: TEIID-1283
>                 URL: https://jira.jboss.org/browse/TEIID-1283
>             Project: Teiid
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: 7.1
>         Environment: MaxOS 10.6.4, JBoss 5.1.0
>            Reporter: Howard Abrams
>            Assignee: Steven Hawkins
>
> Take a table, call it 'A', in a physical model backed by a database (DB2 on Z/OS in this case)
> Take a view, call it 'B', backed by a file connector
> From JDBC, make the query:
> Select * from (select * from A union select * from B) where foo='bar'. 
> where 'bar' is only found in B, not A.
> Execute the query get back a resultset:
> ResultSet r = statement.executeQuery();
> but this code will fail with a "resultset cursor is after the last row"
> if ( r.next )
> String foo = r.getString(1);
> but this code will work correctly:
> Thread.sleep(1000);
> if ( r.next )
> String foo = r.getString(1);
> Putting the union in a materialized view also works.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the teiid-issues mailing list