Skip to content

Instantly share code, notes, and snippets.

@posulliv
posulliv / docker-compose.yml
Last active Jan 27, 2022
Simple demo of Trino HA using Nginx reverse proxy.
View docker-compose.yml
version: '3.3'
services:
trino_a:
image: trinodb/trino
container_name: trino_a
ports:
- 8080:8080
volumes:
- ./trino_a.config.properties:/etc/trino/config.properties
View date_pushdown.java
@Test
public void testPredicatePushdownWithDate()
{
String tableName = "predicate_test";
tester().getQueryRunner().execute(format("CREATE TABLE %s (a, b) AS SELECT DATE '2020-10-20', 6", tableName));
PushPredicateIntoTableScan pushPredicateIntoTableScan = new PushPredicateIntoTableScan(
tester().getMetadata(),
new TypeOperators(),
tester().getTypeAnalyzer());
@posulliv
posulliv / presto.patch
Created Oct 12, 2020
Patch for Apache Atlas version 2.1.0 to allow Hive Metastore hook to work correctly with Presto.
View presto.patch
--- addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveMetastoreHookImpl.java 2020-10-12 09:54:29.000000000 -0400
+++ addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveMetastoreHookImpl.java.presto 2020-10-12 10:44:24.000000000 -0400
@@ -17,6 +17,8 @@
*/
package org.apache.atlas.hive.hook;
+import com.google.common.collect.MapDifference;
+import com.google.common.collect.Maps;
import org.apache.atlas.hive.hook.events.*;
import org.apache.atlas.hook.AtlasHook;
View gist:6556864
[ RECORD 4 ]-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
View test.php
<?php
$test = '<div>(1) (4) (8) (22) (101)</div>';
$pattern = '/\((\d+)\)/';
$replacement = '<padraig>(${1})</padraig>';
echo preg_replace($pattern, $replacement, $test) . "\n";
?>
View output.md
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 83.58  248.894290        2919     85260      6809 futex
  7.33   21.825363       81743       267           nanosleep
  6.16   18.341146       81156       226           select
  1.56    4.658605         119     39106           fsync
  1.08    3.216201      459457         7         6 restart_syscall
  0.14    0.413560          14     29478           munmap
  0.07    0.205368           7     29478           mmap
View gist:5460161
1955 __memset_sse2,os_aio_linux_collect(string3.h:85),os_aio_linux_handle(string3.h:85),fil_aio_wait(fil0fil.c:4620),io_handler_thread(srv0start.c:482),start_thread,clone,??
1386 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),kwait(toku_pthread.h:294),work_on_kibbutz(toku_pthread.h:294),start_thread,clone,??
397 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),minicron_do(toku_pthread.h:310),start_thread,clone,??
200 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),minicron_do(toku_pthread.h:294),start_thread,clone,??
200 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),evictor::run_eviction_thread(toku_pthread.h:310),eviction_thread(cachetable.cc:3615),start_thread,clone,??
200 pthread_cond_timedwait,os_cond_wait_timed(os0sync.c:171),os_event_wait_time_low(os0sync.c:171),srv_monitor_thread(srv0srv.c:2171),start_thread,clone,??
200 pthread_cond_timedwait,os_cond_wait_timed(os0sync.c:171),os_event_wait_time_low(os0sync.c:171),srv_lock_timeout_thre
View gist:5459752
1943 __memset_sse2,os_aio_linux_collect(string3.h:85),os_aio_linux_handle(string3.h:85),fil_aio_wait(fil0fil.c:4620),io_handler_thread(srv0start.c:482),start_thread,clone,??
1379 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),kwait(toku_pthread.h:294),work_on_kibbutz(toku_pthread.h:294),start_thread,clone,??
388 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),minicron_do(toku_pthread.h:310),start_thread,clone,??
200 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),toku_thread_run_internal(toku_pthread.h:294),start_thread,clone,??
200 pthread_cond_wait,toku_cond_wait(toku_pthread.h:294),minicron_do(toku_pthread.h:294),start_thread,clone,??
200 pthread_cond_timedwait,toku_cond_timedwait(toku_pthread.h:310),evictor::run_eviction_thread(toku_pthread.h:310),eviction_thread(cachetable.cc:3615),start_thread,clone,??
200 pthread_cond_timedwait,os_cond_wait_timed(os0sync.c:171),os_event_wait_time_low(os0sync.c:171),srv_monitor_thread(srv0srv.c:2171),start_thread,clone
@posulliv
posulliv / time.md
Created Apr 25, 2013
some strace output
View time.md

command run

strace -c -f -p PID

output

% time     seconds  usecs/call     calls    errors syscall
@posulliv
posulliv / time.md
Created Apr 25, 2013
some strace output
View time.md

command run

strace -c -f -p PID

output

% time     seconds  usecs/call     calls    errors syscall