public static JInvocation write()

in exec/java-exec/src/main/java/org/apache/drill/exec/expr/GetSetVectorHelper.java [132:198]


  public static JInvocation write(MajorType type, JVar vector, HoldingContainer in, JExpression indexVariable, String setMethodName) {

    JInvocation setMethod = vector.invoke("getMutator").invoke(setMethodName).arg(indexVariable);

    if (type.getMinorType() == MinorType.UNION) {
      return setMethod.arg(in.getHolder());
    }
    switch(type.getMode()){
      case OPTIONAL:
        setMethod = setMethod.arg(in.f("isSet"));
        // Fall through

      case REQUIRED:
        switch (type.getMinorType()) {
          case BIGINT:
          case FLOAT4:
          case FLOAT8:
          case INT:
          case MONEY:
          case SMALLINT:
          case TINYINT:
          case UINT1:
          case UINT2:
          case UINT4:
          case UINT8:
          case INTERVALYEAR:
          case DATE:
          case TIME:
          case TIMESTAMP:
          case BIT:
          case DECIMAL9:
          case DECIMAL18:
            return setMethod
                .arg(in.getValue());
          case DECIMAL28DENSE:
          case DECIMAL28SPARSE:
          case DECIMAL38DENSE:
          case DECIMAL38SPARSE:
            return setMethod
                .arg(in.f("start"))
                .arg(in.f("buffer"));
          case INTERVAL:{
            return setMethod
                .arg(in.f("months"))
                .arg(in.f("days"))
                .arg(in.f("milliseconds"));
          }
          case INTERVALDAY: {
            return setMethod
                .arg(in.f("days"))
                .arg(in.f("milliseconds"));
          }
          case VAR16CHAR:
          case VARBINARY:
          case VARCHAR:
          case VARDECIMAL:
            return setMethod
                .arg(in.f("start"))
                .arg(in.f("end"))
                .arg(in.f("buffer"));
          default:
        }
      default:
    }

    return setMethod.arg(in.getHolder());
  }