Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-2188

expr-test fails on TestError() for built-ins/UDFs without Prepare() functions

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Impala 2.2
    • Fix Version/s: Impala 2.3.0
    • Component/s: None
    • Labels:

      Description

      If TestError() is called on a built-in/UDF that does not have a Prepare() stage, GetValue() in expr-test.cc never gets to call the corresponding function for that built-in/UDF. This is because it assumes that if any error exists, it is found in the Prepare() stage and never actually executes the actual function.

      Eg:
      The builtin regexp_extract() is evaluated by executing the following functions:

      StringFunctions::RegexpPrepare() ->
      StringFunctions::RegexpExtract() (x num rows) ->
      StringFunctions::RegexpClose()

      When we test for an error(expect_error = true) in expr-test.cc:GetValue(), it calls executor_->Exec() which ultimately calls only the Prepare() function(RegexpPrepare()) and never calls executor_->FetchResult() which would ultimately call the actual function(RegexpExtract()).

        void GetValue(const string& expr, const ColumnType& expr_type,
            void** interpreted_value, bool expect_error = false) {
          string stmt = "select " + expr;
          vector<FieldSchema> result_types;
          Status status = executor_->Exec(stmt, &result_types);
          if (expect_error) {
            ASSERT_FALSE(status.ok()) << "Expected error\nstmt: " << stmt;
            return;
          }
          ASSERT_TRUE(status.ok()) << "stmt: " << stmt << "\nerror: " << status.GetDetail();
          string result_row;
          ASSERT_TRUE(executor_->FetchResult(&result_row).ok()) << expr;
          EXPECT_EQ(TypeToOdbcString(expr_type.type), result_types[0].type) << expr;
          *interpreted_value = ConvertValue(expr_type, result_row);
        }
      

        Attachments

          Activity

            People

            • Assignee:
              sailesh Sailesh Mukil
              Reporter:
              sailesh Sailesh Mukil
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: