Skip to content

Instantly share code, notes, and snippets.

@wendigo
Forked from findepi/trino-dev-cheat-sheet.md
Last active July 2, 2020 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wendigo/8257421da68fd3583a76e9748b6d97f9 to your computer and use it in GitHub Desktop.
Save wendigo/8257421da68fd3583a76e9748b6d97f9 to your computer and use it in GitHub Desktop.

Source: https://gist.github.com/findepi/04c96f0f60dcc95329f569bb0c44a0cd .

product test env just as product tests do

./presto-product-tests/conf/docker/singlenode/compose.sh up hadoop-master presto-master
./presto-product-tests/conf/docker/singlenode/compose.sh run application-runner /docker/volumes/conf/docker/files/presto-cli.sh --debug --catalog hive --schema default --user hive

kill and remove all docker containers

docker ps -a | tail -n+2 | grep . && docker ps -aq | xargs docker rm -f ; docker volume prune -f

sphinx

/usr/local/opt/sphinx-doc/bin/sphinx-build presto-docs/src/main/sphinx /tmp/test-doc

network grepping

sudo ngrep -s0 -W byline -d lo0

extract exception stacktrace from query JSON

jq -r ' .failureInfo | [ .type + ": " + .message, (.stack[] | "    at " + .) ][] ' < query.json

postgresql as configured for postgresql connector in presto-main

docker run -p 15432:5432 --rm -i -e POSTGRES_USER=test -e POSTGRES_PASSWORD=test -e POSTGRES_DB=test \
    --name postgres postgres
# docker exec -itu postgres postgres psql -U test -d test

sqlserver

docker run -p 1433:1433 --rm -i -e ACCEPT_EULA=Y -e SA_PASSWORD=SQLServerPass1 \
    --name sqlserver microsoft/mssql-server-linux:2017-CU13
# docker exec -it sqlserver /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P SQLServerPass1

mysql

# for product tests' mysql
docker exec -it ptl-mysql mysql -u test -ptest -D test

git bisect with plain test

git bisect run bash -xeuc '
  ./mvnw clean install -am -pl presto-tests -TC2 -DskipTests \
    -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dair.check.skip-all=true || exit 125
  ./mvnw test -pl presto-tests -Dair.check.skip-all=true -Dtest=TestLocalQueriesA#test
'

git bisect with product tests

git bisect run bash -xeuc '
  { ./mvnw clean install -am -pl \!presto-server-rpm,\!presto-docs -DskipTests \
    -Dair.check.skip-all=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -TC2 || exit 125; } \
  && time ./presto-product-tests/bin/run_on_docker.sh singlenode -g tpcds -x quarantine -t q98'

run product test quick

java -jar presto-product-tests/target/presto-product-tests-*-executable.jar -c presto-product-tests/src/main/resources/sql-tests -g tpch -t q17

check all commits compile

git rebase master -x './mvnw clean package -pl \!presto-server-rpm,\!presto-docs -TC2 -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true'

sort commits for GitHub

git rebase master -x 'git ci --am -C HEAD --date="$(date -R)" && sleep 1.05'

quick build parser alone

./mvnw clean install -pl presto-parser -TC2 -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dair.check.skip-all=true

quick build

./mvnw -pl '!presto-server-rpm,!presto-docs,!presto-proxy,!presto-testing-server-launcher,!presto-verifier' clean install -TC2 -nsu -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dair.check.skip-all=true

grepping logs

  • for failures: INFO: FAILURE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment