本文整理汇总了Java中com.facebook.presto.spi.type.Type.getLong方法的典型用法代码示例。如果您正苦于以下问题:Java Type.getLong方法的具体用法?Java Type.getLong怎么用?Java Type.getLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.presto.spi.type.Type
的用法示例。
在下文中一共展示了Type.getLong方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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, long element)
{
int size = array.getPositionCount();
for (int i = 0; i < size; i++) {
if (!array.isNull(i)) {
long arrayValue = type.getLong(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: indexLong
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
private static ColumnStats indexLong(Type type, OrcRecordReader reader, int columnIndex, long columnId)
throws IOException
{
boolean minSet = false;
boolean maxSet = false;
long min = 0;
long 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;
}
long value = type.getLong(block, i);
if (!minSet || (value < min)) {
minSet = true;
min = value;
}
if (!maxSet || (value > max)) {
maxSet = true;
max = value;
}
}
}
return new ColumnStats(columnId,
minSet ? min : null,
maxSet ? max : null);
}
示例4: getLong
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@Override
public long getLong(int field)
{
checkState(position >= 0, "Not yet advanced");
checkState(position < page.getPositionCount(), "Already finished");
Type type = types.get(field);
return type.getLong(page.getBlock(field), position);
}
示例5: longArrayMinMax
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static Long longArrayMinMax(MethodHandle compareMethodHandle, Type elementType, Block block)
{
try {
if (block.getPositionCount() == 0) {
return null;
}
long selectedValue = elementType.getLong(block, 0);
for (int i = 0; i < block.getPositionCount(); i++) {
if (block.isNull(i)) {
return null;
}
long value = elementType.getLong(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: longElementAt
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
public static Long longElementAt(Type elementType, Block array, long index)
{
int position = checkedIndexToBlockPosition(array, index);
if (array.isNull(position)) {
return null;
}
return elementType.getLong(array, position);
}
示例7: longSubscript
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static Long longSubscript(Type elementType, Block array, long index)
{
checkIndex(array, index);
int position = Ints.checkedCast(index - 1);
if (array.isNull(position)) {
return null;
}
return elementType.getLong(array, position);
}
示例8: longAccessor
import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static Long longAccessor(Type type, Integer field, Block row)
{
return row.isNull(field) ? null : type.getLong(row, field);
}