Package com.salesforce.phoenix.schema

Examples of com.salesforce.phoenix.schema.PColumnImpl


      List<PColumn> merged = new ArrayList<PColumn>();
      merged.addAll(left.getColumns());
      int position = merged.size();
      for (PColumn c : right.getColumns()) {
        if (!SchemaUtil.isPKColumn(c)) {
          PColumnImpl column = new PColumnImpl(c.getName(),
              PNameFactory.newName(ScanProjector.VALUE_COLUMN_FAMILY), c.getDataType(),
              c.getMaxLength(), c.getScale(), innerJoin ? c.isNullable() : true, position++,
              c.getColumnModifier());
          merged.add(column);
        }
View Full Code Here


              name = fullName;
          } else {
            columnNameMap.put(fullName.getString(), name.getString());
          }
            columnNameMap.put(colName.getString(), name.getString());
        PColumnImpl column = new PColumnImpl(name, familyName, sourceColumn.getDataType(),
            sourceColumn.getMaxLength(), sourceColumn.getScale(), sourceColumn.isNullable(),
            position, sourceColumn.getColumnModifier());
          Expression sourceExpression = new ColumnRef(sourceTable, sourceColumn.getPosition()).newColumnExpression();
          projectedColumns.add(column);
          sourceExpressions.add(sourceExpression);
View Full Code Here

                    String family = dynColumn.getColumnDefName().getFamilyName();
                    if (family != null) {
                        theTable.getColumnFamily(family); // Verifies that column family exists
                        familyName = PNameFactory.newName(family);
                    }
                    allcolumns.add(new PColumnImpl(name, familyName, dynColumn.getDataType(), dynColumn.getMaxLength(),
                            dynColumn.getScale(), dynColumn.isNull(), position, dynColumn.getColumnModifier()));
                    position++;
                }
                theTable = PTableImpl.makePTable(theTable, allcolumns);
            }
View Full Code Here

                    // Iterate through columns being projected
                    List<PColumn> projectedColumns = Lists.newArrayListWithExpectedSize(projectedExpressions.size());
                    for (int i = 0; i < projectedExpressions.size(); i++) {
                        // Must make new column if position has changed
                        PColumn column = allColumns.get(allColumnsIndexes[i]);
                        projectedColumns.add(column.getPosition() == i ? column : new PColumnImpl(column, i));
                    }
                    // Build table from projectedColumns
                    PTable projectedTable = PTableImpl.makePTable(table, projectedColumns);
                   
                    SelectStatement select = SelectStatement.create(SelectStatement.COUNT_ONE, upsert.getHint());
View Full Code Here

        KeyValue sqlDataTypeKv = colKeyValues[SQL_DATA_TYPE_INDEX];
        PDataType dataType = PDataType.fromTypeId(PDataType.INTEGER.getCodec().decodeInt(sqlDataTypeKv.getBuffer(), sqlDataTypeKv.getValueOffset(), null));
        if (maxLength == null && dataType == PDataType.BINARY) dataType = PDataType.VARBINARY; // For backward compatibility.
        KeyValue columnModifierKv = colKeyValues[COLUMN_MODIFIER_INDEX];
        ColumnModifier sortOrder = columnModifierKv == null ? null : ColumnModifier.fromSystemValue(PDataType.INTEGER.getCodec().decodeInt(columnModifierKv.getBuffer(), columnModifierKv.getValueOffset(), null));
        PColumn column = new PColumnImpl(colName, famName, dataType, maxLength, scale, isNullable, position-1, sortOrder);
        columns.add(column);
    }
View Full Code Here

    @Test
    public void testSerialization() throws Exception {
        int maxLen = 30;
        int scale = 5;
        PColumn column = new PColumnImpl(PNameFactory.newName("c1"), PNameFactory.newName("f1"), PDataType.DECIMAL, maxLen, scale,
                true, 20, null);
        ColumnExpression colExp = new KeyValueColumnExpression(column);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dOut = new DataOutputStream(baos);
        colExp.write(dOut);
View Full Code Here

    }

    @Test
    public void testSerializationWithNullScale() throws Exception {
        int maxLen = 30;
        PColumn column = new PColumnImpl(PNameFactory.newName("c1"), PNameFactory.newName("f1"), PDataType.BINARY, maxLen, null,
                true, 20, null);
        ColumnExpression colExp = new KeyValueColumnExpression(column);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dOut = new DataOutputStream(baos);
        colExp.write(dOut);
View Full Code Here

    }

    @Test
    public void testSerializationWithNullMaxLength() throws Exception {
        int scale = 5;
        PColumn column = new PColumnImpl(PNameFactory.newName("c1"), PNameFactory.newName("f1"), PDataType.VARCHAR, null, scale,
                true, 20, null);
        ColumnExpression colExp = new KeyValueColumnExpression(column);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dOut = new DataOutputStream(baos);
        colExp.write(dOut);
View Full Code Here

        assertEquals(PDataType.VARCHAR, colExp2.getDataType());
    }

    @Test
    public void testSerializationWithNullScaleAndMaxLength() throws Exception {
        PColumn column = new PColumnImpl(PNameFactory.newName("c1"), PNameFactory.newName("f1"), PDataType.DECIMAL, null, null, true,
                20, null);
        ColumnExpression colExp = new KeyValueColumnExpression(column);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dOut = new DataOutputStream(baos);
        colExp.write(dOut);
View Full Code Here

TOP

Related Classes of com.salesforce.phoenix.schema.PColumnImpl

Copyright © 2018 www.massapicom. 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.