Examples of MinorType


Examples of org.apache.drill.common.types.TypeProtos.MinorType

      LogicalExpression newCondition = conditions.condition.accept(this, registry);
      LogicalExpression newExpr = conditions.expression.accept(this, registry);
      conditions = new IfExpression.IfCondition(newCondition, newExpr);

      MinorType thenType = conditions.expression.getMajorType().getMinorType();
      MinorType elseType = newElseExpr.getMajorType().getMinorType();

      // Check if we need a cast
      if (thenType != elseType && !(thenType == MinorType.NULL || elseType == MinorType.NULL)) {

        MinorType leastRestrictive = TypeCastRules.getLeastRestrictiveType((Arrays.asList(thenType, elseType)));
        if (leastRestrictive != thenType) {
          // Implicitly cast the then expression
          conditions = new IfExpression.IfCondition(newCondition,
              addCastExpression(conditions.expression, newElseExpr.getMajorType(), registry));
        } else if (leastRestrictive != elseType) {
View Full Code Here

Examples of org.apache.drill.common.types.TypeProtos.MinorType

      // if the cast is pointless, remove it.
      LogicalExpression input = e.getInput().accept(this,  value);

      MajorType newMajor = e.getMajorType();
      MinorType newMinor = input.getMajorType().getMinorType();

      if (castEqual(e.getPosition(), newMajor, input.getMajorType())) {
        return input; // don't do pointless cast.
      }
View Full Code Here

Examples of org.apache.drill.common.types.TypeProtos.MinorType

   * and use the value holder to write to the Map.
   */
  public static void writeToMapFromReader(FieldReader fieldReader, BaseWriter.MapWriter mapWriter, DrillBuf buffer) {

    MajorType valueMajorType = fieldReader.getType();
    MinorType valueMinorType = valueMajorType.getMinorType();

    switch (valueMinorType) {
      case TINYINT:
        TinyIntHolder tinyIntHolder = new TinyIntHolder();
        tinyIntHolder.value = fieldReader.readByte();
View Full Code Here

Examples of org.apache.drill.common.types.TypeProtos.MinorType

   * Function checks if casting is allowed from the 'from' -> 'to' minor type. If its allowed
   * we also check if the precedence map allows such a cast and return true if both cases are satisfied
   */
  public static MinorType getLeastRestrictiveType(List<MinorType> types) {
    assert types.size() >= 2;
    MinorType result = types.get(0);
    int resultPrec = ResolverTypePrecedence.precedenceMap.get(result);

    for (int i = 1; i < types.size(); i++) {
      MinorType next = types.get(i);
      if (next == result) {
        // both args are of the same type; continue
        continue;
      }

View Full Code Here

Examples of org.apache.drill.common.types.TypeProtos.MinorType

    consumer = columnIO.getRecordWriter(store);
    setUp(schema, consumer);
  }

  private PrimitiveType getPrimitiveType(MaterializedField field) {
    MinorType minorType = field.getType().getMinorType();
    String name = field.getLastName();
    PrimitiveTypeName primitiveTypeName = ParquetTypeHelper.getPrimitiveTypeNameForMinorType(minorType);
    Repetition repetition = ParquetTypeHelper.getRepetitionForDataMode(field.getDataMode());
    OriginalType originalType = ParquetTypeHelper.getOriginalTypeForMinorType(minorType);
    DecimalMetadata decimalMetadata = ParquetTypeHelper.getDecimalMetadataForField(field);
View Full Code Here

Examples of org.apache.drill.common.types.TypeProtos.MinorType

    int length = ParquetTypeHelper.getLengthForMinorType(minorType);
    return new PrimitiveType(repetition, primitiveTypeName, length, name, originalType, decimalMetadata);
  }

  private parquet.schema.Type getType(MaterializedField field) {
    MinorType minorType = field.getType().getMinorType();
    DataMode dataMode = field.getType().getMode();
    switch(minorType) {
      case MAP:
        List<parquet.schema.Type> types = Lists.newArrayList();
        for (MaterializedField childField : field.getChildren()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.