本文整理了Java中com.facebook.presto.spi.type.RealType.writeLong
方法的一些代码示例,展示了RealType.writeLong
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RealType.writeLong
方法的具体详情如下:
包路径:com.facebook.presto.spi.type.RealType
类名称:RealType
方法名:writeLong
暂无
代码示例来源:origin: prestodb/presto
@Override
public void append(JsonParser parser, BlockBuilder blockBuilder)
throws IOException
{
Long result = currentTokenAsReal(parser);
if (result == null) {
blockBuilder.appendNull();
}
else {
REAL.writeLong(blockBuilder, result);
}
}
}
代码示例来源:origin: prestodb/presto
public static Block createTestBlock()
{
BlockBuilder blockBuilder = REAL.createBlockBuilder(null, 30);
REAL.writeLong(blockBuilder, floatToRawIntBits(11.11F));
REAL.writeLong(blockBuilder, floatToRawIntBits(11.11F));
REAL.writeLong(blockBuilder, floatToRawIntBits(11.11F));
REAL.writeLong(blockBuilder, floatToRawIntBits(22.22F));
REAL.writeLong(blockBuilder, floatToRawIntBits(22.22F));
REAL.writeLong(blockBuilder, floatToRawIntBits(22.22F));
REAL.writeLong(blockBuilder, floatToRawIntBits(22.22F));
REAL.writeLong(blockBuilder, floatToRawIntBits(22.22F));
REAL.writeLong(blockBuilder, floatToRawIntBits(33.33F));
REAL.writeLong(blockBuilder, floatToRawIntBits(33.33F));
REAL.writeLong(blockBuilder, floatToRawIntBits(44.44F));
return blockBuilder.build();
}
代码示例来源:origin: prestodb/presto
@OutputFunction("map(real,real)")
public static void output(@AggregationState DoubleHistogramAggregation.State state, BlockBuilder out)
{
if (state.get() == null) {
out.appendNull();
}
else {
Map
BlockBuilder entryBuilder = out.beginBlockEntry();
for (Map.Entry
REAL.writeLong(entryBuilder, floatToRawIntBits(entry.getKey().floatValue()));
REAL.writeLong(entryBuilder, floatToRawIntBits(entry.getValue().floatValue()));
}
out.closeEntry();
}
}
}
代码示例来源:origin: prestodb/presto
public static void output(LongState count, DoubleState sum, BlockBuilder out)
{
if (count.getLong() == 0) {
out.appendNull();
}
else {
REAL.writeLong(out, floatToIntBits((float) (sum.getDouble() / count.getLong())));
}
}
}
代码示例来源:origin: prestodb/presto
@OutputFunction(StandardTypes.REAL)
public static void output(@AggregationState LongAndDoubleState state, BlockBuilder out)
{
long count = state.getLong();
if (count == 0) {
out.appendNull();
}
else {
REAL.writeLong(out, floatToRawIntBits((float) Math.exp(state.getDouble() / count)));
}
}
}
代码示例来源:origin: prestodb/presto
@OutputFunction(StandardTypes.REAL)
public static void output(@AggregationState NullableDoubleState state, BlockBuilder out)
{
if (state.isNull()) {
out.appendNull();
}
else {
REAL.writeLong(out, floatToRawIntBits((float) state.getDouble()));
}
}
}
代码示例来源:origin: prestodb/presto
@OutputFunction(StandardTypes.REAL)
public static void corr(@AggregationState CorrelationState state, BlockBuilder out)
{
double result = getCorrelation(state);
if (Double.isFinite(result)) {
long resultBits = floatToRawIntBits((float) result);
REAL.writeLong(out, resultBits);
}
else {
out.appendNull();
}
}
}
代码示例来源:origin: prestodb/presto
public static Block createSequenceBlockOfReal(int start, int end)
{
BlockBuilder builder = REAL.createFixedSizeBlockBuilder(end - start);
for (int i = start; i
}
return builder.build();
}
代码示例来源:origin: prestodb/presto
@Override
public Block[] getSequenceBlocks(int start, int length)
{
BlockBuilder blockBuilder = REAL.createBlockBuilder(null, length);
for (int i = start; i
}
return new Block[] {blockBuilder.build()};
}
代码示例来源:origin: prestodb/presto
@Override
public Block[] getSequenceBlocks(int start, int length)
{
BlockBuilder blockBuilder = REAL.createBlockBuilder(null, length);
for (int i = start; i
}
return new Block[] {blockBuilder.build()};
}
代码示例来源:origin: prestodb/presto
@AggregationFunction("covar_samp")
@OutputFunction(StandardTypes.REAL)
public static void covarSamp(@AggregationState CovarianceState state, BlockBuilder out)
{
if (state.getCount() <= 1) {
out.appendNull();
}
else {
double result = getCovarianceSample(state);
REAL.writeLong(out, Float.floatToRawIntBits((float) result));
}
}
代码示例来源:origin: prestodb/presto
@AggregationFunction("regr_slope")
@OutputFunction(StandardTypes.REAL)
public static void regrSlope(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionSlope(state);
if (Double.isFinite(result)) {
REAL.writeLong(out, floatToRawIntBits((float) result));
}
else {
out.appendNull();
}
}
代码示例来源:origin: prestodb/presto
@Override
public Block[] getSequenceBlocks(int start, int length)
{
BlockBuilder blockBuilder = REAL.createBlockBuilder(null, length);
for (int i = start; i
}
return new Block[] {blockBuilder.build()};
}
代码示例来源:origin: prestodb/presto
@AggregationFunction("covar_pop")
@OutputFunction(StandardTypes.REAL)
public static void covarPop(@AggregationState CovarianceState state, BlockBuilder out)
{
if (state.getCount() == 0) {
out.appendNull();
}
else {
double result = getCovariancePopulation(state);
REAL.writeLong(out, Float.floatToRawIntBits((float) result));
}
}
}
代码示例来源:origin: prestodb/presto
@AggregationFunction("regr_intercept")
@OutputFunction(StandardTypes.REAL)
public static void regrIntercept(@AggregationState RegressionState state, BlockBuilder out)
{
double result = getRegressionIntercept(state);
if (Double.isFinite(result)) {
REAL.writeLong(out, floatToRawIntBits((float) result));
}
else {
out.appendNull();
}
}
}
代码示例来源:origin: prestodb/presto
@OutputFunction("array(real)")
public static void output(@AggregationState DigestAndPercentileArrayState state, BlockBuilder out)
{
QuantileDigest digest = state.getDigest();
List
if (percentiles == null || digest == null) {
out.appendNull();
return;
}
BlockBuilder blockBuilder = out.beginBlockEntry();
for (int i = 0; i
REAL.writeLong(blockBuilder, floatToRawIntBits(sortableIntToFloat((int) digest.getQuantile(percentile))));
}
out.closeEntry();
}
}
代码示例来源:origin: prestodb/presto
@OutputFunction(StandardTypes.REAL)
public static void output(@AggregationState DigestAndPercentileState state, BlockBuilder out)
{
QuantileDigest digest = state.getDigest();
double percentile = state.getPercentile();
if (digest == null || digest.getCount() == 0.0) {
out.appendNull();
}
else {
checkState(percentile != -1.0, "Percentile is missing");
checkCondition(0 <= percentile && percentile <= 1, INVALID_FUNCTION_ARGUMENT, "Percentile must be between 0 and 1");
REAL.writeLong(out, floatToRawIntBits(sortableIntToFloat((int) digest.getQuantile(percentile))));
}
}
}
代码示例来源:origin: prestodb/presto
private static Block createBlockOfReals(Iterable
{
BlockBuilder builder = REAL.createBlockBuilder(null, 100);
for (Float value : values) {
if (value == null) {
builder.appendNull();
}
else {
REAL.writeLong(builder, floatToRawIntBits(value));
}
}
return builder.build();
}
代码示例来源:origin: prestodb/presto
@ScalarFunction("values_at_quantiles")
@Description("For each input q between [0, 1], find the value whose rank in the sorted sequence of the n values represented by the qdigest is qn.")
@SqlType("array(real)")
public static Block valuesAtQuantilesReal(@SqlType("qdigest(real)") Slice input, @SqlType("array(double)") Block percentilesArrayBlock)
{
QuantileDigest digest = new QuantileDigest(input);
BlockBuilder output = REAL.createBlockBuilder(null, percentilesArrayBlock.getPositionCount());
for (int i = 0; i
}
return output.build();
}
代码示例来源:origin: prestodb/presto
private static Page makeInput(int numberOfBuckets)
{
PageBuilder builder = new PageBuilder(ImmutableList.of(BIGINT, REAL, DOUBLE));
for (int i = 0; i <100; i++) {
builder.declarePosition();
BIGINT.writeLong(builder.getBlockBuilder(0), numberOfBuckets);
REAL.writeLong(builder.getBlockBuilder(1), i); // value
DOUBLE.writeDouble(builder.getBlockBuilder(2), 1); // weight
}
return builder.build();
}
}