[ 
https://issues.apache.org/jira/browse/JENA-595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13830770#comment-13830770
 ] 

Claude Warren commented on JENA-595:
------------------------------------

Issue with placement.

dependency apache-jena.2.11.1-SNAPSHOT.pom  backing up to apache-jean.2.11.0 
does not have this problem.

Sorry about the long queries but I haven't had time to build a smaller version 
of this problem.  

The issue is with the filter which is specified in the original query as:  
FILTER regex(?TABLE_NAME, "a", "i")
and in the query as executed as: QueryIterFilterExpr regex(?TABLE_NAME, "a", 
"i")

The statement is on line 11 of the query as executed,  ?TABLE_NAME is not 
defined there.  However in the original query the filter statement is on line 
57 near the bottom after ?TABLE_NAME is defined.

I am posting this so that others may see the issue and perhaps find a solution 
before I create a smaller test case.

===== query as executed =====

QueryIterRoot
QueryIterBlockTriples
  ?Schema·Columns <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://org.xenei.jdbc4sparql/entity/Column> .
  ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Column#table> 
?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 .
  ?v_9c77b7fe_377e_45ad_bb57_0c63b5288f64 
<http://org.xenei.jdbc4sparql/entity/Schema#tables> 
?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 .
  ?v_1d587ff0_a8e0_408e_a867_c94bbd2a164d 
<http://org.xenei.jdbc4sparql/entity/Catalog#schemas> 
?v_9c77b7fe_377e_45ad_bb57_0c63b5288f64 .
  ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Column#columnDef> 
?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb .
  ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#autoIncrement> 
?v_b1b27077_8156_4de7_a905_a00e365e7970 .
  ?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 
<http://org.xenei.jdbc4sparql/entity/Table#column> 
?v_66219e5b_918f_423e_bb05_b340ea2a3c80 .
  ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#autoIncrement> 
?v_b1b27077_8156_4de7_a905_a00e365e7970 .
QueryIterFilterExpr regex(?TABLE_NAME, "a", "i")
QueryIterAssign [?IS_AUTOINCREMENT] // 
{?IS_AUTOINCREMENT=if(?v_b1b27077_8156_4de7_a905_a00e365e7970, "YES", "NO")}
QueryIterBlockTriples
  ?Schema·Columns <http://www.w3.org/2000/01/rdf-schema#label> ?COLUMN_NAME .
  ?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 
<http://org.xenei.jdbc4sparql/entity/Table#column> ??0 .
QueryIterProcedure ProcedurePF 
[<http://jena.hpl.hp.com/ARQ/list#index>][_:b3][(?v_83455c85_bd47_465b_ba01_766cb8838c82
 ?Schema·Columns)]
QueryIterAssign [?ORDINAL_POSITION] // {?ORDINAL_POSITION=( 
?v_83455c85_bd47_465b_ba01_766cb8838c82 + 1 )}
QueryIterBlockTriples
  ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#type> ?DATA_TYPE .
  ?v_9c77b7fe_377e_45ad_bb57_0c63b5288f64 
<http://www.w3.org/2000/01/rdf-schema#label> ?TABLE_SCHEM .
  ?v_1d587ff0_a8e0_408e_a867_c94bbd2a164d 
<http://www.w3.org/2000/01/rdf-schema#label> ?TABLE_CAT .
  ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Column#remarks> ?REMARKS 
.
  ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#nullable> ?NULLABLE .
  ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#scale> ?COLUMN_SIZE .
  ?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 
<http://www.w3.org/2000/01/rdf-schema#label> ?TABLE_NAME .
QueryIterOptionalIndex
  (bgp (triple ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#typeName> ?TYPE_NAME))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?BUFFER_LENGTH))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?DECIMAL_DIGITS))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?NUM_PREC_RADIX))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?COLUMN_DEF))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SQL_DATA_TYPE))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SQL_DATETIME_SUB))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?CHAR_OCTET_LENGTH))
QueryIterOptionalIndex
  (extend ((?IS_NULLABLE (if (= ?v_2efdeb94_4d80_429f_9fd0_fe24bb6e5593 1) 
"YES" (if (= ?v_2efdeb94_4d80_429f_9fd0_fe24bb6e5593 0) "NO" ""))))
    (bgp (triple ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#nullable> 
?v_2efdeb94_4d80_429f_9fd0_fe24bb6e5593)))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SCOPE_CATLOG))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SCOPE_SCHEMA))
QueryIterOptionalIndex
  (bgp (triple ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SCOPE_TABLE))
QueryIterOptionalIndex
  (bgp (triple ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#type> ?SOURCE_DATA_TYPE))
QueryIterProject ?TABLE_CAT ?TABLE_SCHEM ?TABLE_NAME ?COLUMN_NAME ?DATA_TYPE 
?TYPE_NAME ?COLUMN_SIZE ?BUFFER_LENGTH ?DECIMAL_DIGITS ?NUM_PREC_RADIX 
?NULLABLE ?REMARKS ?COLUMN_DEF ?SQL_DATA_TYPE ?SQL_DATETIME_SUB 
?CHAR_OCTET_LENGTH ?ORDINAL_POSITION ?IS_NULLABLE ?SCOPE_CATLOG ?SCOPE_SCHEMA 
?SCOPE_TABLE ?SOURCE_DATA_TYPE ?IS_AUTOINCREMENT
QueryIterDistinct

===== original query =====

SELECT DISTINCT  ?TABLE_CAT ?TABLE_SCHEM ?TABLE_NAME ?COLUMN_NAME ?DATA_TYPE 
?TYPE_NAME ?COLUMN_SIZE ?BUFFER_LENGTH ?DECIMAL_DIGITS ?NUM_PREC_RADIX 
?NULLABLE ?REMARKS ?COLUMN_DEF ?SQL_DATA_TYPE ?SQL_DATETIME_SUB 
?CHAR_OCTET_LENGTH ?ORDINAL_POSITION ?IS_NULLABLE ?SCOPE_CATLOG ?SCOPE_SCHEMA 
?SCOPE_TABLE ?SOURCE_DATA_TYPE ?IS_AUTOINCREMENT
WHERE
  { { { ?Schema·Columns <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://org.xenei.jdbc4sparql/entity/Column> .
        ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Column#table> 
?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 .
        ?v_9c77b7fe_377e_45ad_bb57_0c63b5288f64 
<http://org.xenei.jdbc4sparql/entity/Schema#tables> 
?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 .
        ?v_1d587ff0_a8e0_408e_a867_c94bbd2a164d 
<http://org.xenei.jdbc4sparql/entity/Catalog#schemas> 
?v_9c77b7fe_377e_45ad_bb57_0c63b5288f64 .
        ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Column#columnDef> 
?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb .
        ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#autoIncrement> 
?v_b1b27077_8156_4de7_a905_a00e365e7970 .
        ?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 
<http://org.xenei.jdbc4sparql/entity/Table#column> 
?v_66219e5b_918f_423e_bb05_b340ea2a3c80 .
        ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#autoIncrement> 
?v_b1b27077_8156_4de7_a905_a00e365e7970
        BIND(if(?v_b1b27077_8156_4de7_a905_a00e365e7970, "YES", "NO") AS 
?IS_AUTOINCREMENT)
        ?Schema·Columns <http://www.w3.org/2000/01/rdf-schema#label> 
?COLUMN_NAME .
        ?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 
<http://org.xenei.jdbc4sparql/entity/Table#column> _:b0 .
        _:b0 <http://jena.hpl.hp.com/ARQ/list#index> _:b1 .
        _:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> 
?v_83455c85_bd47_465b_ba01_766cb8838c82 .
        _:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
        _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ?Schema·Columns 
.
        _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>
        BIND(( ?v_83455c85_bd47_465b_ba01_766cb8838c82 + 1 ) AS 
?ORDINAL_POSITION)
        ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#type> ?DATA_TYPE .
        ?v_9c77b7fe_377e_45ad_bb57_0c63b5288f64 
<http://www.w3.org/2000/01/rdf-schema#label> ?TABLE_SCHEM .
        ?v_1d587ff0_a8e0_408e_a867_c94bbd2a164d 
<http://www.w3.org/2000/01/rdf-schema#label> ?TABLE_CAT .
        ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Column#remarks> 
?REMARKS .
        ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#nullable> ?NULLABLE .
        ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#scale> ?COLUMN_SIZE .
        ?v_5a48766a_eca1_4a8d_b77b_29f7728f63c9 
<http://www.w3.org/2000/01/rdf-schema#label> ?TABLE_NAME
      }
      OPTIONAL
        { ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#typeName> ?TYPE_NAME }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?BUFFER_LENGTH }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?DECIMAL_DIGITS }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?NUM_PREC_RADIX }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?COLUMN_DEF }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SQL_DATA_TYPE }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SQL_DATETIME_SUB }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?CHAR_OCTET_LENGTH }
      OPTIONAL
        { ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#nullable> 
?v_2efdeb94_4d80_429f_9fd0_fe24bb6e5593
          BIND(if(( ?v_2efdeb94_4d80_429f_9fd0_fe24bb6e5593 = 1 ), "YES", if(( 
?v_2efdeb94_4d80_429f_9fd0_fe24bb6e5593 = 0 ), "NO", "")) AS ?IS_NULLABLE)
        }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SCOPE_CATLOG }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SCOPE_SCHEMA }
      OPTIONAL
        { ?Schema·Columns <http://org.xenei.jdbc4sparql/entity/Table#null> 
?SCOPE_TABLE }
      OPTIONAL
        { ?v_c6a6279a_82c1_480a_bfd3_98d99fe375fb 
<http://org.xenei.jdbc4sparql/entity/ColumnDef#type> ?SOURCE_DATA_TYPE }
    }
    FILTER regex(?TABLE_NAME, "a", "i")
  }
ORDER BY ASC(?TABLE_CAT) ASC(?TABLE_SCHEM) ASC(?TABLE_NAME) 
ASC(?ORDINAL_POSITION)




> Improve filter placement optimization
> -------------------------------------
>
>                 Key: JENA-595
>                 URL: https://issues.apache.org/jira/browse/JENA-595
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: ARQ
>            Reporter: Andy Seaborne
>            Assignee: Andy Seaborne
>         Attachments: JENA-595-FilterPlacement.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to