public org.apache.drill.common.types.TypeProtos.MajorType build() { org.apache.drill.common.types.TypeProtos.MajorType result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
/** * Builds major type using given minor type, data mode and precision. * * @param type minor type * @param mode data mode * @param precision precision value * @return major type */ public static MajorType withPrecision(final MinorType type, final DataMode mode, final int precision) { return MajorType.newBuilder().setMinorType(type).setMode(mode).setPrecision(precision).build(); }
/** * Returns true if specified type is decimal data type. * * @param type type to check * @return true if specified type is decimal data type. */ public static boolean isDecimalType(MajorType type) { return isDecimalType(type.getMinorType()); }
public TypedNullConstant(MajorType type) { super(null); this.type = TypeProtos.MajorType.newBuilder().mergeFrom(type).setMode(DataMode.OPTIONAL).build(); }
/*** * Gets SQL data type name for given Drill RPC-/protobuf-level data type. * @return * canonical keyword sequence for SQL data type (leading keywords in * corresponding {@code <data type>}; what * {@code INFORMATION_SCHEMA.COLUMNS.TYPE_NAME} would list) */ public static String getSqlTypeName(final MajorType type) { if (type.getMode() == DataMode.REPEATED || type.getMinorType() == MinorType.LIST) { return "ARRAY"; } return getBaseSqlTypeName(type); }
public MaterializedField cloneEmpty() { return create(name, type.toBuilder() .clearSubType() .build()); }
public static Builder newBuilder(org.apache.drill.common.types.TypeProtos.MajorType prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
/** * Get the <code>precision</code> of given type. * * @param majorType major type * @return precision value */ public static int getPrecision(MajorType majorType) { if (majorType.hasPrecision()) { return majorType.getPrecision(); } return isScalarStringType(majorType) ? MAX_VARCHAR_LENGTH : UNDEFINED; }
public static boolean isFixedWidthType(final MajorType type) { switch(type.getMinorType()) { case VARBINARY: case VAR16CHAR: case VARCHAR: case UNION: case VARDECIMAL: return false; default: return true; } }
@Override public String toString() { return "ConvertExpression [input=" + input + ", type=" + Types.toString(type) + ", convertFunction=" + convertFunction + ", conversionType=" + encodingType + "]"; } }
public java.lang.String getFieldName(int number) { return org.apache.drill.common.types.SchemaTypeProtos.MajorType.getFieldName(number); } public int getFieldNumber(java.lang.String name)
public int getFieldNumber(java.lang.String name) { return org.apache.drill.common.types.SchemaTypeProtos.MajorType.getFieldNumber(name); } public java.lang.Class<org.apache.drill.common.types.TypeProtos.MajorType> typeClass()
public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor
/** * <code>optional .common.MinorType minor_type = 1;</code> */ public Builder clearMinorType() { bitField0_ = (bitField0_ & ~0x00000001); minorType_ = org.apache.drill.common.types.TypeProtos.MinorType.LATE; onChanged(); return this; }
@Override public MajorType getMajorType() { return MajorType .newBuilder() .setMinorType(MinorType.VARDECIMAL) .setScale(scale) .setPrecision(precision) .setMode(DataMode.REQUIRED) .build(); }
public UnionMemberHyperVectorAccessor(VectorAccessor va, MajorType type) { // There is no materialized field for union members, so make one up. super(type); unionVectorAccessor = va; typeKey = type.getMinorType(); }
@Override public MajorType getMajorType() { return MajorType.newBuilder().setMinorType(MinorType.DECIMAL18).setScale(scale).setPrecision(precision).setMode(DataMode.REQUIRED).build(); }
public static MajorType required(final MinorType type) { return MajorType.newBuilder().setMode(DataMode.REQUIRED).setMinorType(type).build(); }
@Override public MajorType getMajorType() { return MajorType.newBuilder().setMinorType(MinorType.DECIMAL9).setScale(scale).setPrecision(precision).setMode(DataMode.REQUIRED).build(); }
public static MajorType optional(final MinorType type) { return MajorType.newBuilder().setMode(DataMode.OPTIONAL).setMinorType(type).build(); }