Skip to content

Instantly share code, notes, and snippets.

View leonpanokarren's full-sized avatar

leonpanokarren

View GitHub Profile
/*
Following queries perform the tests described here -
* I run tests with 3 probability distributions, in order -
- Log Normal
- Normal
- Uniform
1. I pick random samples (10MM) from the distribution (so I know quantiles apriori)
presto> SET SESSION experimental_functions_enabled=True;
SET SESSION
# scaling without `relatively` changing (shape of the) distribution should not move medians
presto> WITH vector AS (
-> SELECT idx
-> FROM (
-> SELECT FLATTEN(TRANSFORM(SEQUENCE(1, 10000), x -> TRANSFORM(SEQUENCE(1, 1000), y -> RANDOM(100000)))) AS seq
-> )
-> CROSS JOIN UNNEST(seq) AS _(idx)
-> )
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024M; support was removed in 8.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.facebook.presto:presto-main >-------------------
[INFO] Building presto-main 0.242-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from nexus: https://maven.thefacebook.com/nexus/content/groups/public/com/facebook/presto/presto-geospatial-toolkit/0.242-SNAPSHOT/maven-metadata.xml
Progress (1): 1.5 kB
Downloaded from nexus: https://maven.thefacebook.com/nexus/content/groups/public/com/facebook/presto/presto-geospatial-toolkit/0.242-SNAPSHOT/maven-metadata.xml (1.5 kB at 934 B/s)
@leonpanokarren
leonpanokarren / practice_test_01.py
Created June 20, 2020 20:40
Hansel practice test 01
#### QUESTION NO 5 LIST LESS THAN 10###
new_list = []
number_list = [1 ,2 ,3 ,5 ,8 , 13 , 21 , 34 , 55 ,89]
input_number = int(input("Enter a number for list\n"))
if input_number not in number_list:
print("Entered number is not present in listing")
else:
for number in number_list:
if number < input_number:
@leonpanokarren
leonpanokarren / HackerLanguage.py
Created September 9, 2018 05:11
HackerLanguage Exercise solution
import re
import collections
class HackerLanguage:
def __init__(self, flag_character=':', **kwargs):
self.message = ''
self.flag_character = flag_character
def write(self, message):
import os
import sys
import argparse
import multiprocessing
import queue
BLOCK_SIZE = 8000
def parse_options():
parser = argparse.ArgumentParser(description="find(grep for) a word in argument files")
Select
case
when session_category = 2 and y.SessionId is not null
then 3
when session_category = 2
then 2
else 1
end session_category
, count(distinct x.UserId) user_count
from
Ticket|Ticket_Action_Id|Ticket_Action_Type
100|10001|Swap
100|10002|Swap
100|10003|Swap
200|20001|Reseat
200|20002|Swap
200|20003|Reimage
300|30001|Reboot
300|30002|Swap