Package org.apache.phoenix.schema.KeyValueSchema

Examples of org.apache.phoenix.schema.KeyValueSchema.KeyValueSchemaBuilder


                String name = columnAlias == null ? expression.toString() : columnAlias;
                projectedColumns.add(new ExpressionProjector(name, table.getName().getString(), expression, isCaseSensitive));
            }
            if(arrayKVFuncs.size() > 0 && arrayKVRefs.size() > 0) {
                serailizeArrayIndexInformationAndSetInScan(context, arrayKVFuncs, arrayKVRefs);
                KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(0);
                for (Expression expression : arrayKVRefs) {
                    builder.addField(expression);
                }
                KeyValueSchema kvSchema = builder.build();
                arrayIndexesBitSet = ValueBitSet.newInstance(kvSchema);
                builder = new KeyValueSchemaBuilder(0);
                for (Expression expression : arrayKVFuncs) {
                    builder.addField(expression);
                }
                arrayIndexesSchema = builder.build();
            }
            selectVisitor.reset();
            index++;
        }
View Full Code Here


   
    public TupleProjector(ProjectedPTableWrapper projected) {
      List<PColumn> columns = projected.getTable().getColumns();
      expressions = new Expression[columns.size() - projected.getTable().getPKColumns().size()];
      // we do not count minNullableIndex for we might do later merge.
      KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(0);
      int i = 0;
        for (PColumn column : projected.getTable().getColumns()) {
          if (!SchemaUtil.isPKColumn(column)) {
            builder.addField(column);
            expressions[i++] = projected.getSourceExpression(column);
          }
        }
        schema = builder.build();
        valueSet = ValueBitSet.newInstance(schema);
    }
View Full Code Here

      }
      return schemas;
    }

    private static KeyValueSchema buildSchema(PTable table) {
      KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(0);
      if (table != null) {
          for (PColumn column : table.getColumns()) {
              if (!SchemaUtil.isPKColumn(column)) {
                  builder.addField(column);
              }
          }
      }
        return builder.build();
    }
View Full Code Here

            List<KeyValueColumnExpression> arrayKVRefs) {
        byte[] specificArrayIdx = scan.getAttribute(BaseScannerRegionObserver.SPECIFIC_ARRAY_INDEX);
        if (specificArrayIdx == null) {
            return null;
        }
        KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(0);
        ByteArrayInputStream stream = new ByteArrayInputStream(specificArrayIdx);
        try {
            DataInputStream input = new DataInputStream(stream);
            int arrayKVRefSize = WritableUtils.readVInt(input);
            for (int i = 0; i < arrayKVRefSize; i++) {
                KeyValueColumnExpression kvExp = new KeyValueColumnExpression();
                kvExp.readFields(input);
                arrayKVRefs.add(kvExp);
            }
            int arrayKVFuncSize = WritableUtils.readVInt(input);
            Expression[] arrayFuncRefs = new Expression[arrayKVFuncSize];
            for (int i = 0; i < arrayKVFuncSize; i++) {
                ArrayIndexFunction arrayIdxFunc = new ArrayIndexFunction();
                arrayIdxFunc.readFields(input);
                arrayFuncRefs[i] = arrayIdxFunc;
                builder.addField(arrayIdxFunc);
            }
            kvSchema = builder.build();
            kvSchemaBitSet = ValueBitSet.newInstance(kvSchema);
            return arrayFuncRefs;
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
View Full Code Here

    this.position = column.getPosition() - table.getPKColumns().size();
    this.displayName = displayName;
  }
   
    private static KeyValueSchema buildSchema(PTable table) {
      KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(0);
        for (PColumn column : table.getColumns()) {
          if (!SchemaUtil.isPKColumn(column)) {
            builder.addField(column);
          }
        }
        return builder.build();
    }
View Full Code Here

   
    /**
     * Get the ValueSchema for the Aggregators
     */
    private static KeyValueSchema newValueSchema(Aggregator[] aggregators, int minNullableIndex) {
        KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(minNullableIndex);
        for (int i = 0; i < aggregators.length; i++) {
            Aggregator aggregator = aggregators[i];
            builder.addField(aggregator);
        }
        return builder.build();
    }
View Full Code Here

import org.junit.Test;


public class ValueBitSetTest {
    private KeyValueSchema generateSchema(int nFields, int nRepeating, final int nNotNull) {
        KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(nNotNull);
        for (int i = 0; i < nFields; i++) {
            final int fieldIndex = i;
            for (int j = 0; j < nRepeating; j++) {
                PDatum datum = new PDatum() {
                    @Override
                    public boolean isNullable() {
                        return fieldIndex <= nNotNull;
                    }
                    @Override
                    public PDataType getDataType() {
                        return PDataType.values()[fieldIndex % PDataType.values().length];
                    }
                    @Override
                    public Integer getMaxLength() {
                        return null;
                    }
                    @Override
                    public Integer getScale() {
                        return null;
                    }
          @Override
          public SortOrder getSortOrder() {
            return SortOrder.getDefault();
          }
                };
                builder.addField(datum);
            }
        }
        KeyValueSchema schema = builder.build();
        return schema;
    }
View Full Code Here

   
    /**
     * Get the ValueSchema for the Aggregators
     */
    private static KeyValueSchema newValueSchema(Aggregator[] aggregators, int minNullableIndex) {
        KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(minNullableIndex);
        for (int i = 0; i < aggregators.length; i++) {
            Aggregator aggregator = aggregators[i];
            builder.addField(aggregator);
        }
        return builder.build();
    }
View Full Code Here

   
    public ScanProjector(ProjectedPTableWrapper projected) {
      List<PColumn> columns = projected.getTable().getColumns();
      expressions = new Expression[columns.size() - projected.getTable().getPKColumns().size()];
      // we do not count minNullableIndex for we might do later merge.
      KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(0);
      int i = 0;
        for (PColumn column : projected.getTable().getColumns()) {
          if (!SchemaUtil.isPKColumn(column)) {
            builder.addField(column);
            expressions[i++] = projected.getSourceExpression(column);
          }
        }
        schema = builder.build();
        valueSet = ValueBitSet.newInstance(schema);
    }
View Full Code Here

            List<KeyValueColumnExpression> arrayKVRefs) {
        byte[] specificArrayIdx = scan.getAttribute(BaseScannerRegionObserver.SPECIFIC_ARRAY_INDEX);
        if (specificArrayIdx == null) {
            return null;
        }
        KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(0);
        ByteArrayInputStream stream = new ByteArrayInputStream(specificArrayIdx);
        try {
            DataInputStream input = new DataInputStream(stream);
            int arrayKVRefSize = WritableUtils.readVInt(input);
            for (int i = 0; i < arrayKVRefSize; i++) {
                KeyValueColumnExpression kvExp = new KeyValueColumnExpression();
                kvExp.readFields(input);
                arrayKVRefs.add(kvExp);
            }
            int arrayKVFuncSize = WritableUtils.readVInt(input);
            Expression[] arrayFuncRefs = new Expression[arrayKVFuncSize];
            for (int i = 0; i < arrayKVFuncSize; i++) {
                ArrayIndexFunction arrayIdxFunc = new ArrayIndexFunction();
                arrayIdxFunc.readFields(input);
                arrayFuncRefs[i] = arrayIdxFunc;
                builder.addField(arrayIdxFunc);
            }
            kvSchema = builder.build();
            kvSchemaBitSet = ValueBitSet.newInstance(kvSchema);
            return arrayFuncRefs;
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
View Full Code Here

TOP

Related Classes of org.apache.phoenix.schema.KeyValueSchema.KeyValueSchemaBuilder

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.