private MajorType getMajorType(MinorType minorType) { MajorType majorType; majorType = Types.optional(minorType); return majorType; }
public NullableBitsHyperVectorStateReader(VectorAccessor nullableAccessor) { super(Types.required(MinorType.UINT1)); this.nullableAccessor = nullableAccessor; }
private static int toSQLType(MinorType minorType) { String sqlTypeName = Types.getSqlTypeName(Types.optional(minorType)); return Types.getJdbcTypeCode(sqlTypeName); } }
/** * Gets AvaticaType carrying both JDBC {@code java.sql.Type.*} type code * and SQL type name for given RPC-level type (from batch schema). */ private static AvaticaType getAvaticaType( MajorType rpcDateType ) { final String sqlTypeName = Types.getSqlTypeName( rpcDateType ); final int jdbcTypeId = Types.getJdbcTypeCode( sqlTypeName ); return ColumnMetaData.scalar( jdbcTypeId, sqlTypeName, Rep.BOOLEAN /* dummy value, unused */ ); }
public static MajorType overrideMode(final MajorType originalMajorType, final DataMode overrideMode) { return withScaleAndPrecision(originalMajorType.getMinorType(), overrideMode, originalMajorType.getScale(), originalMajorType.getPrecision()); }
builder.setDataType(Types.getSqlTypeName(majorType)); builder.setPrecision(Types.getPrecision(field.getMajorType())); builder.setScale(Types.getScale(majorType)); builder.setSigned(Types.isNumericType(majorType)); builder.setDisplaySize(Types.getJdbcDisplaySize(majorType)); builder.setAutoIncrement(false); builder.setCaseSensitivity(false); builder.setSortable(Types.isSortable(minorType));
+ field.getDataMode().name() + "'" ); final boolean isSigned = Types.isJdbcSignedType( rpcDataType ); final int precision = Types.getPrecision(rpcDataType); final int scale = Types.getScale(rpcDataType); final int displaySize = Types.getJdbcDisplaySize(rpcDataType);
/** * Extend decimal type with precision and scale. * * @param type major type * @return type name augmented with precision and scale, * if type is a decimal */ public static String getExtendedSqlTypeName(MajorType type) { String typeName = getSqlTypeName(type); switch (type.getMinorType()) { case DECIMAL9: case DECIMAL18: case DECIMAL28SPARSE: case DECIMAL28DENSE: case DECIMAL38SPARSE: case DECIMAL38DENSE: case VARDECIMAL: // Disabled for now. See DRILL-6378 if (type.getPrecision() > 0) { typeName += String.format("(%d, %d)", type.getPrecision(), type.getScale()); } default: } return typeName; }
final int precision = getPrecision(type); switch(type.getMinorType()) { case BIT: return 1; // 1 digit
public static MajorType getMajorTypeFromName(final String typeName) { return getMajorTypeFromName(typeName, DataMode.REQUIRED); }
@Override public MajorType getMajorType() { if (outputType != null) { return outputType; } MajorType elseType = elseExpression.getMajorType(); MajorType ifType = ifCondition.expression.getMajorType(); if (elseType.getMinorType() == MinorType.UNION) { Set<MinorType> subtypes = Sets.newHashSet(); for (MinorType subtype : elseType.getSubTypeList()) { subtypes.add(subtype); } for (MinorType subtype : ifType.getSubTypeList()) { subtypes.add(subtype); } MajorType.Builder builder = MajorType.newBuilder().setMinorType(MinorType.UNION).setMode(DataMode.OPTIONAL); for (MinorType subtype : subtypes) { builder.addSubType(subtype); } return builder.build(); } MajorType.Builder builder = MajorType.newBuilder().setMinorType(ifType.getMinorType()); builder.setMode(elseType.getMode() == DataMode.OPTIONAL || ifType.getMode() == DataMode.OPTIONAL ? DataMode.OPTIONAL : elseType.getMode()); builder = Types.calculateTypePrecisionAndScale(ifType, elseType, builder); return builder.build(); }
builder = Types.calculateTypePrecisionAndScale(leftField.getType(), rightField.getType(), builder); container.addOrGet(MaterializedField.create(leftField.getName(), builder.build()), callBack); } else if (Types.isUntypedNull(rightField.getType())) { container.addOrGet(leftField, callBack); } else if (Types.isUntypedNull(leftField.getType())) { container.addOrGet(MaterializedField.create(leftField.getName(), rightField.getType()), callBack); } else { if (leftField.getType().getMinorType() == rightField.getType().getMinorType()) { builder.setMinorType(leftField.getType().getMinorType()); builder = Types.calculateTypePrecisionAndScale(leftField.getType(), rightField.getType(), builder); } else { List<TypeProtos.MinorType> types = Lists.newLinkedList();
public RepeatedDecimal28SparseVector(MaterializedField field, BufferAllocator allocator) { super(field, allocator); MajorType majorType = field.getType(); addOrGetVector(VectorDescriptor.create(Types.withScaleAndPrecision( majorType.getMinorType(), DataMode.REQUIRED, majorType.getScale(), majorType.getPrecision()))); }
+ field.getDataMode().name() + "'" ); final boolean isSigned = Types.isJdbcSignedType( rpcDataType ); final int precision = Types.getPrecision(rpcDataType); final int scale = Types.getScale(rpcDataType); final int displaySize = Types.getJdbcDisplaySize(rpcDataType);
/** * Gets AvaticaType carrying both JDBC {@code java.sql.Type.*} type code * and SQL type name for given RPC-level type (from batch schema). */ private static AvaticaType getAvaticaType( MajorType rpcDateType ) { final String sqlTypeName = Types.getSqlTypeName( rpcDateType ); final int jdbcTypeId = Types.getJdbcTypeCode( sqlTypeName ); return ColumnMetaData.scalar( jdbcTypeId, sqlTypeName, Rep.BOOLEAN /* dummy value, unused */ ); }
/** * Extend decimal type with precision and scale. * * @param type major type * @return type name augmented with precision and scale, * if type is a decimal */ public static String getExtendedSqlTypeName(MajorType type) { String typeName = getSqlTypeName(type); switch (type.getMinorType()) { case DECIMAL9: case DECIMAL18: case DECIMAL28SPARSE: case DECIMAL28DENSE: case DECIMAL38SPARSE: case DECIMAL38DENSE: case VARDECIMAL: // Disabled for now. See DRILL-6378 if (type.getPrecision() > 0) { typeName += String.format("(%d, %d)", type.getPrecision(), type.getScale()); } default: } return typeName; }
final int precision = getPrecision(type); switch(type.getMinorType()) { case BIT: return 1; // 1 digit