本文整理汇总了Java中com.facebook.presto.spi.type.Type.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java Type.getDouble方法的具体用法?Java Type.getDouble怎么用?Java Type.getDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.presto.spi.type.Type
的用法示例。
在下文中一共展示了Type.getDouble方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNativeContainerValue
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
private static Object getNativeContainerValue(Type type, Block block, int position)
{
if (block.isNull(position)) {
return null;
}
else if (type.getJavaType() == boolean.class) {
return type.getBoolean(block, position);
}
else if (type.getJavaType() == long.class) {
return type.getLong(block, position);
}
else if (type.getJavaType() == double.class) {
return type.getDouble(block, position);
}
else if (type.getJavaType() == Slice.class) {
return type.getSlice(block, position);
}
else if (type.getJavaType() == Block.class) {
return type.getObject(block, position);
}
else {
throw new AssertionError("Unimplemented type: " + type);
}
}
示例2: arrayPosition
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static long arrayPosition(Type type, MethodHandle equalMethodHandle, Block array, double element)
{
int size = array.getPositionCount();
for (int i = 0; i < size; i++) {
if (!array.isNull(i)) {
double arrayValue = type.getDouble(array, i);
try {
if ((boolean) equalMethodHandle.invokeExact(arrayValue, element)) {
return i + 1; // result is 1-based (instead of 0)
}
}
catch (Throwable t) {
Throwables.propagateIfInstanceOf(t, Error.class);
Throwables.propagateIfInstanceOf(t, PrestoException.class);
throw new PrestoException(INTERNAL_ERROR, t);
}
}
}
return 0;
}
示例3: contains
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@TypeParameter(StandardTypes.DOUBLE)
@SqlType(StandardTypes.BOOLEAN)
@Nullable
public static Boolean contains(
@TypeParameter(StandardTypes.DOUBLE) Type elementType,
@SqlType("array(double)") Block arrayBlock,
@SqlType(StandardTypes.DOUBLE) double lng,
@SqlType(StandardTypes.DOUBLE) double lat)
{
double[] array= new double[arrayBlock.getPositionCount()] ;
Polygon poly = new Polygon();
for (int i = 0; i < arrayBlock.getPositionCount(); i++) {
if (arrayBlock.isNull(i)) {
continue;
}
array[i]=elementType.getDouble(arrayBlock, i);
}
poly.startPath(array[0], array[1]);
for (int i = 2; i < array.length; i += 2) {
poly.lineTo(array[i], array[i + 1]);
}
return OperatorContains.local().execute(poly, new Point(lng,lat), null, null);
}
示例4: getDouble
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@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);
}
示例5: doubleArrayMinMax
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static Double doubleArrayMinMax(MethodHandle compareMethodHandle, Type elementType, Block block)
{
try {
if (block.getPositionCount() == 0) {
return null;
}
double selectedValue = elementType.getDouble(block, 0);
for (int i = 0; i < block.getPositionCount(); i++) {
if (block.isNull(i)) {
return null;
}
double value = elementType.getDouble(block, i);
if ((boolean) compareMethodHandle.invokeExact(value, selectedValue)) {
selectedValue = value;
}
}
return selectedValue;
}
catch (Throwable t) {
propagateIfInstanceOf(t, Error.class);
propagateIfInstanceOf(t, PrestoException.class);
throw new PrestoException(INTERNAL_ERROR, t);
}
}
示例6: doubleElementAt
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
public static Double doubleElementAt(Type elementType, Block array, long index)
{
int position = checkedIndexToBlockPosition(array, index);
if (array.isNull(position)) {
return null;
}
return elementType.getDouble(array, position);
}
示例7: doubleSubscript
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static Double doubleSubscript(Type elementType, Block array, long index)
{
checkIndex(array, index);
int position = Ints.checkedCast(index - 1);
if (array.isNull(position)) {
return null;
}
return elementType.getDouble(array, position);
}
示例8: indexDouble
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
private static ColumnStats indexDouble(Type type, OrcRecordReader reader, int columnIndex, long columnId)
throws IOException
{
boolean minSet = false;
boolean maxSet = false;
double min = 0;
double max = 0;
while (true) {
int batchSize = reader.nextBatch();
if (batchSize <= 0) {
break;
}
Block block = reader.readBlock(type, columnIndex);
for (int i = 0; i < batchSize; i++) {
if (block.isNull(i)) {
continue;
}
double value = type.getDouble(block, i);
if (isNaN(value)) {
continue;
}
if (value == -0.0) {
value = 0.0;
}
if (!minSet || (value < min)) {
minSet = true;
min = value;
}
if (!maxSet || (value > max)) {
maxSet = true;
max = value;
}
}
}
if (isInfinite(min)) {
minSet = false;
}
if (isInfinite(max)) {
maxSet = false;
}
return new ColumnStats(columnId,
minSet ? min : null,
maxSet ? max : null);
}
示例9: doubleAccessor
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static Double doubleAccessor(Type type, Integer field, Block row)
{
return row.isNull(field) ? null : type.getDouble(row, field);
}