Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3select: Limit bug json #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion example/s3select_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,15 @@ int process_json_query(const char* input_query,const char* fname)
}
if(m_s3_json_object.is_sql_limit_reached())
{
std::cout << "json processing reached limit " << std::endl;
break;
}
read_sz = input_file_stream.read(buff.data(),BUFFER_SIZE).gcount();
}
if(m_s3_json_object.is_sql_limit_reached())
{
std::cout << "json processing reached limit " << std::endl;
return 0;
}
try{
result.clear();
m_s3_json_object.run_s3select_on_stream(result, 0, 0, object_sz, json.output_json_format);
Expand Down
9 changes: 8 additions & 1 deletion include/s3select.h
Original file line number Diff line number Diff line change
Expand Up @@ -3190,18 +3190,25 @@ class json_object : public base_s3object
status = -1;
}

++m_row_count;

if(is_sql_limit_reached())
{
status = JSON_PROCESSING_LIMIT_REACHED;//returning number since sql_execution_on_row_cb is a callback; the caller can not access the object
m_sql_processing_status = s3selectEngine::base_s3object::Status::LIMIT_REACHED;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

m_sa->clear_data();
if(star_operation_ind && (m_s3select_result->size() != result_len))
{//as explained above the star-operation is displayed differently
std::string end_of_row;
end_of_row = "#=== " + std::to_string(m_row_count++) + " ===#\n";
end_of_row = "#=== " + std::to_string(m_row_count) + " ===#\n";
m_s3select_result->append(end_of_row);
}

if(m_is_limit_on && m_row_count == m_limit) {
m_sql_processing_status = s3selectEngine::base_s3object::Status::LIMIT_REACHED;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewing getMatchRow

Status getMatchRow( std::string& result)

it handles the m_sql_processing_status

return status;
}

Expand Down