int RGWSelectObj_ObjStore_S3::get_params(optional_yield y)
{
- if(m_s3select_query.empty() == false) {
+ if (m_s3select_query.empty() == false) {
return 0;
}
#ifndef _ARROW_EXIST
if (output_escape_char.size()) {
csv.output_escape_char = *output_escape_char.c_str();
}
- if(output_quote_fields.compare("ALWAYS") == 0) {
+ if (output_quote_fields.compare("ALWAYS") == 0) {
csv.quote_fields_always = true;
- } else if(output_quote_fields.compare("ASNEEDED") == 0) {
+ } else if (output_quote_fields.compare("ASNEEDED") == 0) {
csv.quote_fields_asneeded = true;
}
- if(m_header_info.compare("IGNORE")==0) {
+ if (m_header_info.compare("IGNORE")==0) {
csv.ignore_header_info=true;
- } else if(m_header_info.compare("USE")==0) {
+ } else if (m_header_info.compare("USE")==0) {
csv.use_header_info=true;
}
-
- if(m_outputFormat == OutputFormat::JSON) {
+ if (m_outputFormat == OutputFormat::JSON) {
csv.output_json_format = true;
}
m_s3_csv_object.set_csv_query(&s3select_syntax, csv);
//parsing the SQL statement.
s3select_syntax.parse_query(m_sql_query.c_str());
parquet_object::csv_definitions parquet;
- if(m_outputFormat == OutputFormat::JSON) {
+ if (m_outputFormat == OutputFormat::JSON) {
parquet.output_json_format = true;
}
return -EINVAL;
}
- if(m_outputFormat == OutputFormat::JSON) {
+ if (m_outputFormat == OutputFormat::JSON) {
json.output_json_format = true;
}
m_aws_response_handler.set(s, this, fp_chunked_transfer_encoding);
}
- if(s->cct->_conf->rgw_disable_s3select == true)
+ if (s->cct->_conf->rgw_disable_s3select == true)
{
std::string error_msg="s3select : is disabled by rgw_disable_s3select configuration parameter";
ldpp_dout(this, 10) << error_msg << dendl;
m_requested_range = (m_end_scan_sz - m_start_scan_sz);
- if(m_is_trino_request){
+ if (m_is_trino_request){
// fetch more than requested(m_scan_offset), that additional bytes are scanned for end of row,
// thus the additional length will be processed, and no broken row for Trino.
// assumption: row is smaller than m_scan_offset. (a different approach is to request for additional range)
//the purpose is to return "perfect" results, with no broken or missing lines.
off_t new_offset = 0;
- if(m_scan_range_ind){//only upon range-scan
+ if (m_scan_range_ind){//only upon range-scan
int64_t sc=0;
int64_t start =0;
const char* row_delimiter = m_row_delimiter.c_str();
ldpp_dout(this, 10) << "s3select query: per Trino request the first and last chunk should modified." << dendl;
//chop the head of the first chunk and only upon the slice does not include the head of the object.
- if(m_start_scan_sz && (m_aws_response_handler.get_processed_size()==0)){
+ if (m_start_scan_sz && (m_aws_response_handler.get_processed_size()==0)){
char* p = const_cast<char*>(it_cp+ofs);
while(strncmp(row_delimiter,p,1) && (p - (it_cp+ofs)) < len)p++;
- if(!strncmp(row_delimiter,p,1)){
+ if (!strncmp(row_delimiter,p,1)){
new_offset += (p - (it_cp+ofs))+1;
}
}
//chop the end of the last chunk for this request
//if it's the last chunk, search for first row-delimiter for the following different use-cases
- if((m_aws_response_handler.get_processed_size()+len) >= m_requested_range){
+ if ((m_aws_response_handler.get_processed_size()+len) >= m_requested_range){
//had pass the requested range, start to search for first delimiter
- if(m_aws_response_handler.get_processed_size()>m_requested_range){
+ if (m_aws_response_handler.get_processed_size()>m_requested_range){
//the previous chunk contain the complete request(all data) and an extra bytes.
//thus, search for the first row-delimiter
//[:previous (RR) ... ][:current (RD) ]
start = 0;
- } else if(m_aws_response_handler.get_processed_size()){
+ } else if (m_aws_response_handler.get_processed_size()){
//the *current* chunk contain the complete request in the middle of the chunk.
//thus, search for the first row-delimiter after the complete request position
//[:current (RR) .... (RD) ]
for(sc=start;sc<len;sc++)//assumption : row-delimiter must exist or its end ebject
{
char* p = const_cast<char*>(it_cp) + ofs + sc;
- if(!strncmp(row_delimiter,p,1)){
+ if (!strncmp(row_delimiter,p,1)){
ldout(s->cct, 10) << "S3select: found row-delimiter on " << sc << " get_processed_size = " << m_aws_response_handler.get_processed_size() << dendl;
len = sc + 1;//+1 is for delimiter. TODO what about m_object_size_for_processing (to update according to len)
//the end of row exist in current chunk.
int RGWSelectObj_ObjStore_S3::csv_processing(bufferlist& bl, off_t ofs, off_t len)
{
int status = 0;
- if(m_skip_next_chunk == true){
+ if (m_skip_next_chunk == true){
return status;
}
}
- if(ofs > it.length()){
+ if (ofs > it.length()){
//safety check
ldpp_dout(this, 10) << "offset and length may cause invalid read: ofs = " << ofs << " len = " << len << " it.length() = " << it.length() << dendl;
ofs = 0;
}
- if(m_is_trino_request){
+ if (m_is_trino_request){
//TODO replace len with it.length() ? ; test Trino flow with compressed objects.
//is it possible to send get-by-ranges? in parallel?
shape_chunk_per_trino_requests(&(it)[0], ofs, len);
continue;
}
- if((ofs + len) > it.length()){
+ if ((ofs + len) > it.length()){
ldpp_dout(this, 10) << "s3select: offset and length may cause invalid read: ofs = " << ofs << " len = " << len << " it.length() = " << it.length() << dendl;
ofs = 0;
len = it.length();