Skip to content

Instantly share code, notes, and snippets.

@takezoe
takezoe / RowChecksumFunction.java
Created February 25, 2024 17:05
Trino UDF for generating row-level checksum
package io.trino.operator.scalar;
import com.google.common.collect.ImmutableList;
import io.airlift.slice.Slice;
import io.airlift.slice.Slices;
import io.trino.annotation.UsedByGeneratedCode;
import io.trino.metadata.SqlScalarFunction;
import io.trino.spi.block.Block;
import io.trino.spi.block.SqlRow;
import io.trino.spi.function.BoundSignature;
@takezoe
takezoe / jupyter_on_docker.md
Last active April 29, 2023 05:50
Run JupyterLab on Docker

Run JupyterLab on docker

https://hub.docker.com/r/jupyter/scipy-notebook/

$ docker pull jupyter/scipy-notebook

$ docker run -v `pwd`:/home/jovyan/work -p 10000:8888 --name jupyter jupyter/scipy-notebook
...
 To access the server, open this file in a browser:
@takezoe
takezoe / vscode_metals.md
Last active March 12, 2022 00:35
Keyboard shortcuts in VSCode + Metals

VS Code shortcut in VSCode + Metals

Shorcut Description
CTRL + SPACE Code Completion
COMMAND + P Find File
COMMAND + SHIFT + P Command Pallete
COMMAND + T Find Symbol in Workspace
SHIFT + COMMAND + O Find Symbol in Editor
F12 Go to Definition
@takezoe
takezoe / trino_test.rb
Created May 7, 2021 16:38
Test program for trino-client-ruby using tiny-presto which is library to launch Trino/Presto using docker
require 'trino-client'
require 'tiny-presto'
client = Trino::Client.new(server: 'localhost:8080', catalog: 'memory', user: 'test-user', schema: 'default')
cluster = TinyPresto::Cluster.new('trinodb/trino', '355')
container = cluster.run
loop do
begin
# Make sure to all workers are available.
client.run('show schemas')
@takezoe
takezoe / build.yml
Last active January 23, 2021 16:16
GitHub Actions configuration for GitBucket plugins
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
trait CyclicA {
val b = bind[CyclicB]
}
trait CyclicB {
val a = bind[CyclicA]
}
val d = Design.newDesign
d.build[CyclicA] { a =>

Hello Apache PredictionIO!

Start event server:

$ pio eventserver &
diff --git a/swagger/src/main/scala/org/scalatra/swagger/Swagger.scala b/swagger/src/main/scala/org/scalatra/swagger/Swagger.scala
index 97e00e46..f5525ca2 100644
--- a/swagger/src/main/scala/org/scalatra/swagger/Swagger.scala
+++ b/swagger/src/main/scala/org/scalatra/swagger/Swagger.scala
@@ -45,16 +45,6 @@ trait SwaggerEngine[T <: SwaggerApi[_]] {
object Swagger {
- val excludes: Set[java.lang.reflect.Type] = Set(
- classOf[java.util.TimeZone],

Test data:

{"maker":"Apple", "products":[{"name": "iPhobe", "price": 100000}, {"name": "iPad", "price": 120000}]}
{"maker":"ASUS", "products":[{"name": "Zenfone", "price": 20000}]}

DataFrame:

scala> val df = ds.select(ds("maker"),explode(ds("products")).as("p"))
scala&gt; df.select("maker", "p.name", "p.price").show