当前位置: 首页>>代码示例>>Java>>正文


Java NullableFloat8Vector类代码示例

本文整理汇总了Java中org.apache.drill.exec.vector.NullableFloat8Vector的典型用法代码示例。如果您正苦于以下问题:Java NullableFloat8Vector类的具体用法?Java NullableFloat8Vector怎么用?Java NullableFloat8Vector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NullableFloat8Vector类属于org.apache.drill.exec.vector包,在下文中一共展示了NullableFloat8Vector类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCopier

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
private Copier<?> getCopier(int jdbcType, int offset, ResultSet result, ValueVector v) {

    if (v instanceof NullableBigIntVector) {
      return new BigIntCopier(offset, result, (NullableBigIntVector.Mutator) v.getMutator());
    } else if (v instanceof NullableFloat4Vector) {
      return new Float4Copier(offset, result, (NullableFloat4Vector.Mutator) v.getMutator());
    } else if (v instanceof NullableFloat8Vector) {
      return new Float8Copier(offset, result, (NullableFloat8Vector.Mutator) v.getMutator());
    } else if (v instanceof NullableIntVector) {
      return new IntCopier(offset, result, (NullableIntVector.Mutator) v.getMutator());
    } else if (v instanceof NullableVarCharVector) {
      return new VarCharCopier(offset, result, (NullableVarCharVector.Mutator) v.getMutator());
    } else if (v instanceof NullableVarBinaryVector) {
      return new VarBinaryCopier(offset, result, (NullableVarBinaryVector.Mutator) v.getMutator());
    } else if (v instanceof NullableDateVector) {
      return new DateCopier(offset, result, (NullableDateVector.Mutator) v.getMutator());
    } else if (v instanceof NullableTimeVector) {
      return new TimeCopier(offset, result, (NullableTimeVector.Mutator) v.getMutator());
    } else if (v instanceof NullableTimeStampVector) {
      return new TimeStampCopier(offset, result, (NullableTimeStampVector.Mutator) v.getMutator());
    } else if (v instanceof NullableBitVector) {
      return new BitCopier(offset, result, (NullableBitVector.Mutator) v.getMutator());
    }

    throw new IllegalArgumentException("Unknown how to handle vector.");
  }
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:27,代码来源:JdbcRecordReader.java

