【问题标题】:Bigsql like predicate errorBigsql 类似谓词错误
【发布时间】:2015-10-19 09:44:50
【问题描述】:

我正在为 bigsql 编写 sql 查询。

如果它看起来像这样

 select t.city from table t where t.city like 'A%'

它工作正常,但下一个失败:

 select t.city from table t where t.city like 'A%' escape '\'

我只添加了转义表达式,它给了我以下错误

Error Code: -5199, SQL State: 57067]  DB2 SQL Error: SQLCODE=-5199, SQLSTATE=57067, SQLERRMC=Java DFSIO;1;2, DRIVER=4.15.82

我找到了这个文档http://www-01.ibm.com/support/knowledgecenter/SSPT3X_2.1.2/com.ibm.swg.im.infosphere.biginsights.bigsql.doc/doc/bsql_like_predicate.html?lang=en 所以看来逃跑应该管用。

如果我转义转义字符,我会得到另一个错误

 Error Code: -130, SQL State: 22019]  DB2 SQL Error: SQLCODE=-130, SQLSTATE=22019, SQLERRMC=null, DRIVER=4.15.82. 2) [Error Code: -727, SQL State: 56098]  DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098, SQLERRMC=2;-130;22019;, DRIVER=4.15.82

但是,如果我不使用“\”字符作为转义符,而是使用其他字符,例如“/”,它就可以正常工作。

任何想法为什么会发生?

【问题讨论】:

    标签: bigsql


    【解决方案1】:

    不妨试试这个。您可能需要转义转义字符。

    select t.city from table t where t.city like 'A%' escape '\\'
    

    【讨论】:

    【解决方案2】:

    基于此示例:

    \connect bigsql
    drop table if exists stack.issue1;
    
    create hadoop table if not exists stack.issue1 (
    f1 integer,
    f2 integer,
    f3 varchar(200),
    f4 integer
    )
    stored as parquetfile;
    
    insert into stack.issue1 (f1,f2,f3,f4) values (0,0,'Detroit',0);
    insert into stack.issue1 (f1,f2,f3,f4) values (1,1,'Mt. Pleasant',1);
    insert into stack.issue1 (f1,f2,f3,f4) values (2,2,'Marysville',2);
    insert into stack.issue1 (f1,f2,f3,f4) values (3,3,'St. Clair',3);
    insert into stack.issue1 (f1,f2,f3,f4) values (4,4,'Port Huron',4);
    
    select * from stack.issue1;
    
    select * from stack.issue1 where f3 like 'M%';
    
    \quit
    

    我得到以下结果:

    jsqsh --autoconnect --input-file=./t.sql --output-file=t.out
    0 rows affected (total: 0.28s)
    0 rows affected (total: 0.22s)
    1 row affected (total: 0.37s)
    1 row affected (total: 0.35s)
    1 row affected (total: 0.38s)
    1 row affected (total: 0.35s)
    1 row affected (total: 0.35s)
    5 rows in results(first row: 0.33s; total: 0.33s)
    2 rows in results(first row: 0.26s; total: 0.26s)
    
    cat t.out
    +----+----+--------------+----+
    | F1 | F2 | F3           | F4 |
    +----+----+--------------+----+
    |  1 |  1 | Mt. Pleasant |  1 |
    |  0 |  0 | Detroit      |  0 |
    |  4 |  4 | Port Huron   |  4 |
    |  3 |  3 | St. Clair    |  3 |
    |  2 |  2 | Marysville   |  2 |
    +----+----+--------------+----+
    +----+----+--------------+----+
    | F1 | F2 | F3           | F4 |
    +----+----+--------------+----+
    |  1 |  1 | Mt. Pleasant |  1 |
    |  2 |  2 | Marysville   |  2 |
    +----+----+--------------+----+
    

    这表明您的语法是正确的,但是,根据 -5199 错误代码,这是 FMP 进程没有足够内存或 Hadoop I/O 组件存在问题。您可以通过发出来获取有关此错误的更多信息 db2 ? sql5199n 从命令行。

    SQL 错误消息应该已将您定向到发生错误的节点以及 Big SQL 日志文件和相关读取器日志文件所在的节点。

    【讨论】:

      【解决方案3】:

      SQL5199 错误通常意味着 HDFS 存在问题(您可以执行 db2 \? SQL5199 以获取有关消息的详细信息——作为用户 bigsql )。检查 bigsql 和 DFS 日志,看看是否有任何指向问题的指针。

      希望这会有所帮助。

      【讨论】:

        猜你喜欢
        • 2012-05-14
        • 1970-01-01
        • 1970-01-01
        • 2012-05-18
        • 1970-01-01
        • 2018-05-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多