You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Alex Parvulescu (JIRA)" <ji...@apache.org> on 2012/09/07 14:21:07 UTC

[jira] [Created] (OAK-295) Jackrabbit query with spaces in node names

Alex Parvulescu created OAK-295:
-----------------------------------

             Summary: Jackrabbit query with spaces in node names
                 Key: OAK-295
                 URL: https://issues.apache.org/jira/browse/OAK-295
             Project: Jackrabbit Oak
          Issue Type: Sub-task
            Reporter: Alex Parvulescu


I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.

The query that doesn't work looks like
{{select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] where ISCHILDNODE([selector], [/testroot/a b])}}

This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.

I see one of 2 issues as the coulprit
 - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
or
 - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.

thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454027#comment-13454027 ] 

Thomas Mueller commented on OAK-295:
------------------------------------

Hm, it's actually quite complicated. Simply changing the SQL2Parser so it doesn't swallows the spaces will break testGetChildrenEscapedNode, which uses: 

  select * from [nt:base] AS selector where ISCHILDNODE(selector, [/testroot/'a b']) 

That means, the SQL2 parser does need to read the path token by token and can't simply use the substring between [ and ].
                
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>            Reporter: Alex Parvulescu
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {{select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] where ISCHILDNODE([selector], [/testroot/a b])}}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Alex Parvulescu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Parvulescu updated OAK-295:
--------------------------------

    Fix Version/s: 0.6
    
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>          Components: core, query
>            Reporter: Alex Parvulescu
>            Assignee: Thomas Mueller
>             Fix For: 0.6
>
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {code}
> select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] 
> where ISCHILDNODE([selector], [/testroot/a b])
> {code}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller updated OAK-295:
-------------------------------

    Description: 
I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.

The query that doesn't work looks like
{code}
select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] 
where ISCHILDNODE([selector], [/testroot/a b])
{code}

This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.

I see one of 2 issues as the coulprit
 - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
or
 - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.

thoughts?

  was:
I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.

The query that doesn't work looks like
{{select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] where ISCHILDNODE([selector], [/testroot/a b])}}

This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.

I see one of 2 issues as the coulprit
 - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
or
 - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.

thoughts?

    
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>            Reporter: Alex Parvulescu
>            Assignee: Thomas Mueller
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {code}
> select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] 
> where ISCHILDNODE([selector], [/testroot/a b])
> {code}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OAK-295) Jackrabbit query with spaces in node names

Posted by "angela (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

angela updated OAK-295:
-----------------------

    Component/s: query
                 core
    
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>          Components: core, query
>            Reporter: Alex Parvulescu
>            Assignee: Thomas Mueller
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {code}
> select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] 
> where ISCHILDNODE([selector], [/testroot/a b])
> {code}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller resolved OAK-295.
--------------------------------

    Resolution: Fixed

Implemented in r1412128 - I believe this will break some query tests from Jackrabbit core, so we may want to discuss if the tests are valid and whether we should support a "compatibility mode" for Jackrabbit 2.x
                
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>          Components: core, query
>            Reporter: Alex Parvulescu
>            Assignee: Thomas Mueller
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {code}
> select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] 
> where ISCHILDNODE([selector], [/testroot/a b])
> {code}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454052#comment-13454052 ] 

Thomas Mueller commented on OAK-295:
------------------------------------

In the JCR 2.0 spec, there is a footnote for "SQL-legal characters": 
"See the SQL:92 rules for <regular identifier> (in ISO/IEC 9075:1992 ยง5.2 <token> and <separator>)."

According to the SQL-92 spec at http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt, a <regular identifier> seems to roughly match a Java identifier:

<regular identifier> ::= <identifier body>
<identifier body> ::= <identifier start> [ { <underscore> | <identifier part> }... ]
<identifier start> ::= !! See the Syntax Rules
<identifier part> ::= <identifier start> | <digit>