示例2: NullableDictionaryFloat8Reader

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
NullableDictionaryFloat8Reader(ParquetRecordReader parentReader, int allocateSize, ColumnDescriptor descriptor,
                              ColumnChunkMetaData columnChunkMetaData, boolean fixedLength, NullableFloat8Vector v,
                              SchemaElement schemaElement) throws ExecutionSetupException {
  super(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, v, schemaElement);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:NullableFixedByteAlignedReaders.java

示例3: getNullableColumnReader

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
public static NullableColumnReader getNullableColumnReader(ParquetRecordReader parentReader, int allocateSize,
                                                           ColumnDescriptor columnDescriptor,
                                                           ColumnChunkMetaData columnChunkMetaData,
                                                           boolean fixedLength,
                                                           ValueVector valueVec,
                                                           SchemaElement schemaElement) throws ExecutionSetupException {
  ConvertedType convertedType = schemaElement.getConverted_type();

  if (! columnChunkMetaData.getEncodings().contains(Encoding.PLAIN_DICTIONARY)) {
    if (columnDescriptor.getType() == PrimitiveType.PrimitiveTypeName.INT96) {
      return new NullableFixedByteAlignedReaders.NullableFixedBinaryReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, true, (NullableVarBinaryVector) valueVec, schemaElement);
    }else{
      return new NullableFixedByteAlignedReaders.NullableFixedByteAlignedReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, valueVec, schemaElement);
    }
  } else {
    switch (columnDescriptor.getType()) {
      case INT32:
        if (convertedType == null) {
          return new NullableFixedByteAlignedReaders.NullableDictionaryIntReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableIntVector) valueVec, schemaElement);
        }
        switch (convertedType) {
          case DECIMAL:
            return new NullableFixedByteAlignedReaders.NullableDictionaryDecimal9Reader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableDecimal9Vector) valueVec, schemaElement);
          case TIME_MILLIS:
            return new NullableFixedByteAlignedReaders.NullableDictionaryTimeReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableTimeVector)valueVec, schemaElement);
          default:
            throw new ExecutionSetupException("Unsupported nullable converted type " + convertedType + " for primitive type INT32");
        }
      case INT64:
        if (convertedType == null) {
          return new NullableFixedByteAlignedReaders.NullableDictionaryBigIntReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableBigIntVector)valueVec, schemaElement);
        }
        switch (convertedType) {
          case DECIMAL:
            return new NullableFixedByteAlignedReaders.NullableDictionaryDecimal18Reader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableDecimal18Vector)valueVec, schemaElement);
          case TIMESTAMP_MILLIS:
            return new NullableFixedByteAlignedReaders.NullableDictionaryTimeStampReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableTimeStampVector)valueVec, schemaElement);
          default:
            throw new ExecutionSetupException("Unsupported nullable converted type " + convertedType + " for primitive type INT64");
        }
      case INT96:
         return new NullableFixedByteAlignedReaders.NullableFixedBinaryReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, true, (NullableVarBinaryVector) valueVec, schemaElement);
      case FLOAT:
        return new NullableFixedByteAlignedReaders.NullableDictionaryFloat4Reader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableFloat4Vector)valueVec, schemaElement);
      case DOUBLE:
        return new NullableFixedByteAlignedReaders.NullableDictionaryFloat8Reader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableFloat8Vector)valueVec, schemaElement);
      default:
        throw new ExecutionSetupException("Unsupported nullable column type " + columnDescriptor.getType().name() );
    }
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:52,代码来源:ColumnReaderFactory.java

示例4: Float8Copier

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
public Float8Copier(int columnIndex, ResultSet result, NullableFloat8Vector.Mutator mutator) {
  super(columnIndex, result, mutator);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:JdbcRecordReader.java

示例5: DecimalCopier

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
public DecimalCopier(int columnIndex, ResultSet result, NullableFloat8Vector.Mutator mutator) {
  super(columnIndex, result, mutator);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:JdbcRecordReader.java

示例6: setSafeValue

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
@Override
public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) {
  final double value = (double) ((DoubleObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue);
  ((NullableFloat8Vector) outputVV).getMutator().setSafe(outputIndex, value);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:HiveFieldConverter.java

示例7: testUDF

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
@Test
public void testUDF() throws Throwable {
  int numRecords = 0;
  String planString = Resources.toString(Resources.getResource("functions/hive/UDF.json"), Charsets.UTF_8);
  List<QueryDataBatch> results = testPhysicalWithResults(planString);

  RecordBatchLoader batchLoader = new RecordBatchLoader(getAllocator());
  for (QueryDataBatch result : results) {
    batchLoader.load(result.getHeader().getDef(), result.getData());
    if (batchLoader.getRecordCount() <= 0) {
      result.release();
      batchLoader.clear();
      continue;
    }

    // Output columns and types
    // 1. str1 : Var16Char
    // 2. str1Length : Int
    // 3. str1Ascii : Int
    // 4. flt1 : Float4
    // 5. pow : Float8
    Var16CharVector str1V = (Var16CharVector) batchLoader.getValueAccessorById(Var16CharVector.class, 0).getValueVector();
    NullableIntVector str1LengthV = (NullableIntVector) batchLoader.getValueAccessorById(NullableIntVector.class, 1).getValueVector();
    NullableIntVector str1AsciiV = (NullableIntVector) batchLoader.getValueAccessorById(NullableIntVector.class, 2).getValueVector();
    Float4Vector flt1V = (Float4Vector) batchLoader.getValueAccessorById(Float4Vector.class, 3).getValueVector();
    NullableFloat8Vector powV = (NullableFloat8Vector) batchLoader.getValueAccessorById(NullableFloat8Vector.class, 4).getValueVector();

    for (int i=0; i<batchLoader.getRecordCount(); i++) {
      String str1 = new String(str1V.getAccessor().get(i), Charsets.UTF_16);
      int str1Length = str1LengthV.getAccessor().get(i);
      assertTrue(str1.length() == str1Length);

      int str1Ascii = str1AsciiV.getAccessor().get(i);

      float flt1 = flt1V.getAccessor().get(i);

      double pow = 0;
      if (!powV.getAccessor().isNull(i)) {
        pow = powV.getAccessor().get(i);
        assertTrue(Math.pow(flt1, 2.0) == pow);
      }

      System.out.println(str1 + ", " + str1Length + ", " + str1Ascii + ", " + flt1 + ", " + pow);
      numRecords++;
    }

    result.release();
    batchLoader.clear();
  }

  System.out.println("Processed " + numRecords + " records");
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:53,代码来源:TestHiveUDFs.java

示例8: getNullableColumnReader

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
public static NullableColumnReader<?> getNullableColumnReader(ParquetRecordReader parentReader, int allocateSize,
                                                           ColumnDescriptor columnDescriptor,
                                                           ColumnChunkMetaData columnChunkMetaData,
                                                           boolean fixedLength,
                                                           ValueVector valueVec,
                                                           SchemaElement schemaElement) throws ExecutionSetupException {
  ConvertedType convertedType = schemaElement.getConverted_type();

  if (! columnChunkMetaData.getEncodings().contains(Encoding.PLAIN_DICTIONARY)) {
    if (columnDescriptor.getType() == PrimitiveType.PrimitiveTypeName.INT96) {
       // TODO: check convertedType once parquet support TIMESTAMP_NANOS type annotation.
      if (parentReader.getFragmentContext().getOptions().getOption(ExecConstants.PARQUET_READER_INT96_AS_TIMESTAMP).bool_val) {
        return new NullableFixedByteAlignedReaders.NullableFixedBinaryAsTimeStampReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, true, (NullableTimeStampVector) valueVec, schemaElement);
      } else {
        return new NullableFixedByteAlignedReaders.NullableFixedBinaryReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, true, (NullableVarBinaryVector) valueVec, schemaElement);
      }
    }else{
      return new NullableFixedByteAlignedReaders.NullableFixedByteAlignedReader<>(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, valueVec, schemaElement);
    }
  } else {
    switch (columnDescriptor.getType()) {
      case INT32:
        if (convertedType == null) {
          return new NullableFixedByteAlignedReaders.NullableDictionaryIntReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableIntVector) valueVec, schemaElement);
        }
        switch (convertedType) {
          case DECIMAL:
            return new NullableFixedByteAlignedReaders.NullableDictionaryDecimal9Reader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableDecimal9Vector) valueVec, schemaElement);
          case TIME_MILLIS:
            return new NullableFixedByteAlignedReaders.NullableDictionaryTimeReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableTimeVector)valueVec, schemaElement);
          default:
            throw new ExecutionSetupException("Unsupported nullable converted type " + convertedType + " for primitive type INT32");
        }
      case INT64:
        if (convertedType == null) {
          return new NullableFixedByteAlignedReaders.NullableDictionaryBigIntReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableBigIntVector)valueVec, schemaElement);
        }
        switch (convertedType) {
          case DECIMAL:
            return new NullableFixedByteAlignedReaders.NullableDictionaryDecimal18Reader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableDecimal18Vector)valueVec, schemaElement);
          case TIMESTAMP_MILLIS:
            return new NullableFixedByteAlignedReaders.NullableDictionaryTimeStampReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableTimeStampVector)valueVec, schemaElement);
          default:
            throw new ExecutionSetupException("Unsupported nullable converted type " + convertedType + " for primitive type INT64");
        }
      case INT96:
        // TODO: check convertedType once parquet support TIMESTAMP_NANOS type annotation.
        if (parentReader.getFragmentContext().getOptions().getOption(ExecConstants.PARQUET_READER_INT96_AS_TIMESTAMP).bool_val) {
          return new NullableFixedByteAlignedReaders.NullableFixedBinaryAsTimeStampReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, true, (NullableTimeStampVector) valueVec, schemaElement);
        } else {
          return new NullableFixedByteAlignedReaders.NullableFixedBinaryReader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, true, (NullableVarBinaryVector) valueVec, schemaElement);
        }
      case FLOAT:
        return new NullableFixedByteAlignedReaders.NullableDictionaryFloat4Reader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableFloat4Vector)valueVec, schemaElement);
      case DOUBLE:
        return new NullableFixedByteAlignedReaders.NullableDictionaryFloat8Reader(parentReader, allocateSize, columnDescriptor, columnChunkMetaData, fixedLength, (NullableFloat8Vector)valueVec, schemaElement);
      default:
        throw new ExecutionSetupException("Unsupported nullable column type " + columnDescriptor.getType().name() );
    }
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:62,代码来源:ColumnReaderFactory.java

示例9: setDoubleColumnValue

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
private void setDoubleColumnValue(Double data, ProjectedColumnInfo pci, int rowCount) {
  ((NullableFloat8Vector.Mutator) pci.vv.getMutator())
      .setSafe(rowCount, data);
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:5,代码来源:OpenTSDBRecordReader.java

示例10: testUDF

import org.apache.drill.exec.vector.NullableFloat8Vector; //导入依赖的package包/类
@Test
public void testUDF() throws Throwable {
  int numRecords = 0;
  String planString = Resources.toString(Resources.getResource("functions/hive/UDF.json"), Charsets.UTF_8);
  List<QueryDataBatch> results = testPhysicalWithResults(planString);

  RecordBatchLoader batchLoader = new RecordBatchLoader(getAllocator());
  for (QueryDataBatch result : results) {
    batchLoader.load(result.getHeader().getDef(), result.getData());
    if (batchLoader.getRecordCount() <= 0) {
      result.release();
      batchLoader.clear();
      continue;
    }

    // Output columns and types
    // 1. str1 : VarChar
    // 2. str1Length : Int
    // 3. str1Ascii : Int
    // 4. flt1 : Float4
    // 5. pow : Float8
    VarCharVector str1V = (VarCharVector) batchLoader.getValueAccessorById(VarCharVector.class, 0).getValueVector();
    BigIntVector str1LengthV = (BigIntVector) batchLoader.getValueAccessorById(BigIntVector.class, 1).getValueVector();
    IntVector str1AsciiV = (IntVector) batchLoader.getValueAccessorById(IntVector.class, 2).getValueVector();
    Float4Vector flt1V = (Float4Vector) batchLoader.getValueAccessorById(Float4Vector.class, 3).getValueVector();
    NullableFloat8Vector powV = (NullableFloat8Vector) batchLoader.getValueAccessorById(NullableFloat8Vector.class, 4).getValueVector();

    for (int i=0; i<batchLoader.getRecordCount(); i++) {
      String str1 = new String(str1V.getAccessor().get(i), Charsets.UTF_8);
      long str1Length = str1LengthV.getAccessor().get(i);
      assertTrue(str1.length() == str1Length);

      int str1Ascii = str1AsciiV.getAccessor().get(i);

      float flt1 = flt1V.getAccessor().get(i);

      double pow = 0;
      if (!powV.getAccessor().isNull(i)) {
        pow = powV.getAccessor().get(i);
        assertTrue(Math.pow(flt1, 2.0) == pow);
      }

      System.out.println(str1 + ", " + str1Length + ", " + str1Ascii + ", " + flt1 + ", " + pow);
      numRecords++;
    }

    result.release();
    batchLoader.clear();
  }

  System.out.println("Processed " + numRecords + " records");
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:53,代码来源:TestHiveUDFs.java


注:本文中的org.apache.drill.exec.vector.NullableFloat8Vector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。