private static int getMinNullableIndex(List<PColumn> columns) { int minNullableIndex = columns.size(); for (int i = 0; i < columns.size(); i++) { if (columns.get(i).isNullable()) { minNullableIndex = i; break; } } return minNullableIndex; }
colUpsert.setString(5, column.getFamilyName() == null ? null : column.getFamilyName().getString()); colUpsert.setInt(6, column.getDataType().getSqlType()); colUpsert.setInt(7, SchemaUtil.getIsNullableInt(column.isNullable())); if (column.getMaxLength() == null) { colUpsert.setNull(8, Types.INTEGER);
if ( tenantIdCol.isNullable()) { throw new SQLExceptionInfo.Builder(INSUFFICIENT_MULTI_TENANT_COLUMNS).setSchemaName(schemaName).setTableName(tableName).build().buildException();
PInteger.INSTANCE.toBytes(SchemaUtil.getIsNullableInt(column.isNullable())))); MetaDataProtocol.MIN_TABLE_TIMESTAMP, PInteger.INSTANCE.toBytes(ordinal))); String isNullable = column.isNullable() ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
public static PDataType getIndexColumnDataType(PColumn dataColumn) throws SQLException { PDataType type = getIndexColumnDataType(dataColumn.isNullable(),dataColumn.getDataType()); if (type == null) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_INDEX_COLUMN_ON_TYPE).setColumnName(dataColumn.getName().getString()) .setMessage("Type="+dataColumn.getDataType()).build().buildException(); } return type; }
builder.addField(column, column.isNullable(), column.getSortOrder()); } else { List<PColumn> columnsInFamily = familyMap.get(familyName);
public PColumnImpl(PColumn column, boolean derivedColumn, int position, byte[] viewConstant) { this(column.getName(), column.getFamilyName(), column.getDataType(), column.getMaxLength(), column.getScale(), column.isNullable(), position, column.getSortOrder(), column.getArraySize(), viewConstant, column.isViewReferenced(), column.getExpressionStr(), column.isRowTimestamp(), column.isDynamic(), column.getColumnQualifierBytes(), column.getTimestamp(), derivedColumn); }
PColumn newColumn = new PColumnImpl(oldColumn.getName(), oldColumn.getFamilyName(), oldColumn.getDataType(), oldColumn.getMaxLength(), oldColumn.getScale(), oldColumn.isNullable(), i-1+positionOffset, oldColumn.getSortOrder(), oldColumn.getArraySize(), oldColumn.getViewConstant(), oldColumn.isViewReferenced(), oldColumn.getExpressionStr(), oldColumn.isRowTimestamp(), oldColumn.isDynamic(), oldColumn.getColumnQualifierBytes(), oldColumn.getTimestamp()); columns.add(newColumn);
public static PColumn getIndexPKColumn(int position, PColumn dataColumn) { assert (SchemaUtil.isPKColumn(dataColumn)); PName indexColumnName = PNameFactory.newName(getIndexColumnName(null, dataColumn.getName().getString())); PColumn column = new PColumnImpl(indexColumnName, null, dataColumn.getDataType(), dataColumn.getMaxLength(), dataColumn.getScale(), dataColumn.isNullable(), position, dataColumn.getSortOrder(), dataColumn.getArraySize(), null, false, dataColumn.getExpressionStr(), dataColumn.isRowTimestamp(), false, // TODO set the columnQualifierBytes correctly /*columnQualifierBytes*/null, HConstants.LATEST_TIMESTAMP); return column; }
public PColumnImpl(PColumn column, byte[] viewConstant, boolean isViewReferenced) { this(column.getName(), column.getFamilyName(), column.getDataType(), column.getMaxLength(), column.getScale(), column.isNullable(), column.getPosition(), column.getSortOrder(), column.getArraySize(), viewConstant, isViewReferenced, column.getExpressionStr(), column.isRowTimestamp(), column.isDynamic(), column.getColumnQualifierBytes(), column.getTimestamp(), column.isDerived()); }
assertFalse(metricId.isNullable()); PColumn hostName = pkColumns.get(1); assertEquals("HOSTNAME", hostName.getName().getString()); assertFalse(hostName.isNullable()); PColumn instanceName = pkColumns.get(2); assertEquals("INSTANCENAME", instanceName.getName().getString()); assertTrue(instanceName.isNullable()); List<PColumn> columns = table.getColumns(); assertEquals("METRICID", columns.get(0).getName().getString());
if (column.isNullable() && ExpressionUtil.isConstant(expression)) { expression = CoerceExpression.create(expression, indexColumn.getDataType());
ColumnRef sourceColumnRef = new ColumnRef(tableRef, sourceColumn.getPosition()); PColumn column = new ProjectedColumn(sourceColumn.getName(), sourceColumn.getFamilyName(), position++, sourceColumn.isNullable(), sourceColumnRef, null); projectedColumns.add(column); visitor.nonPkColumnRefSet.contains(sourceColumnRef) ? position + nonPkColumnRefList.indexOf(sourceColumnRef) : position++, sourceColumn.isNullable(), sourceColumnRef, sourceColumn.getColumnQualifierBytes()); PColumn column = new ProjectedColumn(sourceColumnRef.getColumn().getName(), sourceColumnRef.getColumn().getFamilyName(), position++, sourceColumnRef.getColumn().isNullable(), sourceColumnRef, sourceColumnRef.getColumn().getColumnQualifierBytes()); projectedColumns.add(column);
if (lastPK.isNullable() && lastPK.getDataType().isFixedWidth()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.NULLABLE_FIXED_WIDTH_LAST_PK) .setColumnName(lastPK.getName().getString()).build().buildException();
if (!SchemaUtil.isPKColumn(c)) { PColumn column = new ProjectedColumn(c.getName(), c.getFamilyName(), position++, type == JoinType.Inner ? c.isNullable() : true, ((ProjectedColumn) c).getSourceColumnRef(), c.getName().getBytes()); merged.add(column);
ColumnName colName = ColumnName.caseSensitiveColumnName(IndexUtil.getIndexColumnName(col)); allPkColumns.add(new ColumnDefInPkConstraint(colName, col.getSortOrder(), false)); columnDefs.add(FACTORY.columnDef(colName, dataType.getSqlTypeName(), col.isNullable(), col.getMaxLength(), col.getScale(), false, SortOrder.getDefault(), col.getName().getString(), col.isRowTimestamp())); columnDefs.add(FACTORY.columnDef(colName, col.getDataType().getSqlTypeName(), col.isNullable(), col.getMaxLength(), col.getScale(), false, col.getSortOrder(), col.getExpressionStr(), col.isRowTimestamp()));
position++, sourceColumn.isNullable(), sourceColumnRef, sourceColumn.getColumnQualifierBytes()); projectedColumns.add(column);
if (byteValue.length == 0 && !column.isNullable()) { throw new ConstraintViolationException(name.getString() + "." + column.getName().getString() + " may not be null"); if (column.getDataType().isFixedWidth() || !column.isNullable()) { throw new ConstraintViolationException(name.getString() + "." + column.getName().getString() + " may not be null");
if (isNull && !column.isNullable()) { throw new ConstraintViolationException(name.getString() + "." + column.getName().getString() + " may not be null");
builder.setScale(column.getScale()); builder.setNullable(column.isNullable()); builder.setPosition(column.getPosition()); if (column.getSortOrder()!=null) {