0016-00000837
Updated at:
Problem description
When you use the Range HTTP header to specify the query range in a SelectObject request, the response body is empty even though the object contains matching data.
Causes
You specified the query range by using the Range request header or the Range element in the XML body, but no record delimiter exists within that range.
Examples
In the following request, the RecordDelimiter is Cg==, which decodes to \n. If this delimiter is not found within the specified byte range (10-20), the request returns empty results (HTTP 206 with an empty response body).
POST /oss-select/bigcsv_normal.csv?x-oss-process=csv%2Fselect HTTP/1.1
Date: Fri, 25 May 2018 22:11:39 GMT
Authorization: OSS qn6q**************:77Dv****************
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Range: bytes=10-20
<?xml version="1.0"?>
<SelectRequest>
<Expression>c2VsZWN0IGNvdW50KCopIGZyb20gb3Nzb2JqZWN0IHdoZXJlIF80ID4gNDU=
</Expression>
<InputSerialization>
<CSV>
<FileHeaderInfo>Ignore</FileHeaderInfo>
<RecordDelimiter>Cg==</RecordDelimiter>
<FieldDelimiter>LA==</FieldDelimiter>
<QuoteCharacter>Ig==</QuoteCharacter>
</CSV>
</InputSerialization>
<OutputSerialization>
......
</OutputSerialization>
</SelectRequest>
Solutions
To specify a query range, ensure the record delimiter exists within that range. Use the Range element in XML instead of the Range HTTP header. Example:
POST /oss-select/bigcsv_normal.csv?x-oss-process=csv%2Fselect HTTP/1.1
Date: Fri, 25 May 2018 22:11:39 GMT
Authorization: OSS qn6q**************:77Dv****************
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
<?xml version="1.0"?>
<SelectRequest>
<Expression>c2VsZWN0IGNvdW50KCopIGZyb20gb3Nzb2JqZWN0IHdoZXJlIF80ID4gNDU=
</Expression>
<InputSerialization>
<CSV>
<Range>line-range=10-20</Range>
<FileHeaderInfo>Ignore</FileHeaderInfo>
<RecordDelimiter>Cg==</RecordDelimiter>
<FieldDelimiter>LA==</FieldDelimiter>
<QuoteCharacter>Ig==</QuoteCharacter>
</CSV>
</InputSerialization>
<OutputSerialization>
......
</OutputSerialization>
</SelectRequest>
References
Is this page helpful?