【问题标题】:RedShift: JSON_PARSE() error: End-of-input during string sequenceRedShift:JSON_PARSE() 错误:字符串序列中的输入结束
【发布时间】:2021-11-22 10:04:54
【问题描述】:

也许有人有,或者知道可能是什么。

一般来说,我向 RedShift 提出这样的要求:

SELECT JSON_PARSE(inputs) AS inputs_super
FROM table
WHERE prompttype = 'input' AND (inputs IS NOT NULL OR inputs != 'null')
ORDER BY created
OFFSET 1000
LIMIT 1;

我犯了这个错误:

ERROR: Invalid input Detail: ----------------------------------------------- error: Invalid input code: 8001 context: JSON_PARSE() error: End-of-input during string sequence: (16372 bytes skipped) 0303)|(9550 query: 30091521 location: partiql_parser.cpp:794 process: query1_99_30091521 [pid=19776] ----------------------------------------------- 

我正在尝试找出找出问题的基准线。我提出这个要求:

SELECT inputs FROM table
WHERE prompttype = 'input' AND (inputs IS NOT NULL OR inputs != 'null')
ORDER BY created
OFFSET 1000
LIMIT 1;

我得到这个结果:

[{"desc": "In your opinion, do you think that the script you have just recorded were natural?", "name": "Survey", "type": "dropdown", "values": ["YES", "NO"]}]

我尝试在 JSON_PARSE 中单独检查这一行:

SELECT JSON_PARSE('[{"desc": "In your opinion, do you think that the script you have just recorded were natural?", "name": "Survey", "type": "dropdown", "values": ["YES", "NO"]}]');

我得到一个正常的答案。

那么,如果第一种情况和第三种情况的数据基本相同,为什么第一个请求会发出错误?

【问题讨论】:

    标签: amazon-redshift


    【解决方案1】:

    我解决了这个问题。

    主要问题是ORDER BY 不保证我每次都得到相同的字符串,所以我找不到带有无效字符串的原始字符串。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-18
      • 2016-06-13
      • 2017-05-17
      相关资源
      最近更新 更多