[jira] [Commented] (CASSANDRA-15182) cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True):1:'ascii' codec can't encode character u'\u9ed1' in position 60: ordi
[ https://issues.apache.org/jira/browse/CASSANDRA-15182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16874266#comment-16874266 ] Michael Shuler commented on CASSANDRA-15182: Thanks Yuki, that helps! Simplified reproduction - CQL syntax is wrong, but the syntax error output encoding is problematic: {noformat} ccm create --version=git:cassandra-3.11 --nodes=1 --start test ccm node1 cqlsh --debug -e "CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};" ccm node1 cqlsh --debug -e "CREATE TABLE test.scratch (a text, b decimal, PRIMARY KEY (a));" # show syntax error with INSERT: ccm node1 cqlsh --debug -e "INSERT INTO test.scratch (a, b) VALUES ('A00888D',);" # show unicode problem when syntax error is output: ccm node1 cqlsh --debug -e "INSERT INTO test.scratch (a, b) VALUES ('黑A00888D',);" {noformat} Full output of above: {noformat} mshuler@hana:~$ ccm create --version=git:cassandra-3.11 --nodes=1 --start test https://gitbox.apache.org/repos/asf/cassandra.git git:cassandra-3.11 10:22:53,842 ccm INFO Cloning Cassandra... 10:23:20,346 ccm INFO Cloning Cassandra (from local cache) 10:23:21,129 ccm INFO Checking out requested branch (cassandra-3.11) 10:23:21,927 ccm INFO Compiling Cassandra cassandra-3.11 ... Current cluster is now: test mshuler@hana:~$ ccm node1 cqlsh --debug -e "CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};"Using CQL driver: Using connect timeout: 5 seconds Using 'utf-8' encoding Using ssl: False mshuler@hana:~$ ccm node1 cqlsh --debug -e "CREATE TABLE test.scratch (a text, b decimal, PRIMARY KEY (a));" Using CQL driver: Using connect timeout: 5 seconds Using 'utf-8' encoding Using ssl: False mshuler@hana:~$ ccm node1 cqlsh --debug -e "INSERT INTO test.scratch (a, b) VALUES ('A00888D',);" Using CQL driver: Using connect timeout: 5 seconds Using 'utf-8' encoding Using ssl: False :1:SyntaxException: line 1:50 no viable alternative at input ')' (..., b) VALUES ('A00888D',[)]...) mshuler@hana:~$ ccm node1 cqlsh --debug -e "INSERT INTO test.scratch (a, b) VALUES ('黑A00888D',);" Using CQL driver: Using connect timeout: 5 seconds Using 'utf-8' encoding Using ssl: False Traceback (most recent call last): File "/home/mshuler/.ccm/repository/gitCOLONcassandra-3.11/bin/cqlsh.py", line 925, in onecmd self.handle_statement(st, statementtext) File "/home/mshuler/.ccm/repository/gitCOLONcassandra-3.11/bin/cqlsh.py", line 965, in handle_statement return self.perform_statement(cqlruleset.cql_extract_orig(tokens, srcstr)) File "/home/mshuler/.ccm/repository/gitCOLONcassandra-3.11/bin/cqlsh.py", line 999, in perform_statement success, future = self.perform_simple_statement(stmt) File "/home/mshuler/.ccm/repository/gitCOLONcassandra-3.11/bin/cqlsh.py", line 1052, in perform_simple_statement self.printerr(unicode(err.__class__.__name__) + u": " + err.message.decode(encoding='utf-8')) File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeEncodeError: 'ascii' codec can't encode character u'\u9ed1' in position 63: ordinal not in range(128) {noformat} > cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, > errors, True):1:'ascii' codec can't encode character u'\u9ed1' in > position 60: ordinal not in range(128) > > > Key: CASSANDRA-15182 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15182 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: gloCalHelp.com >Priority: Normal > > I use cqlsh 5.0.1 with cassandra 3.11.3 with python2.7.13 in Centos 6.9. > when I run this cql command: bin/cqlsh hadoop4 -u dba -p ** --debug > -e "INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 > (clcph,dwsj,bc,blbs,cjbzh,ckryid,clid,clmc,ddfx,ddrq,fwj,gd,gdjd,gdwd,jsdlc,jszjl,jxzjl,sjid,sjsfzh,sjxm,sssd,xlmc) > VALUES > ('黑A00888D','2019-06-2509:57:19',0,,'',,,'379-7038',1434,'2019-06-25',275,0,126723690,45726990 > ,796.0,2205,746,'null','null','null',0,'379');" > I get the error message as below: > Using CQL driver: '/home/cassandra/cas3.11.3/bin/../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/__init__.py'> > Using connect timeout: 5 seconds > Using 'utf-8' encoding > Using ssl: False > Traceback (most recent call last): > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 926, in onecmd > self.handle_statement(st, statementtext) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 966, in handle_statement > return
[jira] [Commented] (CASSANDRA-15182) cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True):1:'ascii' codec can't encode character u'\u9ed1' in position 60: ordi
[ https://issues.apache.org/jira/browse/CASSANDRA-15182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16873753#comment-16873753 ] Yuki Morishita commented on CASSANDRA-15182: Hi [~gloCalHelp.com], cqlsh is complaining when it is trying to output an error, since your original CQL syntax is wrong (you have to provide some values for columns not like ',,,'.) 'Short' cql did not contain syntax error so it went through. > cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, > errors, True):1:'ascii' codec can't encode character u'\u9ed1' in > position 60: ordinal not in range(128) > > > Key: CASSANDRA-15182 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15182 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: gloCalHelp.com >Priority: Normal > > I use cqlsh 5.0.1 with cassandra 3.11.3 with python2.7.13 in Centos 6.9. > when I run this cql command: bin/cqlsh hadoop4 -u dba -p ** --debug > -e "INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 > (clcph,dwsj,bc,blbs,cjbzh,ckryid,clid,clmc,ddfx,ddrq,fwj,gd,gdjd,gdwd,jsdlc,jszjl,jxzjl,sjid,sjsfzh,sjxm,sssd,xlmc) > VALUES > ('黑A00888D','2019-06-2509:57:19',0,,'',,,'379-7038',1434,'2019-06-25',275,0,126723690,45726990 > ,796.0,2205,746,'null','null','null',0,'379');" > I get the error message as below: > Using CQL driver: '/home/cassandra/cas3.11.3/bin/../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/__init__.py'> > Using connect timeout: 5 seconds > Using 'utf-8' encoding > Using ssl: False > Traceback (most recent call last): > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 926, in onecmd > self.handle_statement(st, statementtext) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 966, in handle_statement > return self.perform_statement(cqlruleset.cql_extract_orig(tokens, srcstr)) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1000, in > perform_statement > success, future = self.perform_simple_statement(stmt) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1053, in > perform_simple_statement > self.printerr(unicode(err.__class__.__name__) + u": " + > err.message.decode(encoding='utf-8')) > File "/usr/local/python27/lib/python2.7/encodings/utf_8.py", line 16, in > decode > return codecs.utf_8_decode(input, errors, True) > UnicodeEncodeError: 'ascii' codec can't encode character u'\u9ed1' in > position 60: ordinal not in range(128) > > this issue seems different with the select command issue on > https://issues.apache.org/jira/browse/CASSANDRA-10875 > and other method to add "-*- coding: utf-8 -*- " in the head of cqlsh.py , > can anyone hurry up to teach me? > -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15182) cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True):1:'ascii' codec can't encode character u'\u9ed1' in position 60: ordi
[ https://issues.apache.org/jira/browse/CASSANDRA-15182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16872865#comment-16872865 ] gloCalHelp.com commented on CASSANDRA-15182: Thanks Sir Michael, because the report error position is not correct, and I don't know how to santize the insert sql, but the shorter one with a Chinese character can be successfully inserted as below: INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 (clcph,dwsj,bc) VALUES ('黑A00888D','2019-06-25 09:57:19',0);" Is there anyone who can tell me how to make cqlsh report the correct position of wrong sql except using --debug variable? > cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, > errors, True):1:'ascii' codec can't encode character u'\u9ed1' in > position 60: ordinal not in range(128) > > > Key: CASSANDRA-15182 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15182 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: gloCalHelp.com >Priority: Normal > > I use cqlsh 5.0.1 with cassandra 3.11.3 with python2.7.13 in Centos 6.9. > when I run this cql command: bin/cqlsh hadoop4 -u dba -p ** --debug > -e "INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 > (clcph,dwsj,bc,blbs,cjbzh,ckryid,clid,clmc,ddfx,ddrq,fwj,gd,gdjd,gdwd,jsdlc,jszjl,jxzjl,sjid,sjsfzh,sjxm,sssd,xlmc) > VALUES > ('黑A00888D','2019-06-2509:57:19',0,,'',,,'379-7038',1434,'2019-06-25',275,0,126723690,45726990 > ,796.0,2205,746,'null','null','null',0,'379');" > I get the error message as below: > Using CQL driver: '/home/cassandra/cas3.11.3/bin/../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/__init__.py'> > Using connect timeout: 5 seconds > Using 'utf-8' encoding > Using ssl: False > Traceback (most recent call last): > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 926, in onecmd > self.handle_statement(st, statementtext) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 966, in handle_statement > return self.perform_statement(cqlruleset.cql_extract_orig(tokens, srcstr)) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1000, in > perform_statement > success, future = self.perform_simple_statement(stmt) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1053, in > perform_simple_statement > self.printerr(unicode(err.__class__.__name__) + u": " + > err.message.decode(encoding='utf-8')) > File "/usr/local/python27/lib/python2.7/encodings/utf_8.py", line 16, in > decode > return codecs.utf_8_decode(input, errors, True) > UnicodeEncodeError: 'ascii' codec can't encode character u'\u9ed1' in > position 60: ordinal not in range(128) > > this issue seems different with the select command issue on > https://issues.apache.org/jira/browse/CASSANDRA-10875 > and other method to add "-*- coding: utf-8 -*- " in the head of cqlsh.py , > can anyone hurry up to teach me? > -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15182) cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True):1:'ascii' codec can't encode character u'\u9ed1' in position 60: ordi
[ https://issues.apache.org/jira/browse/CASSANDRA-15182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16872444#comment-16872444 ] Michael Shuler commented on CASSANDRA-15182: (Edited description to remove auth.. (OP should change that)) What is the local {{$LANG}} environment? Could you post a sanitized and/or simplified schema that reproduces this problem? {noformat} (master)mshuler@hana:~/git/ccm$ echo $LANG en_US.UTF-8 (master)mshuler@hana:~/git/ccm$ ./ccm create test --install-dir=/home/mshuler/git/cassandra Current cluster is now: test (master)mshuler@hana:~/git/ccm$ ./ccm populate -n 1 (master)mshuler@hana:~/git/ccm$ ./ccm start (master)mshuler@hana:~/git/ccm$ ./ccm node1 cqlsh Connected to test at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.11.5-SNAPSHOT | CQL spec 3.4.4 | Native protocol v4] Use HELP for help. cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; cqlsh> CREATE TABLE test.scratch (a text, b text, PRIMARY KEY (a)); cqlsh> INSERT INTO test.scratch (a, b) VALUES ('黑A00888D', 'something'); cqlsh> SELECT * FROM test.scratch; a | b ---+--- 黑A00888D | something (1 rows) {noformat} I seem to be able to INSERT and SELECT that character with my local LANG=en_US.UTF-8 env. I believe python-2.7 was not available until RHEL/CentOS 7, so I suspect the local environment and python install may need a little configuration? Just a guess. > cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, > errors, True):1:'ascii' codec can't encode character u'\u9ed1' in > position 60: ordinal not in range(128) > > > Key: CASSANDRA-15182 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15182 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: gloCalHelp.com >Priority: Normal > > I use cqlsh 5.0.1 with cassandra 3.11.3 with python2.7.13 in Centos 6.9. > when I run this cql command: bin/cqlsh hadoop4 -u dba -p ** --debug > -e "INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 > (clcph,dwsj,bc,blbs,cjbzh,ckryid,clid,clmc,ddfx,ddrq,fwj,gd,gdjd,gdwd,jsdlc,jszjl,jxzjl,sjid,sjsfzh,sjxm,sssd,xlmc) > VALUES > ('黑A00888D','2019-06-2509:57:19',0,,'',,,'379-7038',1434,'2019-06-25',275,0,126723690,45726990 > ,796.0,2205,746,'null','null','null',0,'379');" > I get the error message as below: > Using CQL driver: '/home/cassandra/cas3.11.3/bin/../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/__init__.py'> > Using connect timeout: 5 seconds > Using 'utf-8' encoding > Using ssl: False > Traceback (most recent call last): > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 926, in onecmd > self.handle_statement(st, statementtext) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 966, in handle_statement > return self.perform_statement(cqlruleset.cql_extract_orig(tokens, srcstr)) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1000, in > perform_statement > success, future = self.perform_simple_statement(stmt) > File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1053, in > perform_simple_statement > self.printerr(unicode(err.__class__.__name__) + u": " + > err.message.decode(encoding='utf-8')) > File "/usr/local/python27/lib/python2.7/encodings/utf_8.py", line 16, in > decode > return codecs.utf_8_decode(input, errors, True) > UnicodeEncodeError: 'ascii' codec can't encode character u'\u9ed1' in > position 60: ordinal not in range(128) > > this issue seems different with the select command issue on > https://issues.apache.org/jira/browse/CASSANDRA-10875 > and other method to add "-*- coding: utf-8 -*- " in the head of cqlsh.py , > can anyone hurry up to teach me? > -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org