Syntax Rules
1) An <identifier start> is one of:
a) A <simple Latin letter>; or
b) A character that is identified as a letter in the character repertoire identified by the <module character set specification> or by the <character set specification>; or
c) A character that is identified as a syllable  in the character repertoire identified by the <module character set specification> or by the <character set specification>; or
d) A character that is identified as an ideograph in the character repertoire identified by the <module character set specification> or by the <character set specification>.

I think the path [/testroot/'a b'] should therefore fail to parse. That would more closely match the spec than the current behavior, which is: it is parsed as "/testroot/a b". Also, the path [/testroot/a b] should fail to parse, as well as [a[x]a]. And if I read the spec correctly, the path [/test/root] is actually also illegal, because '/' is not a legal <regular identifier>.

Of course this can cause backward compatibility problems (queries that used to work in Jackrabbit 2.x may fail in Oak).
                
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>            Reporter: Alex Parvulescu
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {{select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] where ISCHILDNODE([selector], [/testroot/a b])}}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller reassigned OAK-295:
----------------------------------

    Assignee: Thomas Mueller
    
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>            Reporter: Alex Parvulescu
>            Assignee: Thomas Mueller
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {{select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] where ISCHILDNODE([selector], [/testroot/a b])}}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454017#comment-13454017 ] 

Thomas Mueller commented on OAK-295:
------------------------------------

I think in any case the SQL2Parser shouldn't simply ignore the space in the path, I will try to fix that.

In addition to this problem, I'm not sure whether the JQOM implementation should use single quotes, and / or the JQOM implementation or the parser should escape the path using ISO 9075.
                
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>            Reporter: Alex Parvulescu
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {{select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] where ISCHILDNODE([selector], [/testroot/a b])}}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454793#comment-13454793 ] 

Thomas Mueller commented on OAK-295:
------------------------------------

I guess the JCR API spec isn't clear about this. To me, it doesn't make sense that [/test/root] shouldn't be valid, and using single quotes within brackets as in ['/test/root'] seems strange. I will try to clarify this, I have created an issue in JSR 333:

http://java.net/jira/browse/JSR_333-53

                
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>            Reporter: Alex Parvulescu
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {{select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] where ISCHILDNODE([selector], [/testroot/a b])}}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-295) Jackrabbit query with spaces in node names

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454031#comment-13454031 ] 

Thomas Mueller commented on OAK-295:
------------------------------------

I wonder whether this is a bug in the test. The JCR 2.0 spec says:

http://www.day.com/specs/jcr/2.0/6_Query.html#6.7.23%20Path

Path ::= '[' quotedPath ']' | '[' simplePath ']' | simplePath

quotedPath ::= /* A JCR Path that contains non-SQL-legal characters */
simplePath ::= /* A JCR Name that contains only SQL-legal characters */

What we seem to have in testGetChildrenEscapedNode ([/testroot/'a b']) is a mix of both. As far as I understand, according to the spec, it should be either [/testroot/a b] or ['/testroot/a b'].
                
> Jackrabbit query with spaces in node names
> ------------------------------------------
>
>                 Key: OAK-295
>                 URL: https://issues.apache.org/jira/browse/OAK-295
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>            Reporter: Alex Parvulescu
>
> I'm looking at {{SQL2PathEscapingTest#testGetChildrenApiDirect}} - one of 2 failing tests imported from the Jackrabbit query test suite.
> The query that doesn't work looks like
> {{select [selector].* from [{http://www.jcp.org/jcr/nt/1.0}base] AS [selector] where ISCHILDNODE([selector], [/testroot/a b])}}
> This query is build using the {{QueryObjectModelFactory}} but then it gets transformed to its sql2 query equivalent string and then parsed back in again, so the {{SQL2Parser}} in oak gets confused and the path {{/testroot/a b}} gets mangled into {{/testroot/ab}}.
> I see one of 2 issues as the coulprit
>  - the path is not quoted, maybe that is why the {{SQL2Parser}} can't extract it properly. In this case who should handle quoting?
> or
>  - the SQL2Parser should be able to extract the path properly, it is surrounded by [] tokens anyway.
> thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira