You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Timo Nentwig (JIRA)" <ji...@apache.org> on 2011/06/16 09:49:47 UTC
[jira] [Created] (CASSANDRA-2780) sstable json convertion needs to
encode quotes
sstable json convertion needs to encode quotes
----------------------------------------------
Key: CASSANDRA-2780
URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
Project: Cassandra
Issue Type: Bug
Affects Versions: 0.8.0
Reporter: Timo Nentwig
[default@foo] set transactions[test][data]='{"foo":"bar"}';
$ cat /tmp/json
{
"74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
}
$ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
at [Source: /tmp/json2; line: 2, column: 27]
at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
at [Source: /tmp/json2; line: 2, column: 27]
http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051896#comment-13051896 ]
Timo Nentwig commented on CASSANDRA-2780:
-----------------------------------------
Sure, using a real serializer is always better (but usually somewhat slower). Works nicely. Thanks.
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Brandon Williams (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050811#comment-13050811 ]
Brandon Williams commented on CASSANDRA-2780:
---------------------------------------------
{quote}
So using a JSON generator / writer would make sense, if project uses one already? If not, I would recommend adding handling of backslashes and white space other than space (char codes below 32), as those must be escaped in String values and keys.
{quote}
We don't use one. I believe the historical reason is that one couldn't be found that would handle things incrementally, but I think that may have changed by now (sst2j is pretty long in the tooth) and we should probably switch to one if possible.
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Yaskevich updated CASSANDRA-2780:
---------------------------------------
Attachment: (was: CASSANDRA-2780-v2.patch)
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051126#comment-13051126 ]
Pavel Yaskevich commented on CASSANDRA-2780:
--------------------------------------------
Agreed, I see now that would be the best option. Will be working at that direction.
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan Ellis updated CASSANDRA-2780:
--------------------------------------
Priority: Minor (was: Critical)
Fix Version/s: 0.8.2
Assignee: Pavel Yaskevich
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timo Nentwig updated CASSANDRA-2780:
------------------------------------
Summary: sstable2json needs to escape quotes (was: sstable json conversion needs to encode quotes)
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Priority: Critical
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051117#comment-13051117 ]
Pavel Yaskevich commented on CASSANDRA-2780:
--------------------------------------------
Can you please post a correct regex so i can include it to patch?
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Hudson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051311#comment-13051311 ]
Hudson commented on CASSANDRA-2780:
-----------------------------------
Integrated in Cassandra-0.8 #175 (See [https://builds.apache.org/job/Cassandra-0.8/175/])
Use jackson's ObjectMapper instead of hand-crafting json in sstable2json.
Patch by Pavel Yaskevich, reviewed by brandonwilliams for CASSANDRA-2780
brandonwilliams : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1136991
Files :
* /cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/tools/SSTableExport.java
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Hudson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050863#comment-13050863 ]
Hudson commented on CASSANDRA-2780:
-----------------------------------
Integrated in Cassandra-0.8 #173 (See [https://builds.apache.org/job/Cassandra-0.8/173/])
sstable2json escapes quotes.
Patch by Pavel Yaskevich, reviewed by brandonwilliams for CASSANDRA-2780
brandonwilliams : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1136637
Files :
* /cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/SchemaLoader.java
* /cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/tools/SSTableExport.java
* /cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050809#comment-13050809 ]
Jonathan Ellis commented on CASSANDRA-2780:
-------------------------------------------
Tatu's feedback:
{quote}
The best way to handle escaping/quoting is to use tools that deal with the format -- this patch only handles escaping of double-quotes, but similar problems would occur with linefeeds, or backslashes.
So using a JSON generator / writer would make sense, if project uses one already? If not, I would recommend adding handling of backslashes and white space other than space (char codes below 32), as those must be escaped in String values and keys.
Also: if unquoted keys were required (not valid JSON, but there's lots of data like that...), Jackson can be configured to accept unquoted field names. That has its own potential issues (whether escaping is allowed, which characters are legal in unquotes names), but appears to work well enough that users haven't complained.
{quote}
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Brandon Williams (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brandon Williams closed CASSANDRA-2780.
---------------------------------------
Committed v2, thanks!
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050923#comment-13050923 ]
Timo Nentwig commented on CASSANDRA-2780:
-----------------------------------------
The patch will replace existing \" with \\" which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Yaskevich updated CASSANDRA-2780:
---------------------------------------
Reviewer: brandon.williams (was: jbellis)
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (CASSANDRA-2780) sstable2json needs
to escape quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050923#comment-13050923 ]
Timo Nentwig edited comment on CASSANDRA-2780 at 6/17/11 8:10 AM:
------------------------------------------------------------------
The patch will replace existing \" with \\\" which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
was (Author: tcn):
The patch will replace existing \" with \\" which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (CASSANDRA-2780) sstable2json needs
to escape quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050923#comment-13050923 ]
Timo Nentwig edited comment on CASSANDRA-2780 at 6/17/11 8:10 AM:
------------------------------------------------------------------
The patch will replace existing \" with \\\\" which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
was (Author: tcn):
The patch will replace existing \" with \\" which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Yaskevich updated CASSANDRA-2780:
---------------------------------------
Attachment: CASSANDRA-2780.patch
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Yaskevich updated CASSANDRA-2780:
---------------------------------------
Attachment: CASSANDRA-2780-v2.patch
changed replace with pattern/matcher with your regex in the escapeQuotes method. thanks!
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable json conversion needs to
encode quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timo Nentwig updated CASSANDRA-2780:
------------------------------------
Summary: sstable json conversion needs to encode quotes (was: sstable json convertion needs to encode quotes)
> sstable json conversion needs to encode quotes
> ----------------------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051109#comment-13051109 ]
Timo Nentwig commented on CASSANDRA-2780:
-----------------------------------------
D'oh, actually an existing \" must be replaced with \\\" :-\
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051124#comment-13051124 ]
Jonathan Ellis commented on CASSANDRA-2780:
-------------------------------------------
Why are we talking about regexes instead of taking Tatu's advice?
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable json conversion needs to
encode quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timo Nentwig updated CASSANDRA-2780:
------------------------------------
Priority: Critical (was: Major)
> sstable json conversion needs to encode quotes
> ----------------------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Priority: Critical
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CASSANDRA-2780) sstable2json needs to escape
quotes
Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Yaskevich updated CASSANDRA-2780:
---------------------------------------
Attachment: CASSANDRA-2780-v2.patch
uses ObjectMapper.writeValue(PrintStream, Object) to serialize keys and columns to JSON instead of using regexs.
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780-v2.patch, CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (CASSANDRA-2780) sstable2json needs
to escape quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050923#comment-13050923 ]
Timo Nentwig edited comment on CASSANDRA-2780 at 6/17/11 8:10 AM:
------------------------------------------------------------------
The patch will replace existing \" with \\" which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
was (Author: tcn):
The patch will replace existing \" with \\\\" which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-2780) sstable json conversion needs
to encode quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050274#comment-13050274 ]
Timo Nentwig commented on CASSANDRA-2780:
-----------------------------------------
Fix is easy:
$ cat /tmp/json
{
"74657374": [["data", "{\"foo\":\"bar\"}", 1308209845388000]]
}
$ ./json2sstable -s -c transactions -K foo /tmp/json /var/lib/cassandra/data/foo/transactions-g-1-Data.db
Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
Importing 1 keys...
1 keys imported successfully.
[default@foo] get transactions[test][data];
=> (column=data, value={"foo":"bar"}, timestamp=1308209845388000)
> sstable json conversion needs to encode quotes
> ----------------------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (CASSANDRA-2780) sstable2json needs
to escape quotes
Posted by "Timo Nentwig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CASSANDRA-2780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050923#comment-13050923 ]
Timo Nentwig edited comment on CASSANDRA-2780 at 6/17/11 8:10 AM:
------------------------------------------------------------------
The patch will replace existing \" with \\" (backslash backslash quote) which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
was (Author: tcn):
The patch will replace existing \" with \\\" which may not be the desired behaviour.
Alternative (regex should be precompiled, of course):
String.format("\"%s\"", val.replaceAll("(?<!\\\\)\"", "\\\\\""));
> sstable2json needs to escape quotes
> -----------------------------------
>
> Key: CASSANDRA-2780
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2780
> Project: Cassandra
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Timo Nentwig
> Assignee: Pavel Yaskevich
> Priority: Minor
> Fix For: 0.8.2
>
> Attachments: CASSANDRA-2780.patch
>
>
> [default@foo] set transactions[test][data]='{"foo":"bar"}';
> $ cat /tmp/json
> {
> "74657374": [["data", "{"foo":"bar"}", 1308209845388000]]
> }
> $ ./json2sstable -s -c transactions -K foo /tmp/json /tmp/ss-g-1-Data.db
> Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
> org.codehaus.jackson.JsonParseException: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
> at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
> at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
> at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:128)
> at org.codehaus.jackson.impl.JsonParserBase.skipChildren(JsonParserBase.java:263)
> at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:328)
> at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:252)
> at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:476)
> ERROR: Unexpected character ('f' (code 102)): was expecting comma to separate ARRAY entries
> at [Source: /tmp/json2; line: 2, column: 27]
> http://www.mail-archive.com/user@cassandra.apache.org/msg14257.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira