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

Support decimal codegen in text scanner

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Impala 2.10.0
    • Impala 2.10.0
    • Backend

    Description

      Codegen is disabled when scanning text tables with decimal columns. The message is "Decimal not yet supported for codegen."

      The supported types use cross-compiled conversion functions in TextConverter::CodegenWriteSlot():

          IRFunction::Type parse_fn_enum;
          Function* parse_fn = NULL;
          switch (slot_desc->type().type) {
            case TYPE_BOOLEAN:
              parse_fn_enum = IRFunction::STRING_TO_BOOL;
              break;
            case TYPE_TINYINT:
              parse_fn_enum = IRFunction::STRING_TO_INT8;
              break;
            case TYPE_SMALLINT:
              parse_fn_enum = IRFunction::STRING_TO_INT16;
              break;
            case TYPE_INT:
              parse_fn_enum = IRFunction::STRING_TO_INT32;
              break;
            case TYPE_BIGINT:
              parse_fn_enum = IRFunction::STRING_TO_INT64;
              break;
            case TYPE_FLOAT:
              parse_fn_enum = IRFunction::STRING_TO_FLOAT;
              break;
            case TYPE_DOUBLE:
              parse_fn_enum = IRFunction::STRING_TO_DOUBLE;
              break;
            default:
              DCHECK(false);
              return NULL;
          }
      

      Decimal is a bit different to these functions because it accepts precision and scale parameters and the parsing functions are templated. However I think in principle the same approach can be used as for the other types.

      Note: StringToDecimal() is a huge inline function and we risk run into codegen-time problems if we're scanning many decimal columns. We should experiment to see if this is a problem and if so try to mitigate it, e.g. by not moving the function out of the header.

      Attachments

        Activity

          People

            tianyiwang Tianyi Wang
            tarmstrong Tim Armstrong
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: