Skip to content
Snippets Groups Projects
  • Ngoc Khuat's avatar
    5a80e561
    Advanced datetime extraction (#25277) · 5a80e561
    Ngoc Khuat authored
    * Implement advanced date/time/zone manipulation, part 1
    
    Incorporate new functions into MBQL and add tests:
     - get-year
     - get-quarter
     - get-month
     - get-day
     - get-day-of-week
     - get-hour
     - get-minute
     - get-second
    
    * Fix BigQuery implementations to call extract
    
    Mark as not supported in legacy driver
    
    * Add date extraction fns for Postgres
    
    * Disable in MongoDB (for now at least)
    
    Disable in BigQuery (legacy driver)
    
    Add implementations for presto-jdbc
    
    * Misc cleanup from Jeff's PR
    
    * Update Jeff's implementation of bigquery-cloud-sqk
    
    * Reorganized tests
    
    * Mongo
    
    * Oracle
    
    * Sqlserver
    
    * Sqlite
    
    * Add casting supports for presto
    
    * Remove Jeff's implementation of presto-jdbc because  its parent is
    sql-jdbc
    
    * Update presto-jdbc tests to use the same catalog for all datasets
    
    * Add date extraction functions to the expression editor (#25382)
    
    * make sure the semantic type of aggregated columns are integer
    
    * no recursive call in annotate for date-extract func
    
    * get-unit -> temporal-extract(column, unit)
    
    * desguar nested datetime extraction too
    Advanced datetime extraction (#25277)
    Ngoc Khuat authored
    * Implement advanced date/time/zone manipulation, part 1
    
    Incorporate new functions into MBQL and add tests:
     - get-year
     - get-quarter
     - get-month
     - get-day
     - get-day-of-week
     - get-hour
     - get-minute
     - get-second
    
    * Fix BigQuery implementations to call extract
    
    Mark as not supported in legacy driver
    
    * Add date extraction fns for Postgres
    
    * Disable in MongoDB (for now at least)
    
    Disable in BigQuery (legacy driver)
    
    Add implementations for presto-jdbc
    
    * Misc cleanup from Jeff's PR
    
    * Update Jeff's implementation of bigquery-cloud-sqk
    
    * Reorganized tests
    
    * Mongo
    
    * Oracle
    
    * Sqlserver
    
    * Sqlite
    
    * Add casting supports for presto
    
    * Remove Jeff's implementation of presto-jdbc because  its parent is
    sql-jdbc
    
    * Update presto-jdbc tests to use the same catalog for all datasets
    
    * Add date extraction functions to the expression editor (#25382)
    
    * make sure the semantic type of aggregated columns are integer
    
    * no recursive call in annotate for date-extract func
    
    * get-unit -> temporal-extract(column, unit)
    
    * desguar nested datetime extraction too
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
run-presto-kerberos-integration-test.sh 2.60 KiB
#! /usr/bin/env bash
# runs one or more Metabase test(s) against a Kerberized Presto instance
set -eo pipefail

# Need Java commands on $PATH, which apparently is not yet the case
export JAVA_HOME="/usr/lib/jvm/msopenjdk-current"
export PATH="$PATH:$JAVA_HOME/bin"

# ensure java commmand is available
which java

# install clojure version needed for Metabase
curl -O https://download.clojure.org/install/linux-install-1.11.0.1100.sh
chmod +x linux-install-1.11.0.1100.sh
./linux-install-1.11.0.1100.sh

RESOURCES_DIR=/app/source/resources

# ensure the expected files are in place, in the resources dir
if [ ! -f "$RESOURCES_DIR/ssl_keystore.jks" ]; then
  echo "$RESOURCES_DIR/ssl_keystore.jks does not exist; cannot run test" >&2
  exit 11
fi

if [ ! -f "$RESOURCES_DIR/krb5.conf" ]; then
  echo "$RESOURCES_DIR/krb5.conf does not exist; cannot run test" >&2
  exit 12
fi

if [ ! -f "$RESOURCES_DIR/client.keytab" ]; then
  echo "$RESOURCES_DIR/client.keytab does not exist; cannot run test" >&2
  exit 13
fi

# Copy the JDK cacerts file to our resources
cp $JAVA_HOME/lib/security/cacerts $RESOURCES_DIR/cacerts-with-presto-ca.jks

# Capture the Presto server self signed CA in PEM format
openssl s_client -showcerts -connect presto-kerberos:7778 </dev/null \
  | openssl x509 -outform PEM >$RESOURCES_DIR/presto-ssl-root-ca.pem

# Convert the Presto server self signed CA to DER format
openssl x509 -outform der -in $RESOURCES_DIR/presto-ssl-root-ca.pem  -out $RESOURCES_DIR/presto-ssl-root-ca.der

# Add Presto's self signed CA to the truststore
keytool -noprompt -import -alias presto-kerberos -keystore $RESOURCES_DIR/cacerts-with-presto-ca.jks \
        -storepass changeit -file $RESOURCES_DIR/presto-ssl-root-ca.der -trustcacerts

# Set up the environment variables pointing to all of this, and run some tests
DRIVERS=presto-jdbc \
MB_ENABLE_PRESTO_JDBC_DRIVER=true \
MB_PRESTO_JDBC_TEST_HOST=presto-kerberos \
MB_PRESTO_JDBC_TEST_PORT=7778 \
MB_PRESTO_JDBC_TEST_SSL=true \
MB_PRESTO_JDBC_TEST_SSL_KEYSTORE_PATH=$RESOURCES_DIR/ssl_keystore.jks \
MB_PRESTO_JDBC_TEST_SSL_KEYSTORE_PASSWORD=presto \
MB_PRESTO_JDBC_TEST_SSL_TRUSTSTORE_PATH=$RESOURCES_DIR/cacerts-with-presto-ca.jks \
MB_PRESTO_JDBC_TEST_SSL_TRUSTSTORE_PASSWORD=changeit \
MB_PRESTO_JDBC_TEST_KERBEROS=true \
MB_PRESTO_JDBC_TEST_USER=bob@EXAMPLE.COM \
MB_PRESTO_JDBC_TEST_KERBEROS_PRINCIPAL=bob@EXAMPLE.COM \
MB_PRESTO_JDBC_TEST_KERBEROS_REMOTE_SERVICE_NAME=HTTP \
MB_PRESTO_JDBC_TEST_KERBEROS_KEYTAB_PATH=$RESOURCES_DIR/client.keytab \
MB_PRESTO_JDBC_TEST_KERBEROS_CONFIG_PATH=$RESOURCES_DIR/krb5.conf \
clojure -X:dev:test:drivers:drivers-dev :only metabase.driver.presto-jdbc-test