本文整理了Java中io.prestosql.spi.type.Type.getDouble()
方法的一些代码示例,展示了Type.getDouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Type.getDouble()
方法的具体详情如下:
包路径:io.prestosql.spi.type.Type
类名称:Type
方法名:getDouble
[英]Gets the value at the block position as a double.
[中]以双精度形式获取块位置处的值。
代码示例来源:origin: io.prestosql/presto-main
@Override
void readFirstField(Block block, int position, DoubleAndBlockPositionValueState state)
{
state.setFirst(firstType.getDouble(block, position));
}
代码示例来源:origin: io.prestosql/presto-main
@Override
public double getDouble(int field)
{
return types.get(field).getDouble(page.getBlock(field), position);
}
代码示例来源:origin: prestosql/presto
@Override
public void encodeValueInto(Block block, int position, SliceOutput output)
{
output.writeLong(Long.reverseBytes(Double.doubleToLongBits(type.getDouble(block, position))));
}
代码示例来源:origin: prestosql/presto
@Override
public double getDouble(int field)
{
return types.get(field).getDouble(page.getBlock(field), position);
}
代码示例来源:origin: prestosql/presto
@Override
void readFirstField(Block block, int position, DoubleAndBlockPositionValueState state)
{
state.setFirst(firstType.getDouble(block, position));
}
代码示例来源:origin: prestosql/presto
private void encodeValue(Block block, int position, SliceOutput output)
{
double value = type.getDouble(block, position);
buffer.setLength(0);
buffer.append(value);
for (int index = 0; index < buffer.length(); index++) {
output.writeByte(buffer.charAt(index));
}
}
代码示例来源:origin: io.prestosql/presto-main
@Override
public double getDouble(int field)
{
checkState(position >= 0, "Not yet advanced");
checkState(position < page.getPositionCount(), "Already finished");
Type type = types.get(field);
return type.getDouble(page.getBlock(field), position);
}
代码示例来源:origin: prestosql/presto
@Override
public double getDouble(int field)
{
checkState(position >= 0, "Not yet advanced");
checkState(position < page.getPositionCount(), "Already finished");
Type type = types.get(field);
return type.getDouble(page.getBlock(field), position);
}
代码示例来源:origin: io.prestosql/presto-main
@UsedByGeneratedCode
public static Double doubleSubscript(Type elementType, Block array, long index)
{
checkIndex(array, index);
int position = toIntExact(index - 1);
if (array.isNull(position)) {
return null;
}
return elementType.getDouble(array, position);
}
代码示例来源:origin: prestosql/presto
@UsedByGeneratedCode
public static Double doubleSubscript(Type elementType, Block array, long index)
{
checkIndex(array, index);
int position = toIntExact(index - 1);
if (array.isNull(position)) {
return null;
}
return elementType.getDouble(array, position);
}
代码示例来源:origin: io.prestosql/presto-main
public static void input(Type type, NullableDoubleState state, Block block, int position)
{
if (!state.isNull()) {
return;
}
state.setNull(false);
state.setDouble(type.getDouble(block, position));
}
代码示例来源:origin: io.prestosql/presto-main
public double getDouble(int channel, int position)
{
long pageAddress = valueAddresses.getLong(position);
Block block = channels[channel].get(decodeSliceIndex(pageAddress));
int blockPosition = decodePosition(pageAddress);
return types.get(channel).getDouble(block, blockPosition);
}
代码示例来源:origin: prestosql/presto
public double getDouble(int channel, int position)
{
long pageAddress = valueAddresses.getLong(position);
Block block = channels[channel].get(decodeSliceIndex(pageAddress));
int blockPosition = decodePosition(pageAddress);
return types.get(channel).getDouble(block, blockPosition);
}
代码示例来源:origin: prestosql/presto
public static void input(Type type, NullableDoubleState state, Block block, int position)
{
if (!state.isNull()) {
return;
}
state.setNull(false);
state.setDouble(type.getDouble(block, position));
}
代码示例来源:origin: io.prestosql/presto-orc
@Override
public void addBlock(Type type, Block block)
{
for (int position = 0; position < block.getPositionCount(); position++) {
if (!block.isNull(position)) {
double value;
if (type == RealType.REAL) {
value = Float.intBitsToFloat((int) type.getLong(block, position));
}
else {
value = type.getDouble(block, position);
}
addValue(value);
}
}
}
代码示例来源:origin: prestosql/presto
@Override
public void addBlock(Type type, Block block)
{
for (int position = 0; position < block.getPositionCount(); position++) {
if (!block.isNull(position)) {
double value;
if (type == RealType.REAL) {
value = Float.intBitsToFloat((int) type.getLong(block, position));
}
else {
value = type.getDouble(block, position);
}
addValue(value);
}
}
}
代码示例来源:origin: io.prestosql/presto-main
@TypeParameter("T")
@TypeParameterSpecialization(name = "T", nativeContainerType = double.class)
@SqlType("array(T)")
public Block sortDouble(
@TypeParameter("T") Type type,
@SqlType("array(T)") Block block,
@SqlType("function(T, T, int)") ComparatorDoubleLambda function)
{
int arrayLength = block.getPositionCount();
initPositionsList(arrayLength);
Comparator<Integer> comparator = (x, y) -> comparatorResult(function.apply(
block.isNull(x) ? null : type.getDouble(block, x),
block.isNull(y) ? null : type.getDouble(block, y)));
sortPositions(arrayLength, comparator);
return computeResultBlock(type, block, arrayLength);
}
代码示例来源:origin: prestosql/presto
@TypeParameter("T")
@TypeParameterSpecialization(name = "T", nativeContainerType = double.class)
@SqlType("array(T)")
public Block sortDouble(
@TypeParameter("T") Type type,
@SqlType("array(T)") Block block,
@SqlType("function(T, T, int)") ComparatorDoubleLambda function)
{
int arrayLength = block.getPositionCount();
initPositionsList(arrayLength);
Comparator<Integer> comparator = (x, y) -> comparatorResult(function.apply(
block.isNull(x) ? null : type.getDouble(block, x),
block.isNull(y) ? null : type.getDouble(block, y)));
sortPositions(arrayLength, comparator);
return computeResultBlock(type, block, arrayLength);
}
代码示例来源:origin: io.prestosql/presto-main
@TypeParameter("E")
@SqlNullable
@SqlType("E")
public static Double doubleElementAt(@TypeParameter("E") Type elementType, @SqlType("array(E)") Block array, @SqlType("bigint") long index)
{
int position = checkedIndexToBlockPosition(array, index);
if (position == -1) {
return null;
}
if (array.isNull(position)) {
return null;
}
return elementType.getDouble(array, position);
}
代码示例来源:origin: prestosql/presto
@TypeParameter("E")
@SqlNullable
@SqlType("E")
public static Double doubleElementAt(@TypeParameter("E") Type elementType, @SqlType("array(E)") Block array, @SqlType("bigint") long index)
{
int position = checkedIndexToBlockPosition(array, index);
if (position == -1) {
return null;
}
if (array.isNull(position)) {
return null;
}
return elementType.getDouble(array, position);
}
内容来源于网络,如有侵权,请联系作者删除!