Skip to content

Instantly share code, notes, and snippets.

View losipiuk's full-sized avatar

Łukasz Osipiuk losipiuk

View GitHub Profile
@losipiuk
losipiuk / gist:3046495
Created July 4, 2012 10:02
UnfinishedChunkedHttpRequestIsLastFlagTest.java
import junit.framework.TestCase;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.handler.codec.embedder.DecoderEmbedder;
import org.jboss.netty.handler.codec.http.HttpChunk;
import org.jboss.netty.handler.codec.http.HttpMessage;
import org.jboss.netty.handler.codec.http.HttpServerCodec;
import java.nio.charset.Charset;
@losipiuk
losipiuk / gazeta_tv_disable_autoplay.js
Last active August 29, 2015 14:18
tampermonkey: disable autoplay for gazeta.tv
// ==UserScript==
// @name Disable autoplay on gazeta.pl
// @namespace http://your.homepage/
// @version 0.1
// @description Disables autoplay for iframe movies coming from www.gazeta.tv
// @author Lukasz Osipiuk
// @match http://*gazeta.pl/*
// @match http://*.sport.pl/*
// @grant none
// ==/UserScript==
package com.facebook.presto.type;
import com.facebook.presto.operator.scalar.ScalarFunction;
import io.airlift.slice.Slice;
import java.math.BigInteger;
import static java.math.BigInteger.TEN;
import static java.util.Arrays.asList;
@losipiuk
losipiuk / DecimalOperators.java
Created October 23, 2015 11:15
decimal operators annotations
@ScalarOperator(ADD)
@SqlType("decimal(min(38, p + 1), s)")
public static long addShortShortShort(@SqlType("decimal(p,s)") long a, @SqlType("decimal(p,s)") long b)
{
return a + b;
}
@ScalarOperator(ADD)
@SqlType("decimal(min(38, p + 1), s)")
public static Slice addShortShortLong(@SqlType("decimal(p,s)") long a, @SqlType("decimal(p,s)") long b)
@losipiuk
losipiuk / DecimalOperators.java
Created October 23, 2015 11:16
decimal operators builder
public static final ParametricFunction DECIMAL_ADD_OPERATOR = decimalAddOperator();
private static ParametricFunction decimalAddOperator()
{
Signature signature = Signature.builder()
.type(SCALAR)
.operatorType(ADD)
.argumentTypes("decimal(p, s)", "decimal(p, s)")
.returnType("decimal(min(38, p + 1), s)")
.build();
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/presto-main/src/main/java/com/facebook/presto/operator/HashBuilderOperator.java b/presto-main/src/main/java/com/facebook/presto/operator/HashBuilderOperator.java
index 4f64850..9525c22 100644
--- a/presto-main/src/main/java/com/facebook/presto/operator/HashBuilderOperator.java
+++ b/presto-main/src/main/java/com/facebook/presto/operator/HashBuilderOperator.java
@@ -17,7 +17,6 @@ import com.facebook.presto.spi.Page;
import com.facebook.presto.spi.type.Type;
import com.facebook.presto.sql.planner.Symbol;
import com.facebook.presto.sql.planner.plan.PlanNodeId;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
@Description("current time with time zone")
@ScalarFunction
@SqlType(StandardTypes.TIME_WITH_TIME_ZONE)
public static long currentTime(ConnectorSession session)
{
// We do all calculation in UTC, as session.getStartTime() is in UTC
// and we need to have UTC millis for packDateTimeWithZone
long millis = UTC_CHRONOLOGY.millisOfDay().get(session.getStartTime());
if (!session.isLegacyTimestamp()) {
[
{
"jmhVersion" : "1.20",
"benchmark" : "io.trino.sql.gen.BenchmarkInCodeGenerator.benchmark",
"mode" : "avgt",
"threads" : 1,
"forks" : 2,
"jvm" : "/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java",
"jvmArgs" : [
"-Dvisualvm.id=376605065787142",
This file has been truncated, but you can view the full file.
[
{
"jmhVersion" : "1.20",
"benchmark" : "io.trino.sql.gen.BenchmarkInCodeGenerator.benchmark",
"mode" : "avgt",
"threads" : 1,
"forks" : 2,
"jvm" : "/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java",
"jvmArgs" : [
"-Dvisualvm.id=361297115645069",