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

Correctly check subscripted column for IN expression #7022

Open
tedyu opened this issue Jan 28, 2021 · 0 comments
Open

Correctly check subscripted column for IN expression #7022

tedyu opened this issue Jan 28, 2021 · 0 comments

Comments

@tedyu
Copy link
Contributor

tedyu commented Jan 28, 2021

In WhereExprState::AnalyzeColumnOp :

    case QL_OP_IN: {
      if (statement_type_ != TreeNodeOpcode::kPTSelectStmt) {
        return sem_context->Error(expr, "IN expression not supported for write operations",
                                  ErrorCode::FEATURE_NOT_YET_IMPLEMENTED);
      }

      if (col_args != nullptr) {
        return sem_context->Error(expr, "IN expression not supported for subscripted column",
                                  ErrorCode::CQL_STATEMENT_INVALID);

Looking at code in WhereExprState::AnalyzeColumnOp involving subscripted column,

            if (col_desc->ql_type()->IsJson()) {
              json_col_ops_->emplace_back(col_desc, col_args, value, expr->ql_op());
            } else {
              subscripted_col_ops_->emplace_back(col_desc, col_args, value, expr->ql_op());

It seems we should also check whether col_desc->ql_type()->IsJson() is false. Otherwise the error shouldn't be raised for json column.

There is more to be done in making IN clause involving json path expression work apart from refining this check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant