diff --git a/README.md b/README.md index 02dab1af3f..1b13125133 100755 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ Hadoop testing environment to exercise the pxf automation tests ## concourse/ Resources for PXF's Continuous Integration pipelines +## regression/ +Contains the end-to-end (integration) tests for PXF against the various datasources, utilizing the PostgreSQL testing framework `pg_regress` PXF Development ================= diff --git a/concourse/README.md b/concourse/README.md index 3b385edd4d..d9b51ce564 100644 --- a/concourse/README.md +++ b/concourse/README.md @@ -128,3 +128,21 @@ The master and 5X pipelines are exposed. Here are the commands to expose the pip fly -t ud expose-pipeline -p pxf_master fly -t ud expose-pipeline -p pxf_5X_STABLE ``` + +# Deploy `pg_regress` pipeline + +This pipeline currently runs the smoke test group against the different clouds using `pg_regress` instead of automation. +It uses both external and foreign tables. +You can adjust the `folder-prefix`, `gpdb-git-branch`, `gpdb-git-remote`, `pxf-git-branch`, and `pxf-git-remote`. +For example, you may want to work off of a development branch for PXF or Greenplum. + +``` +fly -t ud set-pipeline -p pg_regress \ + -c ~/workspace/pxf/concourse/pipelines/pg_regress_pipeline.yml \ + -l ~/workspace/gp-continuous-integration/secrets/gpdb6-integration-testing.dev.yml \ + -l ~/workspace/gp-continuous-integration/secrets/ccp-integration-pipelne-secrets.yml \ + -l ~/workspace/gp-continuous-integration/secrets/gpdb_common-ci-secrets.yml \ + -v folder-prefix=dev/pivotal \ + -v gpdb-git-branch=pxf-fdw-pass-filter-string -v gpdb-git-remote=https://github.com/pivotal/gp-gpdb-dev \ + -v pxf-git-branch=master -v pxf-git-remote=https://github.com/greenplum-db/pxf \ +``` diff --git a/concourse/pipelines/pg_regress_pipeline.yml b/concourse/pipelines/pg_regress_pipeline.yml new file mode 100644 index 0000000000..7c7b4da571 --- /dev/null +++ b/concourse/pipelines/pg_regress_pipeline.yml @@ -0,0 +1,377 @@ +--- +resource_types: +- name: gcs + type: docker-image + source: + repository: frodenas/gcs-resource + +resources: + +- name: gpdb_src + type: git + source: + branch: {{gpdb-git-branch}} + uri: {{gpdb-git-remote}} + +- name: pxf_src + type: git + source: + branch: {{pxf-git-branch}} + uri: {{pxf-git-remote}} + private_key: ((ccp-git-key)) + +- name: gpdb-pxf-dev-centos7 + type: docker-image + source: + repository: pivotaldata/gpdb-pxf-dev + tag: centos7 + +- name: gpdb6-centos7-build + type: docker-image + source: + repository: pivotaldata/gpdb6-centos7-build + +- name: gpdb-pxf-dev-centos7-hdp2-server + type: docker-image + source: + repository: pivotaldata/gpdb-pxf-dev + tag: centos7-hdp2-server + +# ~/workspace/gp-continuous-integration/secrets/gpdb6-integration-testing.dev.yml +- name: libquicklz-centos7 + type: gcs + source: + bucket: ((pivotal-gp-internal-artifacts-gcs-bucket)) + json_key: ((gp-internal-artifacts-service-account-key)) + regexp: centos7/libquicklz-(\d.*)\.el7\.x86_64\.rpm + +- name: python-centos7 + type: gcs + source: + bucket: ((pivotal-gp-internal-artifacts-gcs-bucket)) + json_key: ((gp-internal-artifacts-service-account-key)) + versioned_file: centos7/python-2.7.12.tar.gz + +- name: libquicklz-devel-centos7 + type: gcs + source: + bucket: ((pivotal-gp-internal-artifacts-gcs-bucket)) + json_key: ((gp-internal-artifacts-service-account-key)) + regexp: centos7/libquicklz-devel-(\d.*)\.el7\.x86_64\.rpm + +- name: libsigar-centos7 + type: gcs + source: + bucket: ((pivotal-gp-internal-artifacts-gcs-bucket)) + json_key: ((gp-internal-artifacts-service-account-key)) + regexp: centos7/sigar-rhel7_x86_64-(.*)\.targz + +- name: pxf_tarball + type: s3 + source: + access_key_id: {{bucket-access-key-id}} + bucket: {{pxf-aws-bucket-name}} + region_name: {{aws-region}} + secret_access_key: {{bucket-secret-access-key}} + versioned_file: pxf_artifacts/((folder-prefix))_((gpdb-branch))/latest/pxf.tar.gz + +- name: bin_gpdb + type: s3 + source: + access_key_id: {{bucket-access-key-id}} + bucket: {{pxf-aws-bucket-name}} + region_name: {{aws-region}} + secret_access_key: {{bucket-secret-access-key}} + versioned_file: pxf_artifacts/((folder-prefix))_((gpdb-branch))/latest/bin_gpdb.tar.gz + +jobs: + +- name: compile_pxf + plan: + - get: pxf_src + trigger: true + - aggregate: + - get: gpdb_src + trigger: true + - get: gpdb-pxf-dev-centos7 + - task: compile_pxf + image: gpdb-pxf-dev-centos7 + file: pxf_src/concourse/tasks/compile_pxf.yml + - put: pxf_tarball + params: { file: pxf_artifacts/pxf.tar.gz } + +- name: compile_gpdb + plan: + - aggregate: + - get: gpdb_src + params: { submodules: all, submodules_recursive: true } + trigger: true + - get: gpdb6-centos7-build + - get: libquicklz-installer + resource: libquicklz-centos7 + - get: python-tarball + resource: python-centos7 + - get: libquicklz-devel-installer + resource: libquicklz-devel-centos7 + - get: libsigar-installer + resource: libsigar-centos7 + - task: compile_gpdb_centos7 + file: gpdb_src/concourse/tasks/compile_gpdb.yml + image: gpdb6-centos7-build + params: + CONFIGURE_FLAGS: '--enable-cassert --enable-debug-extensions' + TARGET_OS: centos + TARGET_OS_VERSION: 7 + BLD_TARGETS: "clients loaders" + timeout: 30m + - put: bin_gpdb + params: { file: gpdb_artifacts/bin_gpdb.tar.gz } + +- name: test_pxf + plan: + - aggregate: + - get: pxf_src + passed: + - compile_pxf + trigger: true + - get: pxf_tarball + passed: + - compile_pxf + trigger: true + - get: bin_gpdb + passed: + - compile_gpdb + trigger: true + - get: gpdb_src + passed: + - compile_pxf + - compile_gpdb + trigger: true + - get: gpdb-pxf-dev-centos7-hdp2-server + - task: test_pxf + image: gpdb-pxf-dev-centos7-hdp2-server + config: + platform: linux + inputs: + - name: gpdb_src + - name: bin_gpdb + - name: pxf_src + - name: pxf_tarball + params: + IMPERSONATION: true + TARGET_OS: centos + TARGET_OS_VERSION: 7 + HADOOP_CLIENT: HDP + GROUP: smoke_schedule,fdw_smoke_schedule + PG_REGRESS: true + run: + path: pxf_src/concourse/scripts/test_pxf.bash + +- name: test_pxf_s3 + plan: + - aggregate: + - get: pxf_src + passed: + - compile_pxf + trigger: true + - get: pxf_tarball + passed: + - compile_pxf + trigger: true + - get: bin_gpdb + passed: + - compile_gpdb + trigger: true + - get: gpdb_src + passed: + - compile_pxf + - compile_gpdb + trigger: true + - get: gpdb-pxf-dev-centos7-hdp2-server + - task: test_pxf + attempts: 2 + image: gpdb-pxf-dev-centos7-hdp2-server + config: + platform: linux + inputs: + - name: gpdb_src + - name: bin_gpdb + - name: pxf_src + - name: pxf_tarball + params: + IMPERSONATION: true + TARGET_OS: centos + TARGET_OS_VERSION: 7 + HADOOP_CLIENT: HDP + GROUP: hcfs_schedule,fdw_hcfs_schedule + PG_REGRESS: true + PROTOCOL: s3 + ACCESS_KEY_ID: {{tf-machine-access-key-id}} + SECRET_ACCESS_KEY: {{tf-machine-secret-access-key}} + run: + path: pxf_src/concourse/scripts/test_pxf.bash + +- name: test_pxf_gcs + plan: + - aggregate: + - get: pxf_src + passed: + - compile_pxf + trigger: true + - get: pxf_tarball + passed: + - compile_pxf + trigger: true + - get: bin_gpdb + passed: + - compile_gpdb + trigger: true + - get: gpdb_src + passed: + - compile_pxf + - compile_gpdb + trigger: true + - get: gpdb-pxf-dev-centos7-hdp2-server + - task: test_pxf + attempts: 2 + image: gpdb-pxf-dev-centos7-hdp2-server + config: + platform: linux + inputs: + - name: gpdb_src + - name: bin_gpdb + - name: pxf_src + - name: pxf_tarball + params: + IMPERSONATION: true + TARGET_OS: centos + TARGET_OS_VERSION: 7 + HADOOP_CLIENT: HDP + GROUP: hcfs_schedule,fdw_hcfs_schedule + PG_REGRESS: true + PROTOCOL: gs + GOOGLE_CREDENTIALS: {{data-gpdb-ud-google-json-key}} + run: + path: pxf_src/concourse/scripts/test_pxf.bash + +- name: test_pxf_wasbs + plan: + - aggregate: + - get: pxf_src + passed: + - compile_pxf + trigger: true + - get: pxf_tarball + passed: + - compile_pxf + trigger: true + - get: bin_gpdb + passed: + - compile_gpdb + trigger: true + - get: gpdb_src + passed: + - compile_pxf + - compile_gpdb + trigger: true + - get: gpdb-pxf-dev-centos7-hdp2-server + - task: test_pxf + attempts: 2 + image: gpdb-pxf-dev-centos7-hdp2-server + config: + platform: linux + inputs: + - name: gpdb_src + - name: bin_gpdb + - name: pxf_src + - name: pxf_tarball + params: + IMPERSONATION: true + TARGET_OS: centos + TARGET_OS_VERSION: 7 + HADOOP_CLIENT: HDP + GROUP: hcfs_schedule,fdw_hcfs_schedule + PG_REGRESS: true + PROTOCOL: wasbs + WASBS_ACCOUNT_NAME: {{wasb-account-name}} + WASBS_ACCOUNT_KEY: {{wasb-account-key}} + run: + path: pxf_src/concourse/scripts/test_pxf.bash + +- name: test_pxf_adl + plan: + - aggregate: + - get: pxf_src + passed: + - compile_pxf + trigger: true + - get: pxf_tarball + passed: + - compile_pxf + trigger: true + - get: bin_gpdb + passed: + - compile_gpdb + trigger: true + - get: gpdb_src + passed: + - compile_pxf + - compile_gpdb + trigger: true + - get: gpdb-pxf-dev-centos7-hdp2-server + - task: test_pxf + attempts: 2 + image: gpdb-pxf-dev-centos7-hdp2-server + config: + platform: linux + inputs: + - name: gpdb_src + - name: bin_gpdb + - name: pxf_src + - name: pxf_tarball + params: + IMPERSONATION: true + TARGET_OS: centos + TARGET_OS_VERSION: 7 + HADOOP_CLIENT: HDP + GROUP: hcfs_schedule,fdw_hcfs_schedule + PG_REGRESS: true + PROTOCOL: adl + ADL_ACCOUNT: {{adl-account}} + ADL_OAUTH2_CLIENT_ID: {{adl-client-id}} + ADL_OAUTH2_CREDENTIAL: {{adl-credential}} + ADL_OAUTH2_REFRESH_URL: {{adl-refresh-url}} + run: + path: pxf_src/concourse/scripts/test_pxf.bash + +- name: test_pxf_minio + plan: + - aggregate: + - get: pxf_src + passed: + - compile_pxf + trigger: true + - get: pxf_tarball + passed: + - compile_pxf + trigger: true + - get: bin_gpdb + passed: + - compile_gpdb + trigger: true + - get: gpdb_src + passed: + - compile_pxf + - compile_gpdb + trigger: true + - get: gpdb-pxf-dev-centos7-hdp2-server + - task: test_pxf + file: pxf_src/concourse/tasks/test_pxf.yml + image: gpdb-pxf-dev-centos7-hdp2-server + params: + GROUP: hcfs_schedule,fdw_hcfs_schedule + PG_REGRESS: true + IMPERSONATION: false + PROTOCOL: minio + TARGET_OS: centos + TARGET_OS_VERSION: 7 diff --git a/concourse/scripts/pxf_common.bash b/concourse/scripts/pxf_common.bash index 20ad3a8f84..a789e84154 100755 --- a/concourse/scripts/pxf_common.bash +++ b/concourse/scripts/pxf_common.bash @@ -329,15 +329,152 @@ function init_and_configure_pxf_server() { fi } +function configure_hdfs_client_for_s3() { + S3_CORE_SITE_XML=$(mktemp) + cat <<-EOF > "${S3_CORE_SITE_XML}" + + fs.s3a.access.key + ${ACCESS_KEY_ID} + + + fs.s3a.secret.key + ${SECRET_ACCESS_KEY} + + EOF + sed -i -e "//r ${S3_CORE_SITE_XML}" "${GPHD_ROOT}/hadoop/etc/hadoop/core-site.xml" +} + +function configure_hdfs_client_for_minio() { + MINIO_CORE_SITE_XML=$(mktemp) + cat <<-EOF > "${MINIO_CORE_SITE_XML}" + + fs.s3a.endpoint + http://localhost:9000 + + + fs.s3a.access.key + ${ACCESS_KEY_ID} + + + fs.s3a.secret.key + ${SECRET_ACCESS_KEY} + + EOF + sed -i -e "//r ${MINIO_CORE_SITE_XML}" "${GPHD_ROOT}/hadoop/etc/hadoop/core-site.xml" +} + +function configure_hdfs_client_for_gs() { + cp "${PXF_HOME}/lib/shared/"gcs-connector-*-hadoop2-shaded.jar \ + "${GPHD_ROOT}/hadoop/share/hadoop/hdfs/lib" + GS_CORE_SITE_XML=$(mktemp) + cat <<-EOF > "${GS_CORE_SITE_XML}" + + fs.AbstractFileSystem.gs.impl + com.google.cloud.hadoop.fs.gcs.GoogleHadoopFS + The AbstractFileSystem for gs: uris. + + + google.cloud.auth.service.account.enable + true + + Whether to use a service account for GCS authorization. + Setting this property to \`false\` will disable use of service accounts for + authentication. + + + + google.cloud.auth.service.account.json.keyfile + ${GOOGLE_KEYFILE} + + The JSON key file of the service account used for GCS + access when google.cloud.auth.service.account.enable is true. + + + EOF + sed -i -e "//r ${GS_CORE_SITE_XML}" "${GPHD_ROOT}/hadoop/etc/hadoop/core-site.xml" +} + +function configure_hdfs_client_for_adl() { + cp "${PXF_HOME}/lib/shared/"azure-data-lake-store-sdk-*.jar \ + "${PXF_HOME}/lib/shared/"hadoop-azure-*.jar \ + "${PXF_HOME}/lib/shared/"hadoop-azure-datalake-*.jar \ + "${PXF_HOME}/lib/shared/"hadoop-common-*.jar \ + "${PXF_HOME}/lib/shared/"htrace-core4-*-incubating.jar \ + "${PXF_HOME}/lib/shared/"stax2-api-*.jar \ + "${PXF_HOME}/lib/shared/"woodstox-core-*.jar "${GPHD_ROOT}/hadoop/share/hadoop/common/lib" + ADL_CORE_SITE_XML=$(mktemp) + cat <<-EOF > "${ADL_CORE_SITE_XML}" + + fs.adl.oauth2.access.token.provider.type + ClientCredential + + + fs.adl.oauth2.refresh.url + ${ADL_OAUTH2_REFRESH_URL} + + + fs.adl.oauth2.client.id + ${ADL_OAUTH2_CLIENT_ID} + + + fs.adl.oauth2.credential + ${ADL_OAUTH2_CREDENTIAL} + + EOF + sed -i -e "//r ${ADL_CORE_SITE_XML}" "${GPHD_ROOT}/hadoop/etc/hadoop/core-site.xml" +} + +function configure_hdfs_client_for_wasbs() { + WASBS_CORE_SITE_XML=$(mktemp) + cat <<-EOF > "${WASBS_CORE_SITE_XML}" + + fs.azure.account.key.${WASBS_ACCOUNT_NAME}.blob.core.windows.net + ${WASBS_ACCOUNT_KEY} + + EOF + sed -i -e "//r ${WASBS_CORE_SITE_XML}" "${GPHD_ROOT}/hadoop/etc/hadoop/core-site.xml" +} + +function configure_pxf_gs_server() { + mkdir -p ${PXF_CONF_DIR}/servers/gs + GOOGLE_KEYFILE=$(mktemp) + echo "${GOOGLE_CREDENTIALS}" > "${GOOGLE_KEYFILE}" + chown gpadmin "${GOOGLE_KEYFILE}" + sed -e "s|YOUR_GOOGLE_STORAGE_KEYFILE|${GOOGLE_KEYFILE}|" \ + ${PXF_CONF_DIR}/templates/gs-site.xml >"${PXF_CONF_DIR}/servers/gs/gs-site.xml" +} + function configure_pxf_s3_server() { - mkdir -p "${PXF_CONF_DIR}/servers/s3" - cp "${PXF_CONF_DIR}/templates/s3-site.xml" "${PXF_CONF_DIR}/servers/s3/s3-site.xml" - sed -i -e "s|YOUR_AWS_ACCESS_KEY_ID|${ACCESS_KEY_ID}|" \ + mkdir -p ${PXF_CONF_DIR}/servers/s3 + sed -e "s|YOUR_AWS_ACCESS_KEY_ID|${ACCESS_KEY_ID}|" \ + -e "s|YOUR_AWS_SECRET_ACCESS_KEY|${SECRET_ACCESS_KEY}|" \ + ${PXF_CONF_DIR}/templates/s3-site.xml >${PXF_CONF_DIR}/servers/s3/s3-site.xml + + mkdir -p ${PXF_CONF_DIR}/servers/s3-invalid + cp ${PXF_CONF_DIR}/templates/s3-site.xml ${PXF_CONF_DIR}/servers/s3-invalid/s3-site.xml +} + +function configure_pxf_minio_server() { + mkdir -p ${PXF_CONF_DIR}/servers/minio + sed -e "s|YOUR_AWS_ACCESS_KEY_ID|${ACCESS_KEY_ID}|" \ -e "s|YOUR_AWS_SECRET_ACCESS_KEY|${SECRET_ACCESS_KEY}|" \ - "${PXF_CONF_DIR}/servers/s3/s3-site.xml" + -e "s|YOUR_MINIO_URL|http://localhost:9000|" \ + ${PXF_CONF_DIR}/templates/minio-site.xml >${PXF_CONF_DIR}/servers/minio/minio-site.xml +} + +function configure_pxf_adl_server() { + mkdir -p "${PXF_CONF_DIR}/servers/adl" + sed -e "s|YOUR_ADL_REFRESH_URL|${ADL_OAUTH2_REFRESH_URL}|g" \ + -e "s|YOUR_ADL_CLIENT_ID|${ADL_OAUTH2_CLIENT_ID}|g" \ + -e "s|YOUR_ADL_CREDENTIAL|${ADL_OAUTH2_CREDENTIAL}|g" \ + "${PXF_CONF_DIR}/templates/adl-site.xml" >"${PXF_CONF_DIR}/servers/adl/adl-site.xml" +} - mkdir -p "${PXF_CONF_DIR}/servers/s3-invalid" - cp "${PXF_CONF_DIR}/templates/s3-site.xml" "${PXF_CONF_DIR}/servers/s3-invalid/s3-site.xml" +function configure_pxf_wasbs_server() { + mkdir -p ${PXF_CONF_DIR}/servers/wasbs + sed -e "s|YOUR_AZURE_BLOB_STORAGE_ACCOUNT_NAME|${WASBS_ACCOUNT_NAME}|g" \ + -e "s|YOUR_AZURE_BLOB_STORAGE_ACCOUNT_KEY|${WASBS_ACCOUNT_KEY}|g" \ + "${PXF_CONF_DIR}/templates/wasbs-site.xml" >"${PXF_CONF_DIR}/servers/wasbs/wasbs-site.xml" } function configure_pxf_default_server() { @@ -363,6 +500,37 @@ function start_pxf_server() { ps -aef | grep '[t]omcat' } +function setup_s3_for_pg_regress() { + configure_pxf_s3_server + configure_hdfs_client_for_s3 + HCFS_BUCKET=gpdb-ud-scratch +} + +function setup_gs_for_pg_regress() { + configure_pxf_gs_server + configure_hdfs_client_for_gs + HCFS_BUCKET=data-gpdb-ud-tpch +} + +function setup_adl_for_pg_regress() { + configure_pxf_adl_server + configure_hdfs_client_for_adl + HCFS_BUCKET=${ADL_ACCOUNT}.azuredatalakestore.net +} + +function setup_wasbs_for_pg_regress() { + configure_pxf_wasbs_server + configure_hdfs_client_for_wasbs + HCFS_BUCKET=pxf-container@${WASBS_ACCOUNT_NAME}.blob.core.windows.net +} + +function setup_minio_for_pg_regress() { + configure_pxf_minio_server + configure_hdfs_client_for_minio + # this is set in setup_minio() + HCFS_BUCKET=gpdb-ud-scratch +} + function setup_minio() { echo 'Adding test bucket gpdb-ud-scratch to Minio ...' mkdir -p /opt/minio/data/gpdb-ud-scratch @@ -371,7 +539,7 @@ function setup_minio() { echo "Minio credentials: accessKey=${MINIO_ACCESS_KEY} secretKey=${MINIO_SECRET_KEY}" echo 'Starting Minio ...' - /opt/minio/bin/minio server /opt/minio/data & + MINIO_DOMAIN=localhost /opt/minio/bin/minio server /opt/minio/data & # export minio credentials as access environment variables export ACCESS_KEY_ID=${MINIO_ACCESS_KEY} SECRET_ACCESS_KEY=${MINIO_SECRET_KEY} diff --git a/concourse/scripts/test_pxf.bash b/concourse/scripts/test_pxf.bash index 2239ee1656..c957f7c893 100755 --- a/concourse/scripts/test_pxf.bash +++ b/concourse/scripts/test_pxf.bash @@ -4,6 +4,7 @@ set -exo pipefail CWDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "${CWDIR}/pxf_common.bash" +PG_REGRESS=${PG_REGRESS:-false} export GPHOME=${GPHOME:-/usr/local/greenplum-db-devel} export PXF_HOME=${GPHOME}/pxf @@ -16,12 +17,49 @@ if [[ ${HADOOP_CLIENT} == MAPR ]]; then export GPHD_ROOT=/opt/mapr fi +function run_pg_regress() { + # run desired groups (below we replace commas with spaces in $GROUPS) + cat > ~gpadmin/run_pxf_automation_test.sh <<-EOF + #!/usr/bin/env bash + set -euxo pipefail + + source ${GPHOME}/greenplum_path.sh + + export GPHD_ROOT=${GPHD_ROOT} + export PXF_HOME=${PXF_HOME} PXF_CONF=${PXF_CONF_DIR} + export PGPORT=15432 + export HCFS_CMD=${GPHD_ROOT}/bin/hdfs + export HCFS_PROTOCOL=${PROTOCOL} + export HBASE_CMD=${GPHD_ROOT}/bin/hbase + export BEELINE_CMD=${GPHD_ROOT}/hive/bin/beeline + export HCFS_BUCKET=${HCFS_BUCKET} + # hive-specific vars + # export HIVE_IS_REMOTE= HIVE_HOST= HIVE_PRINCIPAL= + + time make -C ${PWD}/pxf_src/regression ${GROUP//,/ } + EOF + + # this prevents a Hive error about hive.log.dir not existing + sed -ie 's/-hiveconf hive.log.dir=$LOGS_ROOT //' "${GPHD_ROOT}/hive/conf/hive-env.sh" + # we need to be able to write files under regression + # and may also need to create files like ~gpamdin/pxf/servers/s3/s3-site.xml + chown -R gpadmin "${PWD}/pxf_src/regression" + chmod a+x ~gpadmin/run_pxf_automation_test.sh + su gpadmin -c ~gpadmin/run_pxf_automation_test.sh +} + function run_pxf_automation() { + ln -s "${PWD}/pxf_src" ~gpadmin/pxf_src + + if [[ $PG_REGRESS == true ]]; then + run_pg_regress + return $? + fi + # Let's make sure that automation/singlecluster directories are writeable chmod a+w pxf_src/automation /singlecluster || true find pxf_src/automation/tinc* -type d -exec chmod a+w {} \; - ln -s "${PWD}/pxf_src" ~gpadmin/pxf_src su gpadmin -c " source '${GPHOME}/greenplum_path.sh' && psql -p 15432 -d template1 -c 'CREATE EXTENSION PXF' @@ -90,24 +128,14 @@ function _main() { # concourse build will run forever. trap 'pkill sshd' EXIT - if [[ ${PROTOCOL} == s3 ]]; then - echo Using S3 protocol - elif [[ ${PROTOCOL} == minio ]]; then - echo Using Minio with S3 protocol - setup_minio - elif [[ ${PROTOCOL} == gs ]]; then - echo Using GS protocol - cat <<-EOF > /tmp/gsc-ci-service-account.key.json - ${GOOGLE_CREDENTIALS} - EOF - elif [[ ${HADOOP_CLIENT} == MAPR ]]; then + # Ping is called by gpinitsystem, which must be run by gpadmin + chmod u+s /bin/ping + + if [[ ${HADOOP_CLIENT} == MAPR ]]; then # start mapr services before installing GPDB /root/init-script fi - # Ping is called by gpinitsystem, which must be run by gpadmin - chmod u+s /bin/ping - # Install GPDB install_gpdb_binary setup_gpadmin_user @@ -116,8 +144,9 @@ function _main() { install_pxf_client install_pxf_server - if [[ -z ${PROTOCOL} && ! ${HADOOP_CLIENT} == MAPR ]]; then + if [[ -z ${PROTOCOL} && ${HADOOP_CLIENT} != MAPR ]]; then # Setup Hadoop before creating GPDB cluster to use system python for yum install + # Must be after installing GPDB to transfer hbase jar setup_hadoop "${GPHD_ROOT}" fi @@ -125,12 +154,40 @@ function _main() { add_remote_user_access_for_gpdb testuser init_and_configure_pxf_server - if [[ ${HADOOP_CLIENT} == MAPR ]]; then - configure_mapr_dependencies - elif [[ -z ${PROTOCOL} ]]; then - configure_pxf_default_server - configure_pxf_s3_server - fi + local HCFS_BUCKET # team-specific bucket names + case ${PROTOCOL} in + s3) + echo 'Using S3 protocol' + [[ ${PG_REGRESS} != false ]] && setup_s3_for_pg_regress + ;; + minio) + echo 'Using Minio with S3 protocol' + setup_minio + [[ ${PG_REGRESS} != false ]] && setup_minio_for_pg_regress + ;; + gs) + echo 'Using GS protocol' + echo "${GOOGLE_CREDENTIALS}" > /tmp/gsc-ci-service-account.key.json + [[ ${PG_REGRESS} != false ]] && setup_gs_for_pg_regress + ;; + adl) + echo 'Using ADL protocol' + [[ ${PG_REGRESS} != false ]] && setup_adl_for_pg_regress + ;; + wasbs) + echo 'Using WASBS protocol' + [[ ${PG_REGRESS} != false ]] && setup_wasbs_for_pg_regress + ;; + *) # no protocol, presumably + if [[ ${HADOOP_CLIENT} == MAPR ]]; then + configure_mapr_dependencies + else + configure_pxf_default_server + configure_pxf_s3_server + fi + ;; + esac + start_pxf_server # Create fat jar for automation diff --git a/concourse/tasks/test_pxf.yml b/concourse/tasks/test_pxf.yml index a5e3fe72d7..70a9ffcd18 100644 --- a/concourse/tasks/test_pxf.yml +++ b/concourse/tasks/test_pxf.yml @@ -18,5 +18,7 @@ params: TEST_ENV: TEST_OS: RUN_JDK_VERSION: 8 + PROTOCOL: + PG_REGRESS: run: path: pxf_src/concourse/scripts/test_pxf.bash diff --git a/regression/.gitignore b/regression/.gitignore new file mode 100644 index 0000000000..e5de499c17 --- /dev/null +++ b/regression/.gitignore @@ -0,0 +1,6 @@ +sql/_*.sql +expected/_*.out +results/ +regression.diffs +regression.out +scripts/_*.bash diff --git a/regression/Makefile b/regression/Makefile new file mode 100644 index 0000000000..336cdb1b70 --- /dev/null +++ b/regression/Makefile @@ -0,0 +1,60 @@ +ifndef PXF_CONF +$(error PXF_CONF is not defined) +endif + +REGRESS_OPTS = --init-file=./init_file + +SUBSTITUTE_COMMAND = scripts/substitute.bash + +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) +include $(PGXS) + +ifdef PXF_TEST_DEBUG +SUBSTITUTE_COMMAND += --debug +REGRESS_OPTS += --debug +endif + +setup_test_dir : + mkdir -p /tmp/pxf_automation_data + +setup_script_dir : + mkdir -p scripts/generated + +setup_dirs: setup_test_dir setup_script_dir + +fdw_%_schedule : setup_dirs + $(SUBSTITUTE_COMMAND) schedules/$@ + $(pg_regress_installcheck) $(REGRESS_OPTS) --load-extension=pxf_fdw --schedule=schedules/$@ + +%_schedule : setup_dirs + $(SUBSTITUTE_COMMAND) schedules/$@ + $(pg_regress_installcheck) $(REGRESS_OPTS) --load-extension=pxf --schedule=schedules/$@ + +FDW_%Test : setup_dirs + $(SUBSTITUTE_COMMAND) $@ + $(pg_regress_installcheck) $(REGRESS_OPTS) --load-extension=pxf_fdw _$@ + +%Test : setup_dirs + $(SUBSTITUTE_COMMAND) $@ + $(pg_regress_installcheck) $(REGRESS_OPTS) --load-extension=pxf _$@ + +clean : + rm -rf /tmp/pxf_automation_data + rm -rf sql/_*.sql expected/_*.out results/* + if ls scripts/generated/*.bash; then \ + for script in scripts/generated/*bash; do \ + "$${script}"; \ + done; \ + fi + if ls scripts/generated/*cleanup*.sql; then \ + for script in scripts/generated/*cleanup*sql; do \ + $(BEELINE_CMD) -f "$${script}"; \ + done; \ + fi + if ls scripts/generated/*drop*.rb; then \ + for script in scripts/generated/*drop*.rb; do \ + $(HBASE_CMD) shell "$${PWD}/$${script}"; \ + done; \ + fi + rm -rf scripts/generated/* diff --git a/regression/README.md b/regression/README.md new file mode 100644 index 0000000000..108daf722f --- /dev/null +++ b/regression/README.md @@ -0,0 +1,150 @@ +PXF pg_regress Test Suite +=================================== + +This is a test suite that utilizes PostgreSQL's `pg_regress` testing framework to accomplish end-to-end testing of PXF. + +It performs SQL queries via `psql` to 1) prepare data on an external source 2) create either external or foreign tables in Greenplum to query the data via PXF. +The `pg_regress` engine can then compare the results of these queries with expected results that we define to determine success or failure. + +This is different from our automation framework (`pxf/automation`) which fires up a Java process that uses, e.g. HDFS APIs to prepare the data, then performs SQL queries for the rest. + +Running the tests +=================================== + +## Pre-requisites + +You need a running instance of Greenplum and PXF, along with a local installation of Greenplum (to be able to use the `pg_regress` framework). +The variables `PGHOST` and `PGPORT` must be pointing at the Greenplum master node, and Greenplum environment scripts like `${GPHOME}/greenplum_path.sh` and `gpdb/gpAux/gpdemo/gpdemo-env.sh` should be sourced. +`pg_config` must be on your path. + +For data prep, the appropriate CLIs are required, as we shell out from SQL to these CLIs. These include `hdfs`, `hbase`, and `beeline`. +It is expected that these commands are configured correctly for communication with their respective services. + +If your external data or Greenplum are remote, it is best to have password-less SSH configured, as some tests may use SCP to transfer prepared data files. + +## Make targets + +The tests are invoked by running the `make` command with certain environment variables set. + +The targets available are either schedules (groups of tests that can be run in parallel) or a list of single tests. + +For example, to run external table tests `HdfsSmokeTest` and `WritableSmokeTest` in serial: + +``` +make -C ~/workspace/pxf/regression HdfsSmokeTest WritableSmokeTest +``` + +To run the entire FDW smoke schedule in parallel: + +``` +make -C ~/workspace/pxf/regression fdw_smoke_schedule +``` + +## Environment variables + +By setting environment variables you can change the location of the Greenplum master, the location of the data prep commands (`hdfs`, etc.), and even the cloud object store that will serve as HDFS proxy. + +### General environment variables + +All the general environment variables that come from `greenplum_path.sh` and `gpdemo-env.sh`, along with `PXF_CONF` must be set. + +* `PXF_TEST_DEBUG`: set to anything to prevent deletion of data, and to run `pg_regress` in debug mode (optional) +* `SERVER_CONFIG`: the name of the config directory for your server, under `${PXF_CONF}/servers` (optional). If not set, will use one of `${PXF_CONF}/servers/{default,s3,gs,adl,wasbs}` as appropriate +* `PGHOST`: the hostname of the master Greenplum node (optional). Needed when Greenplum is remote + +### HCFS-specific variables + +* `HCFS_CMD`: path to the `hdfs` CLI command. Required for HCFS tests +* `HCFS_PROTOCOL`: the protocol to use: `s3`, `gs`, `adl`, `wasbs`, `minio` (optional). Only needed when running against an object store +* `HCFS_BUCKET`: the location on the external object store (optional) + +### HBase-specific variables + +* `HBASE_CMD`: path to the `hbase` CLI command. Required for HBase tests + +### Hive-specific variables + +* `BEELINE_CMD`: path to Hive's `beeline` CLI command. Required for Hive tests +* `HIVE_HOST`: the hostname where Hive is running (optional). Needed if Hive is remote +* `HIVE_PRINCIPAL`: the Hive principal (optional). Needed when running against kerberized Hive + +Writing tests +=================================== + +Tests may be added by creating SQL script templates under `sql` and corresponding expected response templates under `expected`. +The templates are interpolated by `scripts/substitute.bash` and corresponding files with a leading underscore are created. +These are the actual test files that `pg_regress` will use. +Results will be populated by `pg_regress` in a directory called `results`. +Test names should end in `Test` so that `make` considers them targets. +FDW test names should begin with the string `FDW_` so that the appropriate extension can be loaded by `pg_regress` (`pxf` vs. `pxf_fdw`). + +Certain lines of test output can be ignored or mutated in `init_file` to make the tests pass consistently. + +The basic directory structure after creating a test templates `sql/ExampleTest.sql`, `expected/ExampleTest.out`, and running `make ExampleTest` is as follows: + +``` +$ tree +. +├── Makefile +├── README.md +├── expected +│   ├── ExampleTest.out +│   └── _ExampleTest.out +├── init_file +├── regression.out +├── results +│   └── _ExampleTest.out +├── schedules +│   └── example_schedule +├── scripts +│   ├── cleanup_hcfs.bash +│   ├── generated +│   ├── hbase +│   │   ├── drop_small_data.rb +│   │   └── gen_small_data.rb +│   ├── hive +│   │   ├── cleanup_hive_smoke_test.sql +│   │   ├── create_hive_smoke_test_database.sql +│   │   └── load_small_data.sql +│   └── substitute.bash +└── sql +    ├── ExampleTest.sql +    └── _ExampleTest.sql +``` + +`regression.out` contains the output from the test report (success, failure, etc.). +If there was a test failure, you will also find `regression.diffs`, which shows why the test failed. +Note that under `sql` and `expected` there are files with leading underscores, they were generated by `scripts/substitute.bash`, then used to run the tests. +`results` contains the actual SQL commands and output from the test. + +When creating a test, if adding new templated variables (words surrounded by double curly braces, e.g. `{{ VAR }}`), then the appropriate logic to interpolate should be added to `scripts/substitute.bash`. + +Under `scripts` there are several other scripts which may be called from within test SQL code. +If they are specific to a certain type of test, they go under a separate directory, as in the case of `scripts/{hbase,hive}`. +To call any script under the `scripts` directory from the test, you can use: `{{ SCRIPT foo.sql }}`. +The substitution script will interpolate the full path to a uniquely-named script generated at `scripts/generated`, and any template variables in the script itself will also be interpolated. + +### Creating Schedules + +Schedules live under the `schedules` directory, and are a convenient way of making arbitrary groups of tests. + +To make a schedule, make a new file, e.g. `schedules/example_schedule`. +Like tests, schedule files should end in `_schedule` to be considered as targets by `make`. +FDW schedules should begin with the string `fdw_` so that the `pxf_fdw` extension is loaded by `pg_regress`. + +Inside the `schedules/example_schedule`, place some test names, preceded by `test: `: + +``` +test: _FirstParallelExampleTest _SecondParallelExampleTest +test: _LastExampleTest +``` + +The leading underscore is required here, because this should be the name of the test that `pg_regress` runs (after interpolating the test template). + +In this case, when the following command is issued: + +``` +make -C ~/workspace/pxf/regression example_schedule +``` + +the tests `_FirstParallelExampleTest` and `_SecondParallelExampleTest` will run in parallel, followed by `_LastExampleTest`. diff --git a/regression/expected/FDW_HBaseSmokeTest.out b/regression/expected/FDW_HBaseSmokeTest.out new file mode 100644 index 0000000000..f14f66c87b --- /dev/null +++ b/regression/expected/FDW_HBaseSmokeTest.out @@ -0,0 +1,686 @@ +-- Create Hbase tables hbase_table and pxflookup +\!{{ HBASE_CMD }} shell {{ SCRIPT create_pxflookup.rb }} >/dev/null 2>&1 +\!{{ HBASE_CMD }} shell {{ SCRIPT gen_small_data.rb }} +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +-- FDW test +CREATE SERVER h_base_smoke_test_server + FOREIGN DATA WRAPPER hbase_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER + SERVER h_base_smoke_test_server; +CREATE FOREIGN TABLE h_base_smoke_test_foreign_table ( + name text, + num int, + dub double precision, + longnum bigint, + bool boolean + ) + SERVER h_base_smoke_test_server OPTIONS (resource 'hbase_small_data_table_{{ FULL_TESTNAME }}'); +SELECT * FROM h_base_smoke_test_foreign_table ORDER BY name; + name | num | dub | longnum | bool +---------+-----+--------+----------------+------ + row_1 | 1 | 1.001 | 100000000000 | f + row_10 | 10 | 10.01 | 1000000000000 | t + row_100 | 100 | 100.1 | 10000000000000 | t + row_11 | 11 | 11.011 | 1100000000000 | f + row_12 | 12 | 12.012 | 1200000000000 | t + row_13 | 13 | 13.013 | 1300000000000 | f + row_14 | 14 | 14.014 | 1400000000000 | t + row_15 | 15 | 15.015 | 1500000000000 | f + row_16 | 16 | 16.016 | 1600000000000 | t + row_17 | 17 | 17.017 | 1700000000000 | f + row_18 | 18 | 18.018 | 1800000000000 | t + row_19 | 19 | 19.019 | 1900000000000 | f + row_2 | 2 | 2.002 | 200000000000 | t + row_20 | 20 | 20.02 | 2000000000000 | t + row_21 | 21 | 21.021 | 2100000000000 | f + row_22 | 22 | 22.022 | 2200000000000 | t + row_23 | 23 | 23.023 | 2300000000000 | f + row_24 | 24 | 24.024 | 2400000000000 | t + row_25 | 25 | 25.025 | 2500000000000 | f + row_26 | 26 | 26.026 | 2600000000000 | t + row_27 | 27 | 27.027 | 2700000000000 | f + row_28 | 28 | 28.028 | 2800000000000 | t + row_29 | 29 | 29.029 | 2900000000000 | f + row_3 | 3 | 3.003 | 300000000000 | f + row_30 | 30 | 30.03 | 3000000000000 | t + row_31 | 31 | 31.031 | 3100000000000 | f + row_32 | 32 | 32.032 | 3200000000000 | t + row_33 | 33 | 33.033 | 3300000000000 | f + row_34 | 34 | 34.034 | 3400000000000 | t + row_35 | 35 | 35.035 | 3500000000000 | f + row_36 | 36 | 36.036 | 3600000000000 | t + row_37 | 37 | 37.037 | 3700000000000 | f + row_38 | 38 | 38.038 | 3800000000000 | t + row_39 | 39 | 39.039 | 3900000000000 | f + row_4 | 4 | 4.004 | 400000000000 | t + row_40 | 40 | 40.04 | 4000000000000 | t + row_41 | 41 | 41.041 | 4100000000000 | f + row_42 | 42 | 42.042 | 4200000000000 | t + row_43 | 43 | 43.043 | 4300000000000 | f + row_44 | 44 | 44.044 | 4400000000000 | t + row_45 | 45 | 45.045 | 4500000000000 | f + row_46 | 46 | 46.046 | 4600000000000 | t + row_47 | 47 | 47.047 | 4700000000000 | f + row_48 | 48 | 48.048 | 4800000000000 | t + row_49 | 49 | 49.049 | 4900000000000 | f + row_5 | 5 | 5.005 | 500000000000 | f + row_50 | 50 | 50.05 | 5000000000000 | t + row_51 | 51 | 51.051 | 5100000000000 | f + row_52 | 52 | 52.052 | 5200000000000 | t + row_53 | 53 | 53.053 | 5300000000000 | f + row_54 | 54 | 54.054 | 5400000000000 | t + row_55 | 55 | 55.055 | 5500000000000 | f + row_56 | 56 | 56.056 | 5600000000000 | t + row_57 | 57 | 57.057 | 5700000000000 | f + row_58 | 58 | 58.058 | 5800000000000 | t + row_59 | 59 | 59.059 | 5900000000000 | f + row_6 | 6 | 6.006 | 600000000000 | t + row_60 | 60 | 60.06 | 6000000000000 | t + row_61 | 61 | 61.061 | 6100000000000 | f + row_62 | 62 | 62.062 | 6200000000000 | t + row_63 | 63 | 63.063 | 6300000000000 | f + row_64 | 64 | 64.064 | 6400000000000 | t + row_65 | 65 | 65.065 | 6500000000000 | f + row_66 | 66 | 66.066 | 6600000000000 | t + row_67 | 67 | 67.067 | 6700000000000 | f + row_68 | 68 | 68.068 | 6800000000000 | t + row_69 | 69 | 69.069 | 6900000000000 | f + row_7 | 7 | 7.007 | 700000000000 | f + row_70 | 70 | 70.07 | 7000000000000 | t + row_71 | 71 | 71.071 | 7100000000000 | f + row_72 | 72 | 72.072 | 7200000000000 | t + row_73 | 73 | 73.073 | 7300000000000 | f + row_74 | 74 | 74.074 | 7400000000000 | t + row_75 | 75 | 75.075 | 7500000000000 | f + row_76 | 76 | 76.076 | 7600000000000 | t + row_77 | 77 | 77.077 | 7700000000000 | f + row_78 | 78 | 78.078 | 7800000000000 | t + row_79 | 79 | 79.079 | 7900000000000 | f + row_8 | 8 | 8.008 | 800000000000 | t + row_80 | 80 | 80.08 | 8000000000000 | t + row_81 | 81 | 81.081 | 8100000000000 | f + row_82 | 82 | 82.082 | 8200000000000 | t + row_83 | 83 | 83.083 | 8300000000000 | f + row_84 | 84 | 84.084 | 8400000000000 | t + row_85 | 85 | 85.085 | 8500000000000 | f + row_86 | 86 | 86.086 | 8600000000000 | t + row_87 | 87 | 87.087 | 8700000000000 | f + row_88 | 88 | 88.088 | 8800000000000 | t + row_89 | 89 | 89.089 | 8900000000000 | f + row_9 | 9 | 9.009 | 900000000000 | f + row_90 | 90 | 90.09 | 9000000000000 | t + row_91 | 91 | 91.091 | 9100000000000 | f + row_92 | 92 | 92.092 | 9200000000000 | t + row_93 | 93 | 93.093 | 9300000000000 | f + row_94 | 94 | 94.094 | 9400000000000 | t + row_95 | 95 | 95.095 | 9500000000000 | f + row_96 | 96 | 96.096 | 9600000000000 | t + row_97 | 97 | 97.097 | 9700000000000 | f + row_98 | 98 | 98.098 | 9800000000000 | t + row_99 | 99 | 99.099 | 9900000000000 | f +(100 rows) + +SELECT name, num FROM h_base_smoke_test_foreign_table WHERE num > 50 ORDER BY name; + name | num +---------+----- + row_100 | 100 + row_51 | 51 + row_52 | 52 + row_53 | 53 + row_54 | 54 + row_55 | 55 + row_56 | 56 + row_57 | 57 + row_58 | 58 + row_59 | 59 + row_60 | 60 + row_61 | 61 + row_62 | 62 + row_63 | 63 + row_64 | 64 + row_65 | 65 + row_66 | 66 + row_67 | 67 + row_68 | 68 + row_69 | 69 + row_70 | 70 + row_71 | 71 + row_72 | 72 + row_73 | 73 + row_74 | 74 + row_75 | 75 + row_76 | 76 + row_77 | 77 + row_78 | 78 + row_79 | 79 + row_80 | 80 + row_81 | 81 + row_82 | 82 + row_83 | 83 + row_84 | 84 + row_85 | 85 + row_86 | 86 + row_87 | 87 + row_88 | 88 + row_89 | 89 + row_90 | 90 + row_91 | 91 + row_92 | 92 + row_93 | 93 + row_94 | 94 + row_95 | 95 + row_96 | 96 + row_97 | 97 + row_98 | 98 + row_99 | 99 +(50 rows) + +-- clean up HBase +{{ CLEAN_UP }}\!{{ HBASE_CMD }} shell {{ SCRIPT drop_small_data.rb }} >/dev/null 2>&1 +{{ CLEAN_UP }}\!rm -rf {{ SCRIPT drop_small_data.rb }} {{ SCRIPT gen_small_data.rb }} {{ SCRIPT create_pxflookup.rb }} diff --git a/regression/expected/FDW_HdfsSmokeTest.out b/regression/expected/FDW_HdfsSmokeTest.out new file mode 100644 index 0000000000..6e5ea973b4 --- /dev/null +++ b/regression/expected/FDW_HdfsSmokeTest.out @@ -0,0 +1,194 @@ +-- data prep +{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} mkdir -p {{ TEST_LOCATION }} +\!mkdir -p {{ TEST_LOCATION }} +COPY ( + SELECT format('row_%s',i::varchar(255)), + i, + i+0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true' ELSE 'false' END + from generate_series(1, 100) s(i) + ) TO '{{ TEST_LOCATION }}/data.csv' + WITH (FORMAT 'csv'); +{{ GPDB_REMOTE }}-- if GPDB is remote, will need to scp file down from there for beeline +{{ GPDB_REMOTE }}\!scp {{ PGHOST }}:{{ TEST_LOCATION }}/data.csv {{ TEST_LOCATION }} +\!{{ HCFS_CMD }} dfs -mkdir -p '{{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}' +\!{{ HCFS_CMD }} dfs -copyFromLocal '{{ TEST_LOCATION }}/data.csv' '{{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}' +-- FDW test +CREATE SERVER hdfs_smoke_test_hdfs_server + FOREIGN DATA WRAPPER {{ HCFS_PROTOCOL }}_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER SERVER hdfs_smoke_test_hdfs_server; +CREATE FOREIGN TABLE hdfs_smoke_test_foreign_table ( + name TEXT, + num INTEGER, + dub DOUBLE PRECISION, + longNum BIGINT, + bool BOOLEAN + ) SERVER hdfs_smoke_test_hdfs_server + OPTIONS (resource '{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/data.csv', format 'csv'); +SELECT * FROM hdfs_smoke_test_foreign_table ORDER BY name; + name | num | dub | longnum | bool +---------+-----+----------+----------------+------ + row_1 | 1 | 1.0001 | 100000000000 | f + row_10 | 10 | 10.0001 | 1000000000000 | t + row_100 | 100 | 100.0001 | 10000000000000 | t + row_11 | 11 | 11.0001 | 1100000000000 | f + row_12 | 12 | 12.0001 | 1200000000000 | t + row_13 | 13 | 13.0001 | 1300000000000 | f + row_14 | 14 | 14.0001 | 1400000000000 | t + row_15 | 15 | 15.0001 | 1500000000000 | f + row_16 | 16 | 16.0001 | 1600000000000 | t + row_17 | 17 | 17.0001 | 1700000000000 | f + row_18 | 18 | 18.0001 | 1800000000000 | t + row_19 | 19 | 19.0001 | 1900000000000 | f + row_2 | 2 | 2.0001 | 200000000000 | t + row_20 | 20 | 20.0001 | 2000000000000 | t + row_21 | 21 | 21.0001 | 2100000000000 | f + row_22 | 22 | 22.0001 | 2200000000000 | t + row_23 | 23 | 23.0001 | 2300000000000 | f + row_24 | 24 | 24.0001 | 2400000000000 | t + row_25 | 25 | 25.0001 | 2500000000000 | f + row_26 | 26 | 26.0001 | 2600000000000 | t + row_27 | 27 | 27.0001 | 2700000000000 | f + row_28 | 28 | 28.0001 | 2800000000000 | t + row_29 | 29 | 29.0001 | 2900000000000 | f + row_3 | 3 | 3.0001 | 300000000000 | f + row_30 | 30 | 30.0001 | 3000000000000 | t + row_31 | 31 | 31.0001 | 3100000000000 | f + row_32 | 32 | 32.0001 | 3200000000000 | t + row_33 | 33 | 33.0001 | 3300000000000 | f + row_34 | 34 | 34.0001 | 3400000000000 | t + row_35 | 35 | 35.0001 | 3500000000000 | f + row_36 | 36 | 36.0001 | 3600000000000 | t + row_37 | 37 | 37.0001 | 3700000000000 | f + row_38 | 38 | 38.0001 | 3800000000000 | t + row_39 | 39 | 39.0001 | 3900000000000 | f + row_4 | 4 | 4.0001 | 400000000000 | t + row_40 | 40 | 40.0001 | 4000000000000 | t + row_41 | 41 | 41.0001 | 4100000000000 | f + row_42 | 42 | 42.0001 | 4200000000000 | t + row_43 | 43 | 43.0001 | 4300000000000 | f + row_44 | 44 | 44.0001 | 4400000000000 | t + row_45 | 45 | 45.0001 | 4500000000000 | f + row_46 | 46 | 46.0001 | 4600000000000 | t + row_47 | 47 | 47.0001 | 4700000000000 | f + row_48 | 48 | 48.0001 | 4800000000000 | t + row_49 | 49 | 49.0001 | 4900000000000 | f + row_5 | 5 | 5.0001 | 500000000000 | f + row_50 | 50 | 50.0001 | 5000000000000 | t + row_51 | 51 | 51.0001 | 5100000000000 | f + row_52 | 52 | 52.0001 | 5200000000000 | t + row_53 | 53 | 53.0001 | 5300000000000 | f + row_54 | 54 | 54.0001 | 5400000000000 | t + row_55 | 55 | 55.0001 | 5500000000000 | f + row_56 | 56 | 56.0001 | 5600000000000 | t + row_57 | 57 | 57.0001 | 5700000000000 | f + row_58 | 58 | 58.0001 | 5800000000000 | t + row_59 | 59 | 59.0001 | 5900000000000 | f + row_6 | 6 | 6.0001 | 600000000000 | t + row_60 | 60 | 60.0001 | 6000000000000 | t + row_61 | 61 | 61.0001 | 6100000000000 | f + row_62 | 62 | 62.0001 | 6200000000000 | t + row_63 | 63 | 63.0001 | 6300000000000 | f + row_64 | 64 | 64.0001 | 6400000000000 | t + row_65 | 65 | 65.0001 | 6500000000000 | f + row_66 | 66 | 66.0001 | 6600000000000 | t + row_67 | 67 | 67.0001 | 6700000000000 | f + row_68 | 68 | 68.0001 | 6800000000000 | t + row_69 | 69 | 69.0001 | 6900000000000 | f + row_7 | 7 | 7.0001 | 700000000000 | f + row_70 | 70 | 70.0001 | 7000000000000 | t + row_71 | 71 | 71.0001 | 7100000000000 | f + row_72 | 72 | 72.0001 | 7200000000000 | t + row_73 | 73 | 73.0001 | 7300000000000 | f + row_74 | 74 | 74.0001 | 7400000000000 | t + row_75 | 75 | 75.0001 | 7500000000000 | f + row_76 | 76 | 76.0001 | 7600000000000 | t + row_77 | 77 | 77.0001 | 7700000000000 | f + row_78 | 78 | 78.0001 | 7800000000000 | t + row_79 | 79 | 79.0001 | 7900000000000 | f + row_8 | 8 | 8.0001 | 800000000000 | t + row_80 | 80 | 80.0001 | 8000000000000 | t + row_81 | 81 | 81.0001 | 8100000000000 | f + row_82 | 82 | 82.0001 | 8200000000000 | t + row_83 | 83 | 83.0001 | 8300000000000 | f + row_84 | 84 | 84.0001 | 8400000000000 | t + row_85 | 85 | 85.0001 | 8500000000000 | f + row_86 | 86 | 86.0001 | 8600000000000 | t + row_87 | 87 | 87.0001 | 8700000000000 | f + row_88 | 88 | 88.0001 | 8800000000000 | t + row_89 | 89 | 89.0001 | 8900000000000 | f + row_9 | 9 | 9.0001 | 900000000000 | f + row_90 | 90 | 90.0001 | 9000000000000 | t + row_91 | 91 | 91.0001 | 9100000000000 | f + row_92 | 92 | 92.0001 | 9200000000000 | t + row_93 | 93 | 93.0001 | 9300000000000 | f + row_94 | 94 | 94.0001 | 9400000000000 | t + row_95 | 95 | 95.0001 | 9500000000000 | f + row_96 | 96 | 96.0001 | 9600000000000 | t + row_97 | 97 | 97.0001 | 9700000000000 | f + row_98 | 98 | 98.0001 | 9800000000000 | t + row_99 | 99 | 99.0001 | 9900000000000 | f +(100 rows) + +SELECT name, num FROM hdfs_smoke_test_foreign_table WHERE num > 50 ORDER BY name; + name | num +---------+----- + row_100 | 100 + row_51 | 51 + row_52 | 52 + row_53 | 53 + row_54 | 54 + row_55 | 55 + row_56 | 56 + row_57 | 57 + row_58 | 58 + row_59 | 59 + row_60 | 60 + row_61 | 61 + row_62 | 62 + row_63 | 63 + row_64 | 64 + row_65 | 65 + row_66 | 66 + row_67 | 67 + row_68 | 68 + row_69 | 69 + row_70 | 70 + row_71 | 71 + row_72 | 72 + row_73 | 73 + row_74 | 74 + row_75 | 75 + row_76 | 76 + row_77 | 77 + row_78 | 78 + row_79 | 79 + row_80 | 80 + row_81 | 81 + row_82 | 82 + row_83 | 83 + row_84 | 84 + row_85 | 85 + row_86 | 86 + row_87 | 87 + row_88 | 88 + row_89 | 89 + row_90 | 90 + row_91 | 91 + row_92 | 92 + row_93 | 93 + row_94 | 94 + row_95 | 95 + row_96 | 96 + row_97 | 97 + row_98 | 98 + row_99 | 99 +(50 rows) + +{{ CLEAN_UP }}-- clean up HCFS and local disk +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r -f {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}Deleted {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}\!rm -rf {{ TEST_LOCATION }} +{{ CLEAN_UP }}{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} rm -rf {{ TEST_LOCATION }} diff --git a/regression/expected/FDW_HiveSmokeTest.out b/regression/expected/FDW_HiveSmokeTest.out new file mode 100644 index 0000000000..10658ce859 --- /dev/null +++ b/regression/expected/FDW_HiveSmokeTest.out @@ -0,0 +1,231 @@ +-- data prep +{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} mkdir -p {{ TEST_LOCATION }} +\!mkdir -p {{ TEST_LOCATION }} +COPY ( + SELECT format('row_%s',i::varchar(255)), + i, + i*0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true' ELSE 'false' END + from generate_series(1, 100) s(i) + ) TO '{{ TEST_LOCATION }}/data.csv' + WITH (FORMAT 'csv'); +{{ GPDB_REMOTE }}-- if GPDB is remote, will need to scp file down from there for beeline +{{ GPDB_REMOTE }}\!scp {{ PGHOST }}:{{ TEST_LOCATION }}/data.csv {{ TEST_LOCATION }} +{{ HIVE_REMOTE }}-- if hive is remote, will need to scp file up there to load it in +{{ HIVE_REMOTE }}\!cat {{ TEST_LOCATION }}/data.csv | ssh {{ HIVE_HOST }} 'mkdir -p {{ TEST_LOCATION }} && cat > {{ TEST_LOCATION }}/data.csv' +\!{{ BEELINE_CMD }} -f {{ SCRIPT create_hive_smoke_test_database.sql }} -u 'jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }}' +Connecting to jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }} +Connected to: Apache Hive +Driver: Hive JDBC +Transaction isolation: TRANSACTION_REPEATABLE_READ +jdbc:hive2> CREATE DATABASE hive_smoke_test_database_{{ FULL_TESTNAME }}; +jdbc:hive2> +jdbc:hive2> Closing: 0: jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }} +\!{{ BEELINE_CMD }} -f {{ SCRIPT load_small_data.sql }} -u 'jdbc:hive2://{{ HIVE_HOST }}:10000/hive_smoke_test_database_{{ FULL_TESTNAME }}{{ HIVE_PRINCIPAL }}' +Connecting to jdbc:hive2://{{ HIVE_HOST }}:10000/hive_smoke_test_database_{{ FULL_TESTNAME }}{{ HIVE_PRINCIPAL }} +Connected to: Apache Hive +Driver: Hive JDBC +Transaction isolation: TRANSACTION_REPEATABLE_READ +jdbc:hive2> CREATE TABLE hive_small_data_table_{{ FULL_TESTNAME }} ( +jdbc:hive2> s1 string, +jdbc:hive2> n1 int, +jdbc:hive2> d1 double, +jdbc:hive2> bg bigint, +jdbc:hive2> b boolean +jdbc:hive2> ) +jdbc:hive2> ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' +jdbc:hive2> STORED AS textfile; +jdbc:hive2> LOAD DATA LOCAL INPATH '{{ TEST_LOCATION }}/data.csv' +jdbc:hive2> INTO TABLE hive_small_data_table_{{ FULL_TESTNAME }}; +jdbc:hive2> +jdbc:hive2> Closing: 0: jdbc:hive2://{{ HIVE_HOST }}:10000/hive_smoke_test_database_{{ FULL_TESTNAME }}{{ HIVE_PRINCIPAL }} +-- FDW test +CREATE SERVER hive_smoke_test_server + FOREIGN DATA WRAPPER hive_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER SERVER hive_smoke_test_server; +CREATE FOREIGN TABLE hive_smoke_test_foreign_table ( + name TEXT, + num INTEGER, + dub DOUBLE PRECISION, + longNum BIGINT, + bool BOOLEAN + ) + SERVER hive_smoke_test_server + OPTIONS (resource 'hive_smoke_test_database_{{ FULL_TESTNAME }}.hive_small_data_table_{{ FULL_TESTNAME }}'); +-- @description query01 for PXF test on small data +SELECT * FROM hive_smoke_test_foreign_table ORDER BY name; + name | num | dub | longnum | bool +---------+-----+--------+----------------+------ + row_1 | 1 | 0.0001 | 100000000000 | f + row_10 | 10 | 0.001 | 1000000000000 | t + row_100 | 100 | 0.01 | 10000000000000 | t + row_11 | 11 | 0.0011 | 1100000000000 | f + row_12 | 12 | 0.0012 | 1200000000000 | t + row_13 | 13 | 0.0013 | 1300000000000 | f + row_14 | 14 | 0.0014 | 1400000000000 | t + row_15 | 15 | 0.0015 | 1500000000000 | f + row_16 | 16 | 0.0016 | 1600000000000 | t + row_17 | 17 | 0.0017 | 1700000000000 | f + row_18 | 18 | 0.0018 | 1800000000000 | t + row_19 | 19 | 0.0019 | 1900000000000 | f + row_2 | 2 | 0.0002 | 200000000000 | t + row_20 | 20 | 0.002 | 2000000000000 | t + row_21 | 21 | 0.0021 | 2100000000000 | f + row_22 | 22 | 0.0022 | 2200000000000 | t + row_23 | 23 | 0.0023 | 2300000000000 | f + row_24 | 24 | 0.0024 | 2400000000000 | t + row_25 | 25 | 0.0025 | 2500000000000 | f + row_26 | 26 | 0.0026 | 2600000000000 | t + row_27 | 27 | 0.0027 | 2700000000000 | f + row_28 | 28 | 0.0028 | 2800000000000 | t + row_29 | 29 | 0.0029 | 2900000000000 | f + row_3 | 3 | 0.0003 | 300000000000 | f + row_30 | 30 | 0.003 | 3000000000000 | t + row_31 | 31 | 0.0031 | 3100000000000 | f + row_32 | 32 | 0.0032 | 3200000000000 | t + row_33 | 33 | 0.0033 | 3300000000000 | f + row_34 | 34 | 0.0034 | 3400000000000 | t + row_35 | 35 | 0.0035 | 3500000000000 | f + row_36 | 36 | 0.0036 | 3600000000000 | t + row_37 | 37 | 0.0037 | 3700000000000 | f + row_38 | 38 | 0.0038 | 3800000000000 | t + row_39 | 39 | 0.0039 | 3900000000000 | f + row_4 | 4 | 0.0004 | 400000000000 | t + row_40 | 40 | 0.004 | 4000000000000 | t + row_41 | 41 | 0.0041 | 4100000000000 | f + row_42 | 42 | 0.0042 | 4200000000000 | t + row_43 | 43 | 0.0043 | 4300000000000 | f + row_44 | 44 | 0.0044 | 4400000000000 | t + row_45 | 45 | 0.0045 | 4500000000000 | f + row_46 | 46 | 0.0046 | 4600000000000 | t + row_47 | 47 | 0.0047 | 4700000000000 | f + row_48 | 48 | 0.0048 | 4800000000000 | t + row_49 | 49 | 0.0049 | 4900000000000 | f + row_5 | 5 | 0.0005 | 500000000000 | f + row_50 | 50 | 0.005 | 5000000000000 | t + row_51 | 51 | 0.0051 | 5100000000000 | f + row_52 | 52 | 0.0052 | 5200000000000 | t + row_53 | 53 | 0.0053 | 5300000000000 | f + row_54 | 54 | 0.0054 | 5400000000000 | t + row_55 | 55 | 0.0055 | 5500000000000 | f + row_56 | 56 | 0.0056 | 5600000000000 | t + row_57 | 57 | 0.0057 | 5700000000000 | f + row_58 | 58 | 0.0058 | 5800000000000 | t + row_59 | 59 | 0.0059 | 5900000000000 | f + row_6 | 6 | 0.0006 | 600000000000 | t + row_60 | 60 | 0.006 | 6000000000000 | t + row_61 | 61 | 0.0061 | 6100000000000 | f + row_62 | 62 | 0.0062 | 6200000000000 | t + row_63 | 63 | 0.0063 | 6300000000000 | f + row_64 | 64 | 0.0064 | 6400000000000 | t + row_65 | 65 | 0.0065 | 6500000000000 | f + row_66 | 66 | 0.0066 | 6600000000000 | t + row_67 | 67 | 0.0067 | 6700000000000 | f + row_68 | 68 | 0.0068 | 6800000000000 | t + row_69 | 69 | 0.0069 | 6900000000000 | f + row_7 | 7 | 0.0007 | 700000000000 | f + row_70 | 70 | 0.007 | 7000000000000 | t + row_71 | 71 | 0.0071 | 7100000000000 | f + row_72 | 72 | 0.0072 | 7200000000000 | t + row_73 | 73 | 0.0073 | 7300000000000 | f + row_74 | 74 | 0.0074 | 7400000000000 | t + row_75 | 75 | 0.0075 | 7500000000000 | f + row_76 | 76 | 0.0076 | 7600000000000 | t + row_77 | 77 | 0.0077 | 7700000000000 | f + row_78 | 78 | 0.0078 | 7800000000000 | t + row_79 | 79 | 0.0079 | 7900000000000 | f + row_8 | 8 | 0.0008 | 800000000000 | t + row_80 | 80 | 0.008 | 8000000000000 | t + row_81 | 81 | 0.0081 | 8100000000000 | f + row_82 | 82 | 0.0082 | 8200000000000 | t + row_83 | 83 | 0.0083 | 8300000000000 | f + row_84 | 84 | 0.0084 | 8400000000000 | t + row_85 | 85 | 0.0085 | 8500000000000 | f + row_86 | 86 | 0.0086 | 8600000000000 | t + row_87 | 87 | 0.0087 | 8700000000000 | f + row_88 | 88 | 0.0088 | 8800000000000 | t + row_89 | 89 | 0.0089 | 8900000000000 | f + row_9 | 9 | 0.0009 | 900000000000 | f + row_90 | 90 | 0.009 | 9000000000000 | t + row_91 | 91 | 0.0091 | 9100000000000 | f + row_92 | 92 | 0.0092 | 9200000000000 | t + row_93 | 93 | 0.0093 | 9300000000000 | f + row_94 | 94 | 0.0094 | 9400000000000 | t + row_95 | 95 | 0.0095 | 9500000000000 | f + row_96 | 96 | 0.0096 | 9600000000000 | t + row_97 | 97 | 0.0097 | 9700000000000 | f + row_98 | 98 | 0.0098 | 9800000000000 | t + row_99 | 99 | 0.0099 | 9900000000000 | f +(100 rows) + +-- @description query02 for PXF test on small data +SELECT name, num FROM hive_smoke_test_foreign_table WHERE num > 50 ORDER BY name; + name | num +---------+----- + row_100 | 100 + row_51 | 51 + row_52 | 52 + row_53 | 53 + row_54 | 54 + row_55 | 55 + row_56 | 56 + row_57 | 57 + row_58 | 58 + row_59 | 59 + row_60 | 60 + row_61 | 61 + row_62 | 62 + row_63 | 63 + row_64 | 64 + row_65 | 65 + row_66 | 66 + row_67 | 67 + row_68 | 68 + row_69 | 69 + row_70 | 70 + row_71 | 71 + row_72 | 72 + row_73 | 73 + row_74 | 74 + row_75 | 75 + row_76 | 76 + row_77 | 77 + row_78 | 78 + row_79 | 79 + row_80 | 80 + row_81 | 81 + row_82 | 82 + row_83 | 83 + row_84 | 84 + row_85 | 85 + row_86 | 86 + row_87 | 87 + row_88 | 88 + row_89 | 89 + row_90 | 90 + row_91 | 91 + row_92 | 92 + row_93 | 93 + row_94 | 94 + row_95 | 95 + row_96 | 96 + row_97 | 97 + row_98 | 98 + row_99 | 99 +(50 rows) + +{{ CLEAN_UP }}-- clean up Hive and local disk +{{ CLEAN_UP }}\!rm -rf {{ TEST_LOCATION }} +{{ CLEAN_UP }}\!{{ BEELINE_CMD }} -f {{ SCRIPT cleanup_hive_smoke_test.sql }} +{{ CLEAN_UP }}beeline> !connect 'jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }}' "" "" "" +{{ CLEAN_UP }}Connecting to jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }} +{{ CLEAN_UP }}Connected to: Apache Hive +{{ CLEAN_UP }}Driver: Hive JDBC +{{ CLEAN_UP }}Transaction isolation: TRANSACTION_REPEATABLE_READ +{{ CLEAN_UP }}jdbc:hive2> DROP DATABASE hive_smoke_test_database_{{ FULL_TESTNAME }} CASCADE; +{{ CLEAN_UP }}jdbc:hive2> +{{ CLEAN_UP }}jdbc:hive2> Closing: 0: jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }} +{{ CLEAN_UP }}\!rm -rf {{ SCRIPT cleanup_hive_smoke_test.sql }} {{ SCRIPT load_small_data.sql }} {{ SCRIPT create_hive_smoke_test_database.sql }} +{{ CLEAN_UP }}{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} rm -rf {{ TEST_LOCATION }} diff --git a/regression/expected/FDW_MultiBlockDataSmokeTest.out b/regression/expected/FDW_MultiBlockDataSmokeTest.out new file mode 100644 index 0000000000..5b7f7b9b9b --- /dev/null +++ b/regression/expected/FDW_MultiBlockDataSmokeTest.out @@ -0,0 +1,62 @@ +-- FDW test +CREATE SERVER multi_block_data_smoke_test_server + FOREIGN DATA WRAPPER {{ HCFS_PROTOCOL }}_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER SERVER multi_block_data_smoke_test_server; +CREATE FOREIGN TABLE multi_block_data_smoke_test_foreign_table ( + t1 TEXT, + a1 INTEGER + ) SERVER multi_block_data_smoke_test_server + OPTIONS (resource '{{ HCFS_BUCKET }}{{ TEST_LOCATION }}', format 'csv'); +-- write to writable table +INSERT INTO multi_block_data_smoke_test_foreign_table + SELECT format('t%s', i::varchar(255)), i + from generate_series(1, 32000000) s(i); +WARNING: skipping "multi_block_data_smoke_test_foreign_table" --- cannot analyze this foreign table +-- Verify data entered HCFS correctly, no distributed by in FDW yet +\!{ for i in $({{ HCFS_CMD }} dfs -ls {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} 2>/dev/null | tail -n +2 | awk '{print $NF}'); do {{ HCFS_CMD }} dfs -cat $i 2>/dev/null | head -1; done } | sort | head -1 +t1,1 +-- @description query01 for PXF test on Multi Blocked data +SELECT count(*) FROM multi_block_data_smoke_test_foreign_table; + count +---------- + 32000000 +(1 row) + +-- @description query02 for PXF test on Multi Blocked data +SELECT sum(a1) FROM multi_block_data_smoke_test_foreign_table; + sum +----------------- + 512000016000000 +(1 row) + +-- @description query03 for PXF test on Multi Blocked data +SELECT t1, a1 FROM multi_block_data_smoke_test_foreign_table ORDER BY t1 LIMIT 10; + t1 | a1 +-----------+---------- + t1 | 1 + t10 | 10 + t100 | 100 + t1000 | 1000 + t10000 | 10000 + t100000 | 100000 + t1000000 | 1000000 + t10000000 | 10000000 + t10000001 | 10000001 + t10000002 | 10000002 +(10 rows) + +-- @description query04 for PXF test on Multi Blocked data +SELECT cnt < 32000000 AS check FROM ( + SELECT COUNT(*) AS cnt + FROM multi_block_data_smoke_test_foreign_table + WHERE gp_segment_id = 0 + ) AS a; + check +------- + t +(1 row) + +{{ CLEAN_UP }}-- clean up HCFS +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r -f {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}Deleted {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} diff --git a/regression/expected/FDW_WritableSmokeTest.out b/regression/expected/FDW_WritableSmokeTest.out new file mode 100644 index 0000000000..0191d87203 --- /dev/null +++ b/regression/expected/FDW_WritableSmokeTest.out @@ -0,0 +1,188 @@ +-- FDW test +CREATE SERVER writable_smoke_test_hdfs + FOREIGN DATA WRAPPER {{ HCFS_PROTOCOL }}_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER SERVER writable_smoke_test_hdfs; +CREATE FOREIGN TABLE writable_smoke_test_foreign_table ( + name TEXT, + num INTEGER, + dub DOUBLE PRECISION, + longNum BIGINT, + bool BOOLEAN + ) SERVER writable_smoke_test_hdfs + OPTIONS (resource '{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_fdw', format 'csv', delimiter '|'); +-- write to writable table +INSERT INTO writable_smoke_test_foreign_table + SELECT format('row_%s',i::varchar(255)), + i, + i+0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true'::boolean ELSE 'false'::boolean END + from generate_series(1, 100) s(i); +WARNING: skipping "writable_smoke_test_foreign_table" --- cannot analyze this foreign table +-- Verify data entered HCFS correctly, no distributed by in FDW yet +\!{ for i in $({{ HCFS_CMD }} dfs -ls {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_fdw 2>/dev/null | tail -n +2 | awk '{print $NF}'); do {{ HCFS_CMD }} dfs -cat $i 2>/dev/null | head -1; done } | sort | head -1 +row_1|1|1.0001|100000000000|f +SELECT * FROM writable_smoke_test_foreign_table ORDER BY name; + name | num | dub | longnum | bool +---------+-----+----------+----------------+------ + row_1 | 1 | 1.0001 | 100000000000 | f + row_10 | 10 | 10.0001 | 1000000000000 | t + row_100 | 100 | 100.0001 | 10000000000000 | t + row_11 | 11 | 11.0001 | 1100000000000 | f + row_12 | 12 | 12.0001 | 1200000000000 | t + row_13 | 13 | 13.0001 | 1300000000000 | f + row_14 | 14 | 14.0001 | 1400000000000 | t + row_15 | 15 | 15.0001 | 1500000000000 | f + row_16 | 16 | 16.0001 | 1600000000000 | t + row_17 | 17 | 17.0001 | 1700000000000 | f + row_18 | 18 | 18.0001 | 1800000000000 | t + row_19 | 19 | 19.0001 | 1900000000000 | f + row_2 | 2 | 2.0001 | 200000000000 | t + row_20 | 20 | 20.0001 | 2000000000000 | t + row_21 | 21 | 21.0001 | 2100000000000 | f + row_22 | 22 | 22.0001 | 2200000000000 | t + row_23 | 23 | 23.0001 | 2300000000000 | f + row_24 | 24 | 24.0001 | 2400000000000 | t + row_25 | 25 | 25.0001 | 2500000000000 | f + row_26 | 26 | 26.0001 | 2600000000000 | t + row_27 | 27 | 27.0001 | 2700000000000 | f + row_28 | 28 | 28.0001 | 2800000000000 | t + row_29 | 29 | 29.0001 | 2900000000000 | f + row_3 | 3 | 3.0001 | 300000000000 | f + row_30 | 30 | 30.0001 | 3000000000000 | t + row_31 | 31 | 31.0001 | 3100000000000 | f + row_32 | 32 | 32.0001 | 3200000000000 | t + row_33 | 33 | 33.0001 | 3300000000000 | f + row_34 | 34 | 34.0001 | 3400000000000 | t + row_35 | 35 | 35.0001 | 3500000000000 | f + row_36 | 36 | 36.0001 | 3600000000000 | t + row_37 | 37 | 37.0001 | 3700000000000 | f + row_38 | 38 | 38.0001 | 3800000000000 | t + row_39 | 39 | 39.0001 | 3900000000000 | f + row_4 | 4 | 4.0001 | 400000000000 | t + row_40 | 40 | 40.0001 | 4000000000000 | t + row_41 | 41 | 41.0001 | 4100000000000 | f + row_42 | 42 | 42.0001 | 4200000000000 | t + row_43 | 43 | 43.0001 | 4300000000000 | f + row_44 | 44 | 44.0001 | 4400000000000 | t + row_45 | 45 | 45.0001 | 4500000000000 | f + row_46 | 46 | 46.0001 | 4600000000000 | t + row_47 | 47 | 47.0001 | 4700000000000 | f + row_48 | 48 | 48.0001 | 4800000000000 | t + row_49 | 49 | 49.0001 | 4900000000000 | f + row_5 | 5 | 5.0001 | 500000000000 | f + row_50 | 50 | 50.0001 | 5000000000000 | t + row_51 | 51 | 51.0001 | 5100000000000 | f + row_52 | 52 | 52.0001 | 5200000000000 | t + row_53 | 53 | 53.0001 | 5300000000000 | f + row_54 | 54 | 54.0001 | 5400000000000 | t + row_55 | 55 | 55.0001 | 5500000000000 | f + row_56 | 56 | 56.0001 | 5600000000000 | t + row_57 | 57 | 57.0001 | 5700000000000 | f + row_58 | 58 | 58.0001 | 5800000000000 | t + row_59 | 59 | 59.0001 | 5900000000000 | f + row_6 | 6 | 6.0001 | 600000000000 | t + row_60 | 60 | 60.0001 | 6000000000000 | t + row_61 | 61 | 61.0001 | 6100000000000 | f + row_62 | 62 | 62.0001 | 6200000000000 | t + row_63 | 63 | 63.0001 | 6300000000000 | f + row_64 | 64 | 64.0001 | 6400000000000 | t + row_65 | 65 | 65.0001 | 6500000000000 | f + row_66 | 66 | 66.0001 | 6600000000000 | t + row_67 | 67 | 67.0001 | 6700000000000 | f + row_68 | 68 | 68.0001 | 6800000000000 | t + row_69 | 69 | 69.0001 | 6900000000000 | f + row_7 | 7 | 7.0001 | 700000000000 | f + row_70 | 70 | 70.0001 | 7000000000000 | t + row_71 | 71 | 71.0001 | 7100000000000 | f + row_72 | 72 | 72.0001 | 7200000000000 | t + row_73 | 73 | 73.0001 | 7300000000000 | f + row_74 | 74 | 74.0001 | 7400000000000 | t + row_75 | 75 | 75.0001 | 7500000000000 | f + row_76 | 76 | 76.0001 | 7600000000000 | t + row_77 | 77 | 77.0001 | 7700000000000 | f + row_78 | 78 | 78.0001 | 7800000000000 | t + row_79 | 79 | 79.0001 | 7900000000000 | f + row_8 | 8 | 8.0001 | 800000000000 | t + row_80 | 80 | 80.0001 | 8000000000000 | t + row_81 | 81 | 81.0001 | 8100000000000 | f + row_82 | 82 | 82.0001 | 8200000000000 | t + row_83 | 83 | 83.0001 | 8300000000000 | f + row_84 | 84 | 84.0001 | 8400000000000 | t + row_85 | 85 | 85.0001 | 8500000000000 | f + row_86 | 86 | 86.0001 | 8600000000000 | t + row_87 | 87 | 87.0001 | 8700000000000 | f + row_88 | 88 | 88.0001 | 8800000000000 | t + row_89 | 89 | 89.0001 | 8900000000000 | f + row_9 | 9 | 9.0001 | 900000000000 | f + row_90 | 90 | 90.0001 | 9000000000000 | t + row_91 | 91 | 91.0001 | 9100000000000 | f + row_92 | 92 | 92.0001 | 9200000000000 | t + row_93 | 93 | 93.0001 | 9300000000000 | f + row_94 | 94 | 94.0001 | 9400000000000 | t + row_95 | 95 | 95.0001 | 9500000000000 | f + row_96 | 96 | 96.0001 | 9600000000000 | t + row_97 | 97 | 97.0001 | 9700000000000 | f + row_98 | 98 | 98.0001 | 9800000000000 | t + row_99 | 99 | 99.0001 | 9900000000000 | f +(100 rows) + +SELECT name, num FROM writable_smoke_test_foreign_table WHERE num > 50 ORDER BY name; + name | num +---------+----- + row_100 | 100 + row_51 | 51 + row_52 | 52 + row_53 | 53 + row_54 | 54 + row_55 | 55 + row_56 | 56 + row_57 | 57 + row_58 | 58 + row_59 | 59 + row_60 | 60 + row_61 | 61 + row_62 | 62 + row_63 | 63 + row_64 | 64 + row_65 | 65 + row_66 | 66 + row_67 | 67 + row_68 | 68 + row_69 | 69 + row_70 | 70 + row_71 | 71 + row_72 | 72 + row_73 | 73 + row_74 | 74 + row_75 | 75 + row_76 | 76 + row_77 | 77 + row_78 | 78 + row_79 | 79 + row_80 | 80 + row_81 | 81 + row_82 | 82 + row_83 | 83 + row_84 | 84 + row_85 | 85 + row_86 | 86 + row_87 | 87 + row_88 | 88 + row_89 | 89 + row_90 | 90 + row_91 | 91 + row_92 | 92 + row_93 | 93 + row_94 | 94 + row_95 | 95 + row_96 | 96 + row_97 | 97 + row_98 | 98 + row_99 | 99 +(50 rows) + +{{ CLEAN_UP }}-- clean up HCFS +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r -f {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}Deleted {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} diff --git a/regression/expected/HBaseSmokeTest.out b/regression/expected/HBaseSmokeTest.out new file mode 100644 index 0000000000..8b39cc19ea --- /dev/null +++ b/regression/expected/HBaseSmokeTest.out @@ -0,0 +1,677 @@ +-- Create Hbase tables hbase_table and pxflookup +\!{{ HBASE_CMD }} shell {{ SCRIPT create_pxflookup.rb }} >/dev/null 2>&1 +\!{{ HBASE_CMD }} shell {{ SCRIPT gen_small_data.rb }} +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +0 row(s) in -.---- seconds +-- External Table test +CREATE EXTERNAL TABLE h_base_smoke_test_external_table + (name TEXT, num INTEGER, dub DOUBLE PRECISION, longnum BIGINT, bool BOOLEAN) + LOCATION('pxf://hbase_small_data_table_{{ FULL_TESTNAME }}?PROFILE=HBase{{ SERVER_PARAM }}') + FORMAT 'CUSTOM' (FORMATTER='pxfwritable_import'); +SELECT * FROM h_base_smoke_test_external_table ORDER BY name; + name | num | dub | longnum | bool +---------+-----+--------+----------------+------ + row_1 | 1 | 1.001 | 100000000000 | f + row_10 | 10 | 10.01 | 1000000000000 | t + row_100 | 100 | 100.1 | 10000000000000 | t + row_11 | 11 | 11.011 | 1100000000000 | f + row_12 | 12 | 12.012 | 1200000000000 | t + row_13 | 13 | 13.013 | 1300000000000 | f + row_14 | 14 | 14.014 | 1400000000000 | t + row_15 | 15 | 15.015 | 1500000000000 | f + row_16 | 16 | 16.016 | 1600000000000 | t + row_17 | 17 | 17.017 | 1700000000000 | f + row_18 | 18 | 18.018 | 1800000000000 | t + row_19 | 19 | 19.019 | 1900000000000 | f + row_2 | 2 | 2.002 | 200000000000 | t + row_20 | 20 | 20.02 | 2000000000000 | t + row_21 | 21 | 21.021 | 2100000000000 | f + row_22 | 22 | 22.022 | 2200000000000 | t + row_23 | 23 | 23.023 | 2300000000000 | f + row_24 | 24 | 24.024 | 2400000000000 | t + row_25 | 25 | 25.025 | 2500000000000 | f + row_26 | 26 | 26.026 | 2600000000000 | t + row_27 | 27 | 27.027 | 2700000000000 | f + row_28 | 28 | 28.028 | 2800000000000 | t + row_29 | 29 | 29.029 | 2900000000000 | f + row_3 | 3 | 3.003 | 300000000000 | f + row_30 | 30 | 30.03 | 3000000000000 | t + row_31 | 31 | 31.031 | 3100000000000 | f + row_32 | 32 | 32.032 | 3200000000000 | t + row_33 | 33 | 33.033 | 3300000000000 | f + row_34 | 34 | 34.034 | 3400000000000 | t + row_35 | 35 | 35.035 | 3500000000000 | f + row_36 | 36 | 36.036 | 3600000000000 | t + row_37 | 37 | 37.037 | 3700000000000 | f + row_38 | 38 | 38.038 | 3800000000000 | t + row_39 | 39 | 39.039 | 3900000000000 | f + row_4 | 4 | 4.004 | 400000000000 | t + row_40 | 40 | 40.04 | 4000000000000 | t + row_41 | 41 | 41.041 | 4100000000000 | f + row_42 | 42 | 42.042 | 4200000000000 | t + row_43 | 43 | 43.043 | 4300000000000 | f + row_44 | 44 | 44.044 | 4400000000000 | t + row_45 | 45 | 45.045 | 4500000000000 | f + row_46 | 46 | 46.046 | 4600000000000 | t + row_47 | 47 | 47.047 | 4700000000000 | f + row_48 | 48 | 48.048 | 4800000000000 | t + row_49 | 49 | 49.049 | 4900000000000 | f + row_5 | 5 | 5.005 | 500000000000 | f + row_50 | 50 | 50.05 | 5000000000000 | t + row_51 | 51 | 51.051 | 5100000000000 | f + row_52 | 52 | 52.052 | 5200000000000 | t + row_53 | 53 | 53.053 | 5300000000000 | f + row_54 | 54 | 54.054 | 5400000000000 | t + row_55 | 55 | 55.055 | 5500000000000 | f + row_56 | 56 | 56.056 | 5600000000000 | t + row_57 | 57 | 57.057 | 5700000000000 | f + row_58 | 58 | 58.058 | 5800000000000 | t + row_59 | 59 | 59.059 | 5900000000000 | f + row_6 | 6 | 6.006 | 600000000000 | t + row_60 | 60 | 60.06 | 6000000000000 | t + row_61 | 61 | 61.061 | 6100000000000 | f + row_62 | 62 | 62.062 | 6200000000000 | t + row_63 | 63 | 63.063 | 6300000000000 | f + row_64 | 64 | 64.064 | 6400000000000 | t + row_65 | 65 | 65.065 | 6500000000000 | f + row_66 | 66 | 66.066 | 6600000000000 | t + row_67 | 67 | 67.067 | 6700000000000 | f + row_68 | 68 | 68.068 | 6800000000000 | t + row_69 | 69 | 69.069 | 6900000000000 | f + row_7 | 7 | 7.007 | 700000000000 | f + row_70 | 70 | 70.07 | 7000000000000 | t + row_71 | 71 | 71.071 | 7100000000000 | f + row_72 | 72 | 72.072 | 7200000000000 | t + row_73 | 73 | 73.073 | 7300000000000 | f + row_74 | 74 | 74.074 | 7400000000000 | t + row_75 | 75 | 75.075 | 7500000000000 | f + row_76 | 76 | 76.076 | 7600000000000 | t + row_77 | 77 | 77.077 | 7700000000000 | f + row_78 | 78 | 78.078 | 7800000000000 | t + row_79 | 79 | 79.079 | 7900000000000 | f + row_8 | 8 | 8.008 | 800000000000 | t + row_80 | 80 | 80.08 | 8000000000000 | t + row_81 | 81 | 81.081 | 8100000000000 | f + row_82 | 82 | 82.082 | 8200000000000 | t + row_83 | 83 | 83.083 | 8300000000000 | f + row_84 | 84 | 84.084 | 8400000000000 | t + row_85 | 85 | 85.085 | 8500000000000 | f + row_86 | 86 | 86.086 | 8600000000000 | t + row_87 | 87 | 87.087 | 8700000000000 | f + row_88 | 88 | 88.088 | 8800000000000 | t + row_89 | 89 | 89.089 | 8900000000000 | f + row_9 | 9 | 9.009 | 900000000000 | f + row_90 | 90 | 90.09 | 9000000000000 | t + row_91 | 91 | 91.091 | 9100000000000 | f + row_92 | 92 | 92.092 | 9200000000000 | t + row_93 | 93 | 93.093 | 9300000000000 | f + row_94 | 94 | 94.094 | 9400000000000 | t + row_95 | 95 | 95.095 | 9500000000000 | f + row_96 | 96 | 96.096 | 9600000000000 | t + row_97 | 97 | 97.097 | 9700000000000 | f + row_98 | 98 | 98.098 | 9800000000000 | t + row_99 | 99 | 99.099 | 9900000000000 | f +(100 rows) + +SELECT name, num FROM h_base_smoke_test_external_table WHERE num > 50 ORDER BY name; + name | num +---------+----- + row_100 | 100 + row_51 | 51 + row_52 | 52 + row_53 | 53 + row_54 | 54 + row_55 | 55 + row_56 | 56 + row_57 | 57 + row_58 | 58 + row_59 | 59 + row_60 | 60 + row_61 | 61 + row_62 | 62 + row_63 | 63 + row_64 | 64 + row_65 | 65 + row_66 | 66 + row_67 | 67 + row_68 | 68 + row_69 | 69 + row_70 | 70 + row_71 | 71 + row_72 | 72 + row_73 | 73 + row_74 | 74 + row_75 | 75 + row_76 | 76 + row_77 | 77 + row_78 | 78 + row_79 | 79 + row_80 | 80 + row_81 | 81 + row_82 | 82 + row_83 | 83 + row_84 | 84 + row_85 | 85 + row_86 | 86 + row_87 | 87 + row_88 | 88 + row_89 | 89 + row_90 | 90 + row_91 | 91 + row_92 | 92 + row_93 | 93 + row_94 | 94 + row_95 | 95 + row_96 | 96 + row_97 | 97 + row_98 | 98 + row_99 | 99 +(50 rows) + +-- clean up HBase +{{ CLEAN_UP }}\!{{ HBASE_CMD }} shell {{ SCRIPT drop_small_data.rb }} >/dev/null 2>&1 +{{ CLEAN_UP }}\!rm -rf {{ SCRIPT drop_small_data.rb }} {{ SCRIPT gen_small_data.rb }} {{ SCRIPT create_pxflookup.rb }} diff --git a/regression/expected/HdfsSmokeTest.out b/regression/expected/HdfsSmokeTest.out new file mode 100644 index 0000000000..d879eb88da --- /dev/null +++ b/regression/expected/HdfsSmokeTest.out @@ -0,0 +1,186 @@ +-- data prep +{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} mkdir -p {{ TEST_LOCATION }} +\!mkdir -p {{ TEST_LOCATION }} +COPY ( + SELECT format('row_%s',i::varchar(255)), + i, + i+0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true' ELSE 'false' END + from generate_series(1, 100) s(i) + ) TO '{{ TEST_LOCATION }}/data.csv' + WITH (FORMAT 'csv'); +{{ GPDB_REMOTE }}-- if GPDB is remote, will need to scp file down from there for beeline +{{ GPDB_REMOTE }}\!scp {{ PGHOST }}:{{ TEST_LOCATION }}/data.csv {{ TEST_LOCATION }} +\!{{ HCFS_CMD }} dfs -mkdir -p {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +\!{{ HCFS_CMD }} dfs -copyFromLocal {{ TEST_LOCATION }}/data.csv {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +-- External Table test +CREATE EXTERNAL TABLE hdfs_smoke_test_external_table + (name TEXT, num INTEGER, dub DOUBLE PRECISION, longNum BIGINT, bool BOOLEAN) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/data.csv?PROFILE={{ HCFS_PROTOCOL }}:csv{{ SERVER_PARAM }}') + FORMAT 'CSV' (DELIMITER ','); +SELECT * FROM hdfs_smoke_test_external_table ORDER BY name; + name | num | dub | longnum | bool +---------+-----+----------+----------------+------ + row_1 | 1 | 1.0001 | 100000000000 | f + row_10 | 10 | 10.0001 | 1000000000000 | t + row_100 | 100 | 100.0001 | 10000000000000 | t + row_11 | 11 | 11.0001 | 1100000000000 | f + row_12 | 12 | 12.0001 | 1200000000000 | t + row_13 | 13 | 13.0001 | 1300000000000 | f + row_14 | 14 | 14.0001 | 1400000000000 | t + row_15 | 15 | 15.0001 | 1500000000000 | f + row_16 | 16 | 16.0001 | 1600000000000 | t + row_17 | 17 | 17.0001 | 1700000000000 | f + row_18 | 18 | 18.0001 | 1800000000000 | t + row_19 | 19 | 19.0001 | 1900000000000 | f + row_2 | 2 | 2.0001 | 200000000000 | t + row_20 | 20 | 20.0001 | 2000000000000 | t + row_21 | 21 | 21.0001 | 2100000000000 | f + row_22 | 22 | 22.0001 | 2200000000000 | t + row_23 | 23 | 23.0001 | 2300000000000 | f + row_24 | 24 | 24.0001 | 2400000000000 | t + row_25 | 25 | 25.0001 | 2500000000000 | f + row_26 | 26 | 26.0001 | 2600000000000 | t + row_27 | 27 | 27.0001 | 2700000000000 | f + row_28 | 28 | 28.0001 | 2800000000000 | t + row_29 | 29 | 29.0001 | 2900000000000 | f + row_3 | 3 | 3.0001 | 300000000000 | f + row_30 | 30 | 30.0001 | 3000000000000 | t + row_31 | 31 | 31.0001 | 3100000000000 | f + row_32 | 32 | 32.0001 | 3200000000000 | t + row_33 | 33 | 33.0001 | 3300000000000 | f + row_34 | 34 | 34.0001 | 3400000000000 | t + row_35 | 35 | 35.0001 | 3500000000000 | f + row_36 | 36 | 36.0001 | 3600000000000 | t + row_37 | 37 | 37.0001 | 3700000000000 | f + row_38 | 38 | 38.0001 | 3800000000000 | t + row_39 | 39 | 39.0001 | 3900000000000 | f + row_4 | 4 | 4.0001 | 400000000000 | t + row_40 | 40 | 40.0001 | 4000000000000 | t + row_41 | 41 | 41.0001 | 4100000000000 | f + row_42 | 42 | 42.0001 | 4200000000000 | t + row_43 | 43 | 43.0001 | 4300000000000 | f + row_44 | 44 | 44.0001 | 4400000000000 | t + row_45 | 45 | 45.0001 | 4500000000000 | f + row_46 | 46 | 46.0001 | 4600000000000 | t + row_47 | 47 | 47.0001 | 4700000000000 | f + row_48 | 48 | 48.0001 | 4800000000000 | t + row_49 | 49 | 49.0001 | 4900000000000 | f + row_5 | 5 | 5.0001 | 500000000000 | f + row_50 | 50 | 50.0001 | 5000000000000 | t + row_51 | 51 | 51.0001 | 5100000000000 | f + row_52 | 52 | 52.0001 | 5200000000000 | t + row_53 | 53 | 53.0001 | 5300000000000 | f + row_54 | 54 | 54.0001 | 5400000000000 | t + row_55 | 55 | 55.0001 | 5500000000000 | f + row_56 | 56 | 56.0001 | 5600000000000 | t + row_57 | 57 | 57.0001 | 5700000000000 | f + row_58 | 58 | 58.0001 | 5800000000000 | t + row_59 | 59 | 59.0001 | 5900000000000 | f + row_6 | 6 | 6.0001 | 600000000000 | t + row_60 | 60 | 60.0001 | 6000000000000 | t + row_61 | 61 | 61.0001 | 6100000000000 | f + row_62 | 62 | 62.0001 | 6200000000000 | t + row_63 | 63 | 63.0001 | 6300000000000 | f + row_64 | 64 | 64.0001 | 6400000000000 | t + row_65 | 65 | 65.0001 | 6500000000000 | f + row_66 | 66 | 66.0001 | 6600000000000 | t + row_67 | 67 | 67.0001 | 6700000000000 | f + row_68 | 68 | 68.0001 | 6800000000000 | t + row_69 | 69 | 69.0001 | 6900000000000 | f + row_7 | 7 | 7.0001 | 700000000000 | f + row_70 | 70 | 70.0001 | 7000000000000 | t + row_71 | 71 | 71.0001 | 7100000000000 | f + row_72 | 72 | 72.0001 | 7200000000000 | t + row_73 | 73 | 73.0001 | 7300000000000 | f + row_74 | 74 | 74.0001 | 7400000000000 | t + row_75 | 75 | 75.0001 | 7500000000000 | f + row_76 | 76 | 76.0001 | 7600000000000 | t + row_77 | 77 | 77.0001 | 7700000000000 | f + row_78 | 78 | 78.0001 | 7800000000000 | t + row_79 | 79 | 79.0001 | 7900000000000 | f + row_8 | 8 | 8.0001 | 800000000000 | t + row_80 | 80 | 80.0001 | 8000000000000 | t + row_81 | 81 | 81.0001 | 8100000000000 | f + row_82 | 82 | 82.0001 | 8200000000000 | t + row_83 | 83 | 83.0001 | 8300000000000 | f + row_84 | 84 | 84.0001 | 8400000000000 | t + row_85 | 85 | 85.0001 | 8500000000000 | f + row_86 | 86 | 86.0001 | 8600000000000 | t + row_87 | 87 | 87.0001 | 8700000000000 | f + row_88 | 88 | 88.0001 | 8800000000000 | t + row_89 | 89 | 89.0001 | 8900000000000 | f + row_9 | 9 | 9.0001 | 900000000000 | f + row_90 | 90 | 90.0001 | 9000000000000 | t + row_91 | 91 | 91.0001 | 9100000000000 | f + row_92 | 92 | 92.0001 | 9200000000000 | t + row_93 | 93 | 93.0001 | 9300000000000 | f + row_94 | 94 | 94.0001 | 9400000000000 | t + row_95 | 95 | 95.0001 | 9500000000000 | f + row_96 | 96 | 96.0001 | 9600000000000 | t + row_97 | 97 | 97.0001 | 9700000000000 | f + row_98 | 98 | 98.0001 | 9800000000000 | t + row_99 | 99 | 99.0001 | 9900000000000 | f +(100 rows) + +SELECT name, num FROM hdfs_smoke_test_external_table WHERE num > 50 ORDER BY name; + name | num +---------+----- + row_100 | 100 + row_51 | 51 + row_52 | 52 + row_53 | 53 + row_54 | 54 + row_55 | 55 + row_56 | 56 + row_57 | 57 + row_58 | 58 + row_59 | 59 + row_60 | 60 + row_61 | 61 + row_62 | 62 + row_63 | 63 + row_64 | 64 + row_65 | 65 + row_66 | 66 + row_67 | 67 + row_68 | 68 + row_69 | 69 + row_70 | 70 + row_71 | 71 + row_72 | 72 + row_73 | 73 + row_74 | 74 + row_75 | 75 + row_76 | 76 + row_77 | 77 + row_78 | 78 + row_79 | 79 + row_80 | 80 + row_81 | 81 + row_82 | 82 + row_83 | 83 + row_84 | 84 + row_85 | 85 + row_86 | 86 + row_87 | 87 + row_88 | 88 + row_89 | 89 + row_90 | 90 + row_91 | 91 + row_92 | 92 + row_93 | 93 + row_94 | 94 + row_95 | 95 + row_96 | 96 + row_97 | 97 + row_98 | 98 + row_99 | 99 +(50 rows) + +{{ CLEAN_UP }}-- clean up HCFS and local disk +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}Deleted {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}\!rm -rf {{ TEST_LOCATION }} +{{ CLEAN_UP }}{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} rm -rf {{ TEST_LOCATION }} diff --git a/regression/expected/HiveSmokeTest.out b/regression/expected/HiveSmokeTest.out new file mode 100644 index 0000000000..1ed686f5dc --- /dev/null +++ b/regression/expected/HiveSmokeTest.out @@ -0,0 +1,227 @@ +-- data prep +{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} mkdir -p {{ TEST_LOCATION }} +\!mkdir -p {{ TEST_LOCATION }} +COPY ( + SELECT format('row_%s',i::varchar(255)), + i, + i*0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true' ELSE 'false' END + from generate_series(1, 100) s(i) + ) TO '{{ TEST_LOCATION }}/data.csv' + WITH (FORMAT 'csv'); +{{ GPDB_REMOTE }}-- if GPDB is remote, will need to scp file down from there for beeline +{{ GPDB_REMOTE }}\!scp {{ PGHOST }}:{{ TEST_LOCATION }}/data.csv {{ TEST_LOCATION }} +{{ HIVE_REMOTE }}-- if hive is remote, will need to scp file up there to load it in +{{ HIVE_REMOTE }}\!cat {{ TEST_LOCATION }}/data.csv | ssh {{ HIVE_HOST }} 'mkdir -p {{ TEST_LOCATION }} && cat > {{ TEST_LOCATION }}/data.csv' +\!{{ BEELINE_CMD }} -f {{ SCRIPT create_hive_smoke_test_database.sql }} -u 'jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }}' +Connecting to jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }} +Connected to: Apache Hive +Driver: Hive JDBC +Transaction isolation: TRANSACTION_REPEATABLE_READ +jdbc:hive2> CREATE DATABASE hive_smoke_test_database_{{ FULL_TESTNAME }}; +jdbc:hive2> +jdbc:hive2> Closing: 0: jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }} +\!{{ BEELINE_CMD }} -f {{ SCRIPT load_small_data.sql }} -u 'jdbc:hive2://{{ HIVE_HOST }}:10000/hive_smoke_test_database_{{ FULL_TESTNAME }}{{ HIVE_PRINCIPAL }}' +Connecting to jdbc:hive2://{{ HIVE_HOST }}:10000/hive_smoke_test_database_{{ FULL_TESTNAME }}{{ HIVE_PRINCIPAL }} +Connected to: Apache Hive +Driver: Hive JDBC +Transaction isolation: TRANSACTION_REPEATABLE_READ +jdbc:hive2> CREATE TABLE hive_small_data_table_{{ FULL_TESTNAME }} ( +jdbc:hive2> s1 string, +jdbc:hive2> n1 int, +jdbc:hive2> d1 double, +jdbc:hive2> bg bigint, +jdbc:hive2> b boolean +jdbc:hive2> ) +jdbc:hive2> ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' +jdbc:hive2> STORED AS textfile; +jdbc:hive2> LOAD DATA LOCAL INPATH '{{ TEST_LOCATION }}/data.csv' +jdbc:hive2> INTO TABLE hive_small_data_table_{{ FULL_TESTNAME }}; +jdbc:hive2> +jdbc:hive2> Closing: 0: jdbc:hive2://{{ HIVE_HOST }}:10000/hive_smoke_test_database_{{ FULL_TESTNAME }}{{ HIVE_PRINCIPAL }} +-- External Table test +CREATE EXTERNAL TABLE hive_smoke_test_external_table ( + name TEXT, + num INTEGER, + dub DOUBLE PRECISION, + longNum BIGINT, + bool BOOLEAN + ) + LOCATION('pxf://hive_smoke_test_database_{{ FULL_TESTNAME }}.hive_small_data_table_{{ FULL_TESTNAME }}?PROFILE=Hive{{ SERVER_PARAM }}') + FORMAT 'CUSTOM' (FORMATTER='pxfwritable_import'); +-- @description query01 for PXF test on small data +SELECT * FROM hive_smoke_test_external_table ORDER BY name; + name | num | dub | longnum | bool +---------+-----+--------+----------------+------ + row_1 | 1 | 0.0001 | 100000000000 | f + row_10 | 10 | 0.001 | 1000000000000 | t + row_100 | 100 | 0.01 | 10000000000000 | t + row_11 | 11 | 0.0011 | 1100000000000 | f + row_12 | 12 | 0.0012 | 1200000000000 | t + row_13 | 13 | 0.0013 | 1300000000000 | f + row_14 | 14 | 0.0014 | 1400000000000 | t + row_15 | 15 | 0.0015 | 1500000000000 | f + row_16 | 16 | 0.0016 | 1600000000000 | t + row_17 | 17 | 0.0017 | 1700000000000 | f + row_18 | 18 | 0.0018 | 1800000000000 | t + row_19 | 19 | 0.0019 | 1900000000000 | f + row_2 | 2 | 0.0002 | 200000000000 | t + row_20 | 20 | 0.002 | 2000000000000 | t + row_21 | 21 | 0.0021 | 2100000000000 | f + row_22 | 22 | 0.0022 | 2200000000000 | t + row_23 | 23 | 0.0023 | 2300000000000 | f + row_24 | 24 | 0.0024 | 2400000000000 | t + row_25 | 25 | 0.0025 | 2500000000000 | f + row_26 | 26 | 0.0026 | 2600000000000 | t + row_27 | 27 | 0.0027 | 2700000000000 | f + row_28 | 28 | 0.0028 | 2800000000000 | t + row_29 | 29 | 0.0029 | 2900000000000 | f + row_3 | 3 | 0.0003 | 300000000000 | f + row_30 | 30 | 0.003 | 3000000000000 | t + row_31 | 31 | 0.0031 | 3100000000000 | f + row_32 | 32 | 0.0032 | 3200000000000 | t + row_33 | 33 | 0.0033 | 3300000000000 | f + row_34 | 34 | 0.0034 | 3400000000000 | t + row_35 | 35 | 0.0035 | 3500000000000 | f + row_36 | 36 | 0.0036 | 3600000000000 | t + row_37 | 37 | 0.0037 | 3700000000000 | f + row_38 | 38 | 0.0038 | 3800000000000 | t + row_39 | 39 | 0.0039 | 3900000000000 | f + row_4 | 4 | 0.0004 | 400000000000 | t + row_40 | 40 | 0.004 | 4000000000000 | t + row_41 | 41 | 0.0041 | 4100000000000 | f + row_42 | 42 | 0.0042 | 4200000000000 | t + row_43 | 43 | 0.0043 | 4300000000000 | f + row_44 | 44 | 0.0044 | 4400000000000 | t + row_45 | 45 | 0.0045 | 4500000000000 | f + row_46 | 46 | 0.0046 | 4600000000000 | t + row_47 | 47 | 0.0047 | 4700000000000 | f + row_48 | 48 | 0.0048 | 4800000000000 | t + row_49 | 49 | 0.0049 | 4900000000000 | f + row_5 | 5 | 0.0005 | 500000000000 | f + row_50 | 50 | 0.005 | 5000000000000 | t + row_51 | 51 | 0.0051 | 5100000000000 | f + row_52 | 52 | 0.0052 | 5200000000000 | t + row_53 | 53 | 0.0053 | 5300000000000 | f + row_54 | 54 | 0.0054 | 5400000000000 | t + row_55 | 55 | 0.0055 | 5500000000000 | f + row_56 | 56 | 0.0056 | 5600000000000 | t + row_57 | 57 | 0.0057 | 5700000000000 | f + row_58 | 58 | 0.0058 | 5800000000000 | t + row_59 | 59 | 0.0059 | 5900000000000 | f + row_6 | 6 | 0.0006 | 600000000000 | t + row_60 | 60 | 0.006 | 6000000000000 | t + row_61 | 61 | 0.0061 | 6100000000000 | f + row_62 | 62 | 0.0062 | 6200000000000 | t + row_63 | 63 | 0.0063 | 6300000000000 | f + row_64 | 64 | 0.0064 | 6400000000000 | t + row_65 | 65 | 0.0065 | 6500000000000 | f + row_66 | 66 | 0.0066 | 6600000000000 | t + row_67 | 67 | 0.0067 | 6700000000000 | f + row_68 | 68 | 0.0068 | 6800000000000 | t + row_69 | 69 | 0.0069 | 6900000000000 | f + row_7 | 7 | 0.0007 | 700000000000 | f + row_70 | 70 | 0.007 | 7000000000000 | t + row_71 | 71 | 0.0071 | 7100000000000 | f + row_72 | 72 | 0.0072 | 7200000000000 | t + row_73 | 73 | 0.0073 | 7300000000000 | f + row_74 | 74 | 0.0074 | 7400000000000 | t + row_75 | 75 | 0.0075 | 7500000000000 | f + row_76 | 76 | 0.0076 | 7600000000000 | t + row_77 | 77 | 0.0077 | 7700000000000 | f + row_78 | 78 | 0.0078 | 7800000000000 | t + row_79 | 79 | 0.0079 | 7900000000000 | f + row_8 | 8 | 0.0008 | 800000000000 | t + row_80 | 80 | 0.008 | 8000000000000 | t + row_81 | 81 | 0.0081 | 8100000000000 | f + row_82 | 82 | 0.0082 | 8200000000000 | t + row_83 | 83 | 0.0083 | 8300000000000 | f + row_84 | 84 | 0.0084 | 8400000000000 | t + row_85 | 85 | 0.0085 | 8500000000000 | f + row_86 | 86 | 0.0086 | 8600000000000 | t + row_87 | 87 | 0.0087 | 8700000000000 | f + row_88 | 88 | 0.0088 | 8800000000000 | t + row_89 | 89 | 0.0089 | 8900000000000 | f + row_9 | 9 | 0.0009 | 900000000000 | f + row_90 | 90 | 0.009 | 9000000000000 | t + row_91 | 91 | 0.0091 | 9100000000000 | f + row_92 | 92 | 0.0092 | 9200000000000 | t + row_93 | 93 | 0.0093 | 9300000000000 | f + row_94 | 94 | 0.0094 | 9400000000000 | t + row_95 | 95 | 0.0095 | 9500000000000 | f + row_96 | 96 | 0.0096 | 9600000000000 | t + row_97 | 97 | 0.0097 | 9700000000000 | f + row_98 | 98 | 0.0098 | 9800000000000 | t + row_99 | 99 | 0.0099 | 9900000000000 | f +(100 rows) + +-- @description query02 for PXF test on small data +SELECT name, num FROM hive_smoke_test_external_table WHERE num > 50 ORDER BY name; + name | num +---------+----- + row_100 | 100 + row_51 | 51 + row_52 | 52 + row_53 | 53 + row_54 | 54 + row_55 | 55 + row_56 | 56 + row_57 | 57 + row_58 | 58 + row_59 | 59 + row_60 | 60 + row_61 | 61 + row_62 | 62 + row_63 | 63 + row_64 | 64 + row_65 | 65 + row_66 | 66 + row_67 | 67 + row_68 | 68 + row_69 | 69 + row_70 | 70 + row_71 | 71 + row_72 | 72 + row_73 | 73 + row_74 | 74 + row_75 | 75 + row_76 | 76 + row_77 | 77 + row_78 | 78 + row_79 | 79 + row_80 | 80 + row_81 | 81 + row_82 | 82 + row_83 | 83 + row_84 | 84 + row_85 | 85 + row_86 | 86 + row_87 | 87 + row_88 | 88 + row_89 | 89 + row_90 | 90 + row_91 | 91 + row_92 | 92 + row_93 | 93 + row_94 | 94 + row_95 | 95 + row_96 | 96 + row_97 | 97 + row_98 | 98 + row_99 | 99 +(50 rows) + +{{ CLEAN_UP }}-- clean up Hive and local disk +{{ CLEAN_UP }}\!rm -rf {{ TEST_LOCATION }} +{{ CLEAN_UP }}\!{{ BEELINE_CMD }} -f {{ SCRIPT cleanup_hive_smoke_test.sql }} +{{ CLEAN_UP }}beeline> !connect 'jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }}' "" "" "" +{{ CLEAN_UP }}Connecting to jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }} +{{ CLEAN_UP }}Connected to: Apache Hive +{{ CLEAN_UP }}Driver: Hive JDBC +{{ CLEAN_UP }}Transaction isolation: TRANSACTION_REPEATABLE_READ +{{ CLEAN_UP }}jdbc:hive2> DROP DATABASE hive_smoke_test_database_{{ FULL_TESTNAME }} CASCADE; +{{ CLEAN_UP }}jdbc:hive2> +{{ CLEAN_UP }}jdbc:hive2> Closing: 0: jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }} +{{ CLEAN_UP }}\!rm -rf {{ SCRIPT cleanup_hive_smoke_test.sql }} {{ SCRIPT load_small_data.sql }} {{ SCRIPT create_hive_smoke_test_database.sql }} +{{ CLEAN_UP }}{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} rm -rf {{ TEST_LOCATION }} diff --git a/regression/expected/MultiBlockDataSmokeTest.out b/regression/expected/MultiBlockDataSmokeTest.out new file mode 100644 index 0000000000..3e10f06d64 --- /dev/null +++ b/regression/expected/MultiBlockDataSmokeTest.out @@ -0,0 +1,66 @@ +-- Create writable table to insert data into HCFS +CREATE WRITABLE EXTERNAL TABLE multi_block_data_smoke_test_writable_external_table ( + t1 TEXT, + a1 INTEGER + ) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}?PROFILE={{ HCFS_PROTOCOL }}:csv{{ SERVER_PARAM }}') + FORMAT 'CSV' (DELIMITER ',') + DISTRIBUTED BY (t1); +-- write to writable table +INSERT INTO multi_block_data_smoke_test_writable_external_table + SELECT format('t%s', i::varchar(255)), i + from generate_series(1, 32000000) s(i); +-- Verify data entered HCFS correctly +\!{{ HCFS_CMD }} dfs -cat '{{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/*_0' 2>/dev/null | head -1 +t1,1 +-- External Table test +CREATE EXTERNAL TABLE multi_block_data_smoke_test_external_table ( + t1 TEXT, + a1 INTEGER + ) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}?PROFILE={{ HCFS_PROTOCOL }}:csv{{ SERVER_PARAM }}') + FORMAT 'CSV' (DELIMITER ','); +-- @description query01 for PXF test on Multi Blocked data +SELECT count(*) FROM multi_block_data_smoke_test_external_table; + count +---------- + 32000000 +(1 row) + +-- @description query02 for PXF test on Multi Blocked data +SELECT sum(a1) FROM multi_block_data_smoke_test_external_table; + sum +----------------- + 512000016000000 +(1 row) + +-- @description query03 for PXF test on Multi Blocked data +SELECT t1, a1 FROM multi_block_data_smoke_test_external_table ORDER BY t1 LIMIT 10; + t1 | a1 +-----------+---------- + t1 | 1 + t10 | 10 + t100 | 100 + t1000 | 1000 + t10000 | 10000 + t100000 | 100000 + t1000000 | 1000000 + t10000000 | 10000000 + t10000001 | 10000001 + t10000002 | 10000002 +(10 rows) + +-- @description query04 for PXF test on Multi Blocked data +SELECT cnt < 32000000 AS check FROM ( + SELECT COUNT(*) AS cnt + FROM multi_block_data_smoke_test_external_table + WHERE gp_segment_id = 0 + ) AS a; + check +------- + t +(1 row) + +{{ CLEAN_UP }}-- clean up HCFS +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r -f {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}Deleted {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} diff --git a/regression/expected/WritableSmokeTest.out b/regression/expected/WritableSmokeTest.out new file mode 100644 index 0000000000..5ec2c24f84 --- /dev/null +++ b/regression/expected/WritableSmokeTest.out @@ -0,0 +1,185 @@ +-- create writable external table +CREATE WRITABLE EXTERNAL TABLE writable_smoke_test_external_writable_table + (name TEXT, num INTEGER, dub DOUBLE PRECISION, longNum BIGINT, bool BOOLEAN) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_et?PROFILE={{ HCFS_PROTOCOL }}:text{{ SERVER_PARAM }}') + FORMAT 'TEXT' (DELIMITER '|') + DISTRIBUTED BY (num); +-- write to writable table +INSERT INTO writable_smoke_test_external_writable_table + SELECT format('row_%s',i::varchar(255)), + i, + i+0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true'::boolean ELSE 'false'::boolean END + from generate_series(1, 100) s(i); +-- Verify data entered HCFS correctly +\!{{ HCFS_CMD }} dfs -cat '{{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_et/*_0' 2>/dev/null | head -1 +row_2|2|2.0001|200000000000|t +-- External Table test +CREATE EXTERNAL TABLE writable_smoke_test_external_readable_table + (name TEXT, num INTEGER, dub DOUBLE PRECISION, longNum BIGINT, bool BOOLEAN) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_et?PROFILE={{ HCFS_PROTOCOL }}:text{{ SERVER_PARAM }}') + FORMAT 'CSV' (DELIMITER '|'); +SELECT * FROM writable_smoke_test_external_readable_table ORDER BY name; + name | num | dub | longnum | bool +---------+-----+----------+----------------+------ + row_1 | 1 | 1.0001 | 100000000000 | f + row_10 | 10 | 10.0001 | 1000000000000 | t + row_100 | 100 | 100.0001 | 10000000000000 | t + row_11 | 11 | 11.0001 | 1100000000000 | f + row_12 | 12 | 12.0001 | 1200000000000 | t + row_13 | 13 | 13.0001 | 1300000000000 | f + row_14 | 14 | 14.0001 | 1400000000000 | t + row_15 | 15 | 15.0001 | 1500000000000 | f + row_16 | 16 | 16.0001 | 1600000000000 | t + row_17 | 17 | 17.0001 | 1700000000000 | f + row_18 | 18 | 18.0001 | 1800000000000 | t + row_19 | 19 | 19.0001 | 1900000000000 | f + row_2 | 2 | 2.0001 | 200000000000 | t + row_20 | 20 | 20.0001 | 2000000000000 | t + row_21 | 21 | 21.0001 | 2100000000000 | f + row_22 | 22 | 22.0001 | 2200000000000 | t + row_23 | 23 | 23.0001 | 2300000000000 | f + row_24 | 24 | 24.0001 | 2400000000000 | t + row_25 | 25 | 25.0001 | 2500000000000 | f + row_26 | 26 | 26.0001 | 2600000000000 | t + row_27 | 27 | 27.0001 | 2700000000000 | f + row_28 | 28 | 28.0001 | 2800000000000 | t + row_29 | 29 | 29.0001 | 2900000000000 | f + row_3 | 3 | 3.0001 | 300000000000 | f + row_30 | 30 | 30.0001 | 3000000000000 | t + row_31 | 31 | 31.0001 | 3100000000000 | f + row_32 | 32 | 32.0001 | 3200000000000 | t + row_33 | 33 | 33.0001 | 3300000000000 | f + row_34 | 34 | 34.0001 | 3400000000000 | t + row_35 | 35 | 35.0001 | 3500000000000 | f + row_36 | 36 | 36.0001 | 3600000000000 | t + row_37 | 37 | 37.0001 | 3700000000000 | f + row_38 | 38 | 38.0001 | 3800000000000 | t + row_39 | 39 | 39.0001 | 3900000000000 | f + row_4 | 4 | 4.0001 | 400000000000 | t + row_40 | 40 | 40.0001 | 4000000000000 | t + row_41 | 41 | 41.0001 | 4100000000000 | f + row_42 | 42 | 42.0001 | 4200000000000 | t + row_43 | 43 | 43.0001 | 4300000000000 | f + row_44 | 44 | 44.0001 | 4400000000000 | t + row_45 | 45 | 45.0001 | 4500000000000 | f + row_46 | 46 | 46.0001 | 4600000000000 | t + row_47 | 47 | 47.0001 | 4700000000000 | f + row_48 | 48 | 48.0001 | 4800000000000 | t + row_49 | 49 | 49.0001 | 4900000000000 | f + row_5 | 5 | 5.0001 | 500000000000 | f + row_50 | 50 | 50.0001 | 5000000000000 | t + row_51 | 51 | 51.0001 | 5100000000000 | f + row_52 | 52 | 52.0001 | 5200000000000 | t + row_53 | 53 | 53.0001 | 5300000000000 | f + row_54 | 54 | 54.0001 | 5400000000000 | t + row_55 | 55 | 55.0001 | 5500000000000 | f + row_56 | 56 | 56.0001 | 5600000000000 | t + row_57 | 57 | 57.0001 | 5700000000000 | f + row_58 | 58 | 58.0001 | 5800000000000 | t + row_59 | 59 | 59.0001 | 5900000000000 | f + row_6 | 6 | 6.0001 | 600000000000 | t + row_60 | 60 | 60.0001 | 6000000000000 | t + row_61 | 61 | 61.0001 | 6100000000000 | f + row_62 | 62 | 62.0001 | 6200000000000 | t + row_63 | 63 | 63.0001 | 6300000000000 | f + row_64 | 64 | 64.0001 | 6400000000000 | t + row_65 | 65 | 65.0001 | 6500000000000 | f + row_66 | 66 | 66.0001 | 6600000000000 | t + row_67 | 67 | 67.0001 | 6700000000000 | f + row_68 | 68 | 68.0001 | 6800000000000 | t + row_69 | 69 | 69.0001 | 6900000000000 | f + row_7 | 7 | 7.0001 | 700000000000 | f + row_70 | 70 | 70.0001 | 7000000000000 | t + row_71 | 71 | 71.0001 | 7100000000000 | f + row_72 | 72 | 72.0001 | 7200000000000 | t + row_73 | 73 | 73.0001 | 7300000000000 | f + row_74 | 74 | 74.0001 | 7400000000000 | t + row_75 | 75 | 75.0001 | 7500000000000 | f + row_76 | 76 | 76.0001 | 7600000000000 | t + row_77 | 77 | 77.0001 | 7700000000000 | f + row_78 | 78 | 78.0001 | 7800000000000 | t + row_79 | 79 | 79.0001 | 7900000000000 | f + row_8 | 8 | 8.0001 | 800000000000 | t + row_80 | 80 | 80.0001 | 8000000000000 | t + row_81 | 81 | 81.0001 | 8100000000000 | f + row_82 | 82 | 82.0001 | 8200000000000 | t + row_83 | 83 | 83.0001 | 8300000000000 | f + row_84 | 84 | 84.0001 | 8400000000000 | t + row_85 | 85 | 85.0001 | 8500000000000 | f + row_86 | 86 | 86.0001 | 8600000000000 | t + row_87 | 87 | 87.0001 | 8700000000000 | f + row_88 | 88 | 88.0001 | 8800000000000 | t + row_89 | 89 | 89.0001 | 8900000000000 | f + row_9 | 9 | 9.0001 | 900000000000 | f + row_90 | 90 | 90.0001 | 9000000000000 | t + row_91 | 91 | 91.0001 | 9100000000000 | f + row_92 | 92 | 92.0001 | 9200000000000 | t + row_93 | 93 | 93.0001 | 9300000000000 | f + row_94 | 94 | 94.0001 | 9400000000000 | t + row_95 | 95 | 95.0001 | 9500000000000 | f + row_96 | 96 | 96.0001 | 9600000000000 | t + row_97 | 97 | 97.0001 | 9700000000000 | f + row_98 | 98 | 98.0001 | 9800000000000 | t + row_99 | 99 | 99.0001 | 9900000000000 | f +(100 rows) + +SELECT name, num FROM writable_smoke_test_external_readable_table WHERE num > 50 ORDER BY name; + name | num +---------+----- + row_100 | 100 + row_51 | 51 + row_52 | 52 + row_53 | 53 + row_54 | 54 + row_55 | 55 + row_56 | 56 + row_57 | 57 + row_58 | 58 + row_59 | 59 + row_60 | 60 + row_61 | 61 + row_62 | 62 + row_63 | 63 + row_64 | 64 + row_65 | 65 + row_66 | 66 + row_67 | 67 + row_68 | 68 + row_69 | 69 + row_70 | 70 + row_71 | 71 + row_72 | 72 + row_73 | 73 + row_74 | 74 + row_75 | 75 + row_76 | 76 + row_77 | 77 + row_78 | 78 + row_79 | 79 + row_80 | 80 + row_81 | 81 + row_82 | 82 + row_83 | 83 + row_84 | 84 + row_85 | 85 + row_86 | 86 + row_87 | 87 + row_88 | 88 + row_89 | 89 + row_90 | 90 + row_91 | 91 + row_92 | 92 + row_93 | 93 + row_94 | 94 + row_95 | 95 + row_96 | 96 + row_97 | 97 + row_98 | 98 + row_99 | 99 +(50 rows) + +{{ CLEAN_UP }}-- clean up HCFS +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}Deleted {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} diff --git a/regression/init_file b/regression/init_file new file mode 100644 index 0000000000..38fe86b5fa --- /dev/null +++ b/regression/init_file @@ -0,0 +1,46 @@ +-- start_matchignore +m/\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} WARN \w+\.\w+: .*$/ +m/^Deleted \/tmp\/pxf_automation_data\/\w+$/ +m/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} WARN \[main\] util\.NativeCodeLoader: Unable to load native-hadoop library for your platform\.\.\. using builtin-java classes where applicable$/ +m/^Picked up JAVA_TOOL_OPTIONS: -Dfile\.encoding=UTF8$/ +m/^SLF4J: Class path contains multiple SLF4J bindings\.$/ +m/^SLF4J: Found binding in \[jar:file:.*\.class\]$/ +m/^SLF4J: See http:\/\/www\.slf4j\.org\/codes\.html#multiple_bindings for an explanation\.$/ +m/^SLF4J: Actual binding is of type \[org\.slf4j\.impl\.Log4jLoggerFactory\]$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO Configuration\.deprecation: io\.bytes\.per\.checksum is deprecated\. Instead, use dfs\.bytes-per-checksum$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO gcs\.GoogleHadoopFileSystemBase: GHFS version: \d+\.\d+\.\d+-hadoop\d$/ +m/\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} WARN gcs\.GoogleHadoopFileSystemBase: No working directory configured, using default: 'gs:\/\/data-gpdb-ud-tpch\/'$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO impl\.MetricsConfig: loaded properties from hadoop-metrics2\.properties$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO impl\.MetricsSystemImpl: Scheduled snapshot period at \d+ second\(s\)\.$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO impl\.MetricsSystemImpl: azure-file-system metrics system started$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO azure\.AzureFileSystemThreadPoolExecutor: Time taken for Delete operation is: \d+ ms with threads: \d+$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO impl\.MetricsSystemImpl: Stopping azure-file-system metrics system\.\.\.$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO impl\.MetricsSystemImpl: azure-file-system metrics system stopped\.$/ +m/^\d{2}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} INFO impl\.MetricsSystemImpl: azure-file-system metrics system shutdown complete\.$/ +m/^No rows affected \(\d+.\d+ seconds\)$/ +m/^\[INFO\] Unable to bind key for unsupported operation: complete-into-braces$/ +m/^log4j:WARN No appenders could be found for logger \(org\.apache\.hive\.jdbc\.Utils\)\.$/ +m/^log4j:WARN Please initialize the log4j system properly\.$/ +m/^log4j:WARN See http:\/\/logging\.apache\.org\/log4j\/\d+\.\d+\/faq\.html#noconfig for more info\.$/ +m/^ls: .*\/hive\/lib\/hive-jdbc-\*-standalone\.jar: No such file or directory$/ +m/^INFO : Loading data to table .*$/ +m/^INFO : Table [^[:space:]]+ stats: \[numFiles=\d+, numRows=\d, totalSize=\d+, rawDataSize=\d+\]$/ +m/^$/ +-- end_matchignore + +-- start_matchsubs +m/^Connected to: Apache Hive \(version .*\)$/ +s/ *\(version.*$// +m/^Driver: Hive JDBC \(version .*\)$/ +s/ *\(version.*$// +m/^\d+ row\(s\) in \d+\.\d{4} seconds/ +s/\d+\.\d{4}/-.----/ +m/^0: jdbc:hive2:\/\/[^[:space:]]+> +/ +s/^0: jdbc:hive2:\/\/[^[:space:]]+> +/jdbc:hive2> / +m/^(\.[[:space:]])+[[:space:].]?> +/ +s/^(\.[[:space:]])+[[:space:].]?> +/jdbc:hive2> / +m/^Closing/ +s/^/jdbc:hive2> / +m/ \r/ +s/ \r//g +-- end_matchsubs diff --git a/regression/schedules/fdw_gpdb_schedule b/regression/schedules/fdw_gpdb_schedule new file mode 100644 index 0000000000..d5d75116f8 --- /dev/null +++ b/regression/schedules/fdw_gpdb_schedule @@ -0,0 +1,3 @@ +# put an underscore in front of testname +# after search and replace, that will be the test name +test: _FDW_HdfsSmokeTest _FDW_HiveSmokeTest diff --git a/regression/schedules/fdw_hcfs_schedule b/regression/schedules/fdw_hcfs_schedule new file mode 100644 index 0000000000..2bb33e1d6a --- /dev/null +++ b/regression/schedules/fdw_hcfs_schedule @@ -0,0 +1,3 @@ +# put an underscore in front of testname +# after search and replace, that will be the test name +test: _FDW_HdfsSmokeTest _FDW_WritableSmokeTest _FDW_MultiBlockDataSmokeTest diff --git a/regression/schedules/fdw_security_schedule b/regression/schedules/fdw_security_schedule new file mode 100644 index 0000000000..d5d75116f8 --- /dev/null +++ b/regression/schedules/fdw_security_schedule @@ -0,0 +1,3 @@ +# put an underscore in front of testname +# after search and replace, that will be the test name +test: _FDW_HdfsSmokeTest _FDW_HiveSmokeTest diff --git a/regression/schedules/fdw_smoke_schedule b/regression/schedules/fdw_smoke_schedule new file mode 100644 index 0000000000..4cc7f478d8 --- /dev/null +++ b/regression/schedules/fdw_smoke_schedule @@ -0,0 +1,3 @@ +# put an underscore in front of testname +# after search and replace, that will be the test name +test: _FDW_HdfsSmokeTest _FDW_WritableSmokeTest _FDW_HBaseSmokeTest _FDW_HiveSmokeTest _FDW_MultiBlockDataSmokeTest diff --git a/regression/schedules/gpdb_schedule b/regression/schedules/gpdb_schedule new file mode 100644 index 0000000000..0dfbde8787 --- /dev/null +++ b/regression/schedules/gpdb_schedule @@ -0,0 +1,3 @@ +# put an underscore in front of testname +# after search and replace, that will be the test name +test: _HdfsSmokeTest _HiveSmokeTest diff --git a/regression/schedules/hcfs_schedule b/regression/schedules/hcfs_schedule new file mode 100644 index 0000000000..d8a6a1a395 --- /dev/null +++ b/regression/schedules/hcfs_schedule @@ -0,0 +1,3 @@ +# put an underscore in front of testname +# after search and replace, that will be the test name +test: _HdfsSmokeTest _WritableSmokeTest _MultiBlockDataSmokeTest diff --git a/regression/schedules/security_schedule b/regression/schedules/security_schedule new file mode 100644 index 0000000000..0dfbde8787 --- /dev/null +++ b/regression/schedules/security_schedule @@ -0,0 +1,3 @@ +# put an underscore in front of testname +# after search and replace, that will be the test name +test: _HdfsSmokeTest _HiveSmokeTest diff --git a/regression/schedules/smoke_schedule b/regression/schedules/smoke_schedule new file mode 100644 index 0000000000..e8756315f7 --- /dev/null +++ b/regression/schedules/smoke_schedule @@ -0,0 +1,3 @@ +# put an underscore in front of testname +# after search and replace, that will be the test name +test: _HdfsSmokeTest _WritableSmokeTest _HBaseSmokeTest _HiveSmokeTest _MultiBlockDataSmokeTest diff --git a/regression/scripts/cleanup_hcfs.bash b/regression/scripts/cleanup_hcfs.bash new file mode 100644 index 0000000000..bd1277f90a --- /dev/null +++ b/regression/scripts/cleanup_hcfs.bash @@ -0,0 +1,3 @@ +#!/bin/bash + +{{HCFS_CMD}} dfs -rm -r -f {{HCFS_SCHEME}}{{HCFS_BUCKET}}{{HCFS_LOCATION}} diff --git a/regression/scripts/hbase/create_pxflookup.rb b/regression/scripts/hbase/create_pxflookup.rb new file mode 100644 index 0000000000..3ffcb9b99f --- /dev/null +++ b/regression/scripts/hbase/create_pxflookup.rb @@ -0,0 +1 @@ +create 'pxflookup', 'mapping' diff --git a/regression/scripts/hbase/drop_small_data.rb b/regression/scripts/hbase/drop_small_data.rb new file mode 100644 index 0000000000..a37991be33 --- /dev/null +++ b/regression/scripts/hbase/drop_small_data.rb @@ -0,0 +1,4 @@ +disable 'hbase_small_data_table_{{ FULL_TESTNAME }}' +drop 'hbase_small_data_table_{{ FULL_TESTNAME }}' + +exit diff --git a/regression/scripts/hbase/gen_small_data.rb b/regression/scripts/hbase/gen_small_data.rb new file mode 100644 index 0000000000..7e70e2ac9b --- /dev/null +++ b/regression/scripts/hbase/gen_small_data.rb @@ -0,0 +1,18 @@ +t = create 'hbase_small_data_table_{{ FULL_TESTNAME }}', 'col' + +(1..100).each { |i| + row_name = "row_#{i}" + t.put row_name, 'col:name', row_name + t.put row_name, 'col:number', "#{i}" + t.put row_name, 'col:doub', "#{1.001 * i}" + t.put row_name, 'col:longnum', "#{i * 100000000000}" + t.put row_name, 'col:bool', "#{i % 2 == 0}" +} + +put 'pxflookup', 'hbase_small_data_table_{{ FULL_TESTNAME }}', 'mapping:name', 'col:name' +put 'pxflookup', 'hbase_small_data_table_{{ FULL_TESTNAME }}', 'mapping:num', 'col:number' +put 'pxflookup', 'hbase_small_data_table_{{ FULL_TESTNAME }}', 'mapping:dub', 'col:doub' +put 'pxflookup', 'hbase_small_data_table_{{ FULL_TESTNAME }}', 'mapping:longnum', 'col:longnum' +put 'pxflookup', 'hbase_small_data_table_{{ FULL_TESTNAME }}', 'mapping:bool', 'col:bool' + +exit diff --git a/regression/scripts/hive/cleanup_hive_smoke_test.sql b/regression/scripts/hive/cleanup_hive_smoke_test.sql new file mode 100644 index 0000000000..7aa478f44c --- /dev/null +++ b/regression/scripts/hive/cleanup_hive_smoke_test.sql @@ -0,0 +1,2 @@ +!connect 'jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }}' "" "" "" +DROP DATABASE hive_smoke_test_database_{{ FULL_TESTNAME }} CASCADE; diff --git a/regression/scripts/hive/create_hive_smoke_test_database.sql b/regression/scripts/hive/create_hive_smoke_test_database.sql new file mode 100644 index 0000000000..232e5b7f88 --- /dev/null +++ b/regression/scripts/hive/create_hive_smoke_test_database.sql @@ -0,0 +1 @@ +CREATE DATABASE hive_smoke_test_database_{{ FULL_TESTNAME }}; diff --git a/regression/scripts/hive/load_small_data.sql b/regression/scripts/hive/load_small_data.sql new file mode 100644 index 0000000000..7c857bc4d2 --- /dev/null +++ b/regression/scripts/hive/load_small_data.sql @@ -0,0 +1,11 @@ +CREATE TABLE hive_small_data_table_{{ FULL_TESTNAME }} ( + s1 string, + n1 int, + d1 double, + bg bigint, + b boolean + ) + ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' + STORED AS textfile; +LOAD DATA LOCAL INPATH '{{ TEST_LOCATION }}/data.csv' + INTO TABLE hive_small_data_table_{{ FULL_TESTNAME }}; diff --git a/regression/scripts/substitute.bash b/regression/scripts/substitute.bash new file mode 100755 index 0000000000..bdebf6bfe0 --- /dev/null +++ b/regression/scripts/substitute.bash @@ -0,0 +1,142 @@ +#!/usr/bin/env bash + +set -eo pipefail + +WORKING_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd ) + +_die() { + local rc=$1 + shift + echo "$*" + exit "$rc" +} + +_process_scripts() { + local script{,s} script_path + mapfile -t scripts < <(grep -o '{{[[:space:]]*SCRIPT[[:space:]][^[:space:]]*[[:space:]]*}}' "sql/${testname}.sql" | awk '{print $3}' | sort | uniq) + (( ${#scripts[@]} == 0 )) && return + for script in "${scripts[@]}"; do + script_path=$(find scripts -iname "${script}") + [[ -z ${script_path} ]] && _die 2 "Couldn't find script file '${script}'" + SED_ARGS+=(-e "s|{{[[:space:]]*SCRIPT[[:space:]]*${script//./\\.}[[:space:]]*}}|${WORKING_DIR}/scripts/generated/_${FULL_TESTNAME}_${script}|g") + sed "${SED_ARGS[@]}" "${script_path}" >"scripts/generated/_${FULL_TESTNAME}_${script}" + done +} + +_host_is_local() { + local hosts host_regex hostname=${1} + [[ -z ${hostname} ]] && return 0 # empty host, then we are local + read -ra hosts <<< "$(grep < /etc/hosts -v '^#.*' | grep -E '(127.0.0.1|::1)' | tr '\n' ' ')" + host_regex=$({ for h in "${hosts[@]}"; do echo "$h"; done } | sort | uniq | tr '\n' '|') + host_regex="(${host_regex%|})" + [[ $hostname =~ $host_regex ]] +} + +case ${HCFS_PROTOCOL} in + adl|ADL) + HCFS_SCHEME=adl:// + SERVER_CONFIG=${SERVER_CONFIG:-adl} + HCFS_PROTOCOL=adl + ;; + gs|gcs|GS|GCS) + HCFS_SCHEME=gs:// + SERVER_CONFIG=${SERVER_CONFIG:-gs} + HCFS_PROTOCOL=gs + ;; + minio|MINIO) + HCFS_SCHEME=s3a:// + SERVER_CONFIG=${SERVER_CONFIG:-minio} + HCFS_PROTOCOL=s3 # there's no minio protocol + ;; + s3a|S3A|s3|S3) + HCFS_SCHEME=s3a:// + SERVER_CONFIG=${SERVER_CONFIG:-s3} + HCFS_PROTOCOL=s3 + ;; + wasbs|WASBS) + HCFS_SCHEME=wasbs:// + SERVER_CONFIG=${SERVER_CONFIG:-wasbs} + HCFS_PROTOCOL=wasbs + ;; + *) # regular HDFS + HCFS_PROTOCOL=hdfs + SERVER_CONFIG=${SERVER_CONFIG:-default} + unset HCFS_SERVER HCFS_BUCKET HCFS_SCHEME + ;; +esac + +# server string for DDL, only needed when not default +if [[ ${SERVER_CONFIG} != default ]]; then + SERVER_PARAM="\&SERVER=${SERVER_CONFIG}" +fi + +HIVE_HOST=${HIVE_HOST:-localhost} +HIVE_PRINCIPAL=${HIVE_PRINCIPAL:+";principal=${HIVE_PRINCIPAL}"} + +SED_ARGS=( + -e "s|{{[[:space:]]*PGHOST[[:space:]]*}}|${PGHOST}|g" + -e "s|{{[[:space:]]*HCFS_BUCKET[[:space:]]*}}|${HCFS_BUCKET}|g" + -e "s|{{[[:space:]]*HCFS_CMD[[:space:]]*}}|${HCFS_CMD}|g" + -e "s|{{[[:space:]]*SERVER_CONFIG[[:space:]]*}}|${SERVER_CONFIG}|g" + -e "s|{{[[:space:]]*HCFS_PROTOCOL[[:space:]]*}}|${HCFS_PROTOCOL}|g" + -e "s|{{[[:space:]]*HCFS_SCHEME[[:space:]]*}}|${HCFS_SCHEME}|g" + -e "s|{{[[:space:]]*SERVER_PARAM[[:space:]]*}}|${SERVER_PARAM}|g" + -e "s|{{[[:space:]]*PXF_CONF[[:space:]]*}}|${PXF_CONF}|g" + -e "s|{{[[:space:]]*HBASE_CMD[[:space:]]*}}|${HBASE_CMD}|g" + -e "s|{{[[:space:]]*BEELINE_CMD[[:space:]]*}}|${BEELINE_CMD}|g" + -e "s|{{[[:space:]]*HIVE_HOST[[:space:]]*}}|${HIVE_HOST}|g" + -e "s|{{[[:space:]]*HIVE_PRINCIPAL[[:space:]]*}}|${HIVE_PRINCIPAL}|g" +) + +# delete the cleanup steps if we have debug on +if [[ $1 == --debug ]]; then + SED_ARGS+=(-e '/{{[[:space:]]*CLEAN_UP[[:space:]]*}}/d') + shift +else + SED_ARGS+=(-e 's|{{[[:space:]]*CLEAN_UP[[:space:]]*}}||g') +fi + +if _host_is_local "${HIVE_HOST}"; then + # if hive is local delete whole line + SED_ARGS+=(-e '/{{[[:space:]]*HIVE_REMOTE[[:space:]]*}}/d') +else + # otherwise delete the flag + SED_ARGS+=(-e 's|{{[[:space:]]*HIVE_REMOTE[[:space:]]*}}||g') +fi + +if _host_is_local "${PGHOST}"; then + # if GPDB is local delete whole line + SED_ARGS+=(-e '/{{[[:space:]]*GPDB_REMOTE[[:space:]]*}}/d') +else + # otherwise delete the flag + SED_ARGS+=(-e 's|{{[[:space:]]*GPDB_REMOTE[[:space:]]*}}||g') +fi + +tests=( "$@" ) +if [[ $1 =~ ^schedules/.*_schedule ]]; then + # get list of tests from schedule file, there may be many lines, many on each line + read -ra tests <<< "$(grep '^test:' "$1" | sed -e 's/^test: *//' -e 's/#.*$//' | tr '\n' ' ')" +fi + +num_args=${#SED_ARGS[@]} +for testname in "${tests[@]#_}"; do # remove leading underscore from list + date=$(date '+%Y_%m_%d_%H_%M_%S') + uuid=$(uuidgen | tr - _) + FULL_TESTNAME=${testname}_${date}_${uuid} + TEST_LOCATION=/tmp/pxf_automation_data/${testname}/${date}_${uuid} + SED_ARGS+=( + -e "s|{{[[:space:]]*TEST_LOCATION[[:space:]]*}}|${TEST_LOCATION}|g" + -e "s|{{[[:space:]]*FULL_TESTNAME[[:space:]]*}}|${FULL_TESTNAME}|g" + ) + _process_scripts + sed "${SED_ARGS[@]}" "sql/${testname}.sql" >"sql/_${testname}.sql" + sed "${SED_ARGS[@]}" "expected/${testname}.out" >"expected/_${testname}.out" + # generate HCFS cleanup script for make clean target + if grep '{{[[:space:]]*HCFS_CMD[[:space:]]*}}' "sql/${testname}.sql" >/dev/null; then + : "${HCFS_CMD:?HCFS_CMD must be set}" + sed "${SED_ARGS[@]}" scripts/cleanup_hcfs.bash >"scripts/_${FULL_TESTNAME}_cleanup_hcfs.bash" + chmod +x "scripts/_${FULL_TESTNAME}_cleanup_hcfs.bash" + fi + # remove the last two args we added, they should not be re-used + SED_ARGS=( "${SED_ARGS[@]:0:${num_args}}" ) +done diff --git a/regression/sql/FDW_HBaseSmokeTest.sql b/regression/sql/FDW_HBaseSmokeTest.sql new file mode 100644 index 0000000000..a7fdcfcb72 --- /dev/null +++ b/regression/sql/FDW_HBaseSmokeTest.sql @@ -0,0 +1,25 @@ +-- Create Hbase tables hbase_table and pxflookup +\!{{ HBASE_CMD }} shell {{ SCRIPT create_pxflookup.rb }} >/dev/null 2>&1 +\!{{ HBASE_CMD }} shell {{ SCRIPT gen_small_data.rb }} + +-- FDW test +CREATE SERVER h_base_smoke_test_server + FOREIGN DATA WRAPPER hbase_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER + SERVER h_base_smoke_test_server; +CREATE FOREIGN TABLE h_base_smoke_test_foreign_table ( + name text, + num int, + dub double precision, + longnum bigint, + bool boolean + ) + SERVER h_base_smoke_test_server OPTIONS (resource 'hbase_small_data_table_{{ FULL_TESTNAME }}'); + +SELECT * FROM h_base_smoke_test_foreign_table ORDER BY name; +SELECT name, num FROM h_base_smoke_test_foreign_table WHERE num > 50 ORDER BY name; + +-- clean up HBase +{{ CLEAN_UP }}\!{{ HBASE_CMD }} shell {{ SCRIPT drop_small_data.rb }} >/dev/null 2>&1 +{{ CLEAN_UP }}\!rm -rf {{ SCRIPT drop_small_data.rb }} {{ SCRIPT gen_small_data.rb }} {{ SCRIPT create_pxflookup.rb }} diff --git a/regression/sql/FDW_HdfsSmokeTest.sql b/regression/sql/FDW_HdfsSmokeTest.sql new file mode 100644 index 0000000000..2745581201 --- /dev/null +++ b/regression/sql/FDW_HdfsSmokeTest.sql @@ -0,0 +1,37 @@ +-- data prep +{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} mkdir -p {{ TEST_LOCATION }} +\!mkdir -p {{ TEST_LOCATION }} +COPY ( + SELECT format('row_%s',i::varchar(255)), + i, + i+0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true' ELSE 'false' END + from generate_series(1, 100) s(i) + ) TO '{{ TEST_LOCATION }}/data.csv' + WITH (FORMAT 'csv'); +{{ GPDB_REMOTE }}-- if GPDB is remote, will need to scp file down from there for beeline +{{ GPDB_REMOTE }}\!scp {{ PGHOST }}:{{ TEST_LOCATION }}/data.csv {{ TEST_LOCATION }} +\!{{ HCFS_CMD }} dfs -mkdir -p '{{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}' +\!{{ HCFS_CMD }} dfs -copyFromLocal '{{ TEST_LOCATION }}/data.csv' '{{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}' + +-- FDW test +CREATE SERVER hdfs_smoke_test_hdfs_server + FOREIGN DATA WRAPPER {{ HCFS_PROTOCOL }}_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER SERVER hdfs_smoke_test_hdfs_server; +CREATE FOREIGN TABLE hdfs_smoke_test_foreign_table ( + name TEXT, + num INTEGER, + dub DOUBLE PRECISION, + longNum BIGINT, + bool BOOLEAN + ) SERVER hdfs_smoke_test_hdfs_server + OPTIONS (resource '{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/data.csv', format 'csv'); +SELECT * FROM hdfs_smoke_test_foreign_table ORDER BY name; +SELECT name, num FROM hdfs_smoke_test_foreign_table WHERE num > 50 ORDER BY name; + +{{ CLEAN_UP }}-- clean up HCFS and local disk +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r -f {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}\!rm -rf {{ TEST_LOCATION }} +{{ CLEAN_UP }}{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} rm -rf {{ TEST_LOCATION }} diff --git a/regression/sql/FDW_HiveSmokeTest.sql b/regression/sql/FDW_HiveSmokeTest.sql new file mode 100644 index 0000000000..887c14d32c --- /dev/null +++ b/regression/sql/FDW_HiveSmokeTest.sql @@ -0,0 +1,45 @@ +-- data prep +{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} mkdir -p {{ TEST_LOCATION }} +\!mkdir -p {{ TEST_LOCATION }} +COPY ( + SELECT format('row_%s',i::varchar(255)), + i, + i*0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true' ELSE 'false' END + from generate_series(1, 100) s(i) + ) TO '{{ TEST_LOCATION }}/data.csv' + WITH (FORMAT 'csv'); +{{ GPDB_REMOTE }}-- if GPDB is remote, will need to scp file down from there for beeline +{{ GPDB_REMOTE }}\!scp {{ PGHOST }}:{{ TEST_LOCATION }}/data.csv {{ TEST_LOCATION }} +{{ HIVE_REMOTE }}-- if hive is remote, will need to scp file up there to load it in +{{ HIVE_REMOTE }}\!cat {{ TEST_LOCATION }}/data.csv | ssh {{ HIVE_HOST }} 'mkdir -p {{ TEST_LOCATION }} && cat > {{ TEST_LOCATION }}/data.csv' +\!{{ BEELINE_CMD }} -f {{ SCRIPT create_hive_smoke_test_database.sql }} -u 'jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }}' +\!{{ BEELINE_CMD }} -f {{ SCRIPT load_small_data.sql }} -u 'jdbc:hive2://{{ HIVE_HOST }}:10000/hive_smoke_test_database_{{ FULL_TESTNAME }}{{ HIVE_PRINCIPAL }}' + +-- FDW test +CREATE SERVER hive_smoke_test_server + FOREIGN DATA WRAPPER hive_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER SERVER hive_smoke_test_server; +CREATE FOREIGN TABLE hive_smoke_test_foreign_table ( + name TEXT, + num INTEGER, + dub DOUBLE PRECISION, + longNum BIGINT, + bool BOOLEAN + ) + SERVER hive_smoke_test_server + OPTIONS (resource 'hive_smoke_test_database_{{ FULL_TESTNAME }}.hive_small_data_table_{{ FULL_TESTNAME }}'); + +-- @description query01 for PXF test on small data +SELECT * FROM hive_smoke_test_foreign_table ORDER BY name; + +-- @description query02 for PXF test on small data +SELECT name, num FROM hive_smoke_test_foreign_table WHERE num > 50 ORDER BY name; + +{{ CLEAN_UP }}-- clean up Hive and local disk +{{ CLEAN_UP }}\!rm -rf {{ TEST_LOCATION }} +{{ CLEAN_UP }}\!{{ BEELINE_CMD }} -f {{ SCRIPT cleanup_hive_smoke_test.sql }} +{{ CLEAN_UP }}\!rm -rf {{ SCRIPT cleanup_hive_smoke_test.sql }} {{ SCRIPT load_small_data.sql }} {{ SCRIPT create_hive_smoke_test_database.sql }} +{{ CLEAN_UP }}{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} rm -rf {{ TEST_LOCATION }} diff --git a/regression/sql/FDW_MultiBlockDataSmokeTest.sql b/regression/sql/FDW_MultiBlockDataSmokeTest.sql new file mode 100644 index 0000000000..e7bd098b20 --- /dev/null +++ b/regression/sql/FDW_MultiBlockDataSmokeTest.sql @@ -0,0 +1,37 @@ +-- FDW test +CREATE SERVER multi_block_data_smoke_test_server + FOREIGN DATA WRAPPER {{ HCFS_PROTOCOL }}_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER SERVER multi_block_data_smoke_test_server; +CREATE FOREIGN TABLE multi_block_data_smoke_test_foreign_table ( + t1 TEXT, + a1 INTEGER + ) SERVER multi_block_data_smoke_test_server + OPTIONS (resource '{{ HCFS_BUCKET }}{{ TEST_LOCATION }}', format 'csv'); + +-- write to writable table +INSERT INTO multi_block_data_smoke_test_foreign_table + SELECT format('t%s', i::varchar(255)), i + from generate_series(1, 32000000) s(i); + +-- Verify data entered HCFS correctly, no distributed by in FDW yet +\!{ for i in $({{ HCFS_CMD }} dfs -ls {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} 2>/dev/null | tail -n +2 | awk '{print $NF}'); do {{ HCFS_CMD }} dfs -cat $i 2>/dev/null | head -1; done } | sort | head -1 + +-- @description query01 for PXF test on Multi Blocked data +SELECT count(*) FROM multi_block_data_smoke_test_foreign_table; + +-- @description query02 for PXF test on Multi Blocked data +SELECT sum(a1) FROM multi_block_data_smoke_test_foreign_table; + +-- @description query03 for PXF test on Multi Blocked data +SELECT t1, a1 FROM multi_block_data_smoke_test_foreign_table ORDER BY t1 LIMIT 10; + +-- @description query04 for PXF test on Multi Blocked data +SELECT cnt < 32000000 AS check FROM ( + SELECT COUNT(*) AS cnt + FROM multi_block_data_smoke_test_foreign_table + WHERE gp_segment_id = 0 + ) AS a; + +{{ CLEAN_UP }}-- clean up HCFS +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r -f {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} diff --git a/regression/sql/FDW_WritableSmokeTest.sql b/regression/sql/FDW_WritableSmokeTest.sql new file mode 100644 index 0000000000..e782d6e078 --- /dev/null +++ b/regression/sql/FDW_WritableSmokeTest.sql @@ -0,0 +1,31 @@ +-- FDW test +CREATE SERVER writable_smoke_test_hdfs + FOREIGN DATA WRAPPER {{ HCFS_PROTOCOL }}_pxf_fdw + OPTIONS (config '{{ SERVER_CONFIG }}'); +CREATE USER MAPPING FOR CURRENT_USER SERVER writable_smoke_test_hdfs; +CREATE FOREIGN TABLE writable_smoke_test_foreign_table ( + name TEXT, + num INTEGER, + dub DOUBLE PRECISION, + longNum BIGINT, + bool BOOLEAN + ) SERVER writable_smoke_test_hdfs + OPTIONS (resource '{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_fdw', format 'csv', delimiter '|'); + +-- write to writable table +INSERT INTO writable_smoke_test_foreign_table + SELECT format('row_%s',i::varchar(255)), + i, + i+0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true'::boolean ELSE 'false'::boolean END + from generate_series(1, 100) s(i); + +-- Verify data entered HCFS correctly, no distributed by in FDW yet +\!{ for i in $({{ HCFS_CMD }} dfs -ls {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_fdw 2>/dev/null | tail -n +2 | awk '{print $NF}'); do {{ HCFS_CMD }} dfs -cat $i 2>/dev/null | head -1; done } | sort | head -1 + +SELECT * FROM writable_smoke_test_foreign_table ORDER BY name; +SELECT name, num FROM writable_smoke_test_foreign_table WHERE num > 50 ORDER BY name; + +{{ CLEAN_UP }}-- clean up HCFS +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r -f {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} diff --git a/regression/sql/HBaseSmokeTest.sql b/regression/sql/HBaseSmokeTest.sql new file mode 100644 index 0000000000..8061ab463a --- /dev/null +++ b/regression/sql/HBaseSmokeTest.sql @@ -0,0 +1,16 @@ +-- Create Hbase tables hbase_table and pxflookup +\!{{ HBASE_CMD }} shell {{ SCRIPT create_pxflookup.rb }} >/dev/null 2>&1 +\!{{ HBASE_CMD }} shell {{ SCRIPT gen_small_data.rb }} + +-- External Table test +CREATE EXTERNAL TABLE h_base_smoke_test_external_table + (name TEXT, num INTEGER, dub DOUBLE PRECISION, longnum BIGINT, bool BOOLEAN) + LOCATION('pxf://hbase_small_data_table_{{ FULL_TESTNAME }}?PROFILE=HBase{{ SERVER_PARAM }}') + FORMAT 'CUSTOM' (FORMATTER='pxfwritable_import'); + +SELECT * FROM h_base_smoke_test_external_table ORDER BY name; +SELECT name, num FROM h_base_smoke_test_external_table WHERE num > 50 ORDER BY name; + +-- clean up HBase +{{ CLEAN_UP }}\!{{ HBASE_CMD }} shell {{ SCRIPT drop_small_data.rb }} >/dev/null 2>&1 +{{ CLEAN_UP }}\!rm -rf {{ SCRIPT drop_small_data.rb }} {{ SCRIPT gen_small_data.rb }} {{ SCRIPT create_pxflookup.rb }} diff --git a/regression/sql/HdfsSmokeTest.sql b/regression/sql/HdfsSmokeTest.sql new file mode 100644 index 0000000000..91d3ce558b --- /dev/null +++ b/regression/sql/HdfsSmokeTest.sql @@ -0,0 +1,30 @@ +-- data prep +{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} mkdir -p {{ TEST_LOCATION }} +\!mkdir -p {{ TEST_LOCATION }} +COPY ( + SELECT format('row_%s',i::varchar(255)), + i, + i+0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true' ELSE 'false' END + from generate_series(1, 100) s(i) + ) TO '{{ TEST_LOCATION }}/data.csv' + WITH (FORMAT 'csv'); +{{ GPDB_REMOTE }}-- if GPDB is remote, will need to scp file down from there for beeline +{{ GPDB_REMOTE }}\!scp {{ PGHOST }}:{{ TEST_LOCATION }}/data.csv {{ TEST_LOCATION }} +\!{{ HCFS_CMD }} dfs -mkdir -p {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +\!{{ HCFS_CMD }} dfs -copyFromLocal {{ TEST_LOCATION }}/data.csv {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} + +-- External Table test +CREATE EXTERNAL TABLE hdfs_smoke_test_external_table + (name TEXT, num INTEGER, dub DOUBLE PRECISION, longNum BIGINT, bool BOOLEAN) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/data.csv?PROFILE={{ HCFS_PROTOCOL }}:csv{{ SERVER_PARAM }}') + FORMAT 'CSV' (DELIMITER ','); + +SELECT * FROM hdfs_smoke_test_external_table ORDER BY name; +SELECT name, num FROM hdfs_smoke_test_external_table WHERE num > 50 ORDER BY name; + +{{ CLEAN_UP }}-- clean up HCFS and local disk +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} +{{ CLEAN_UP }}\!rm -rf {{ TEST_LOCATION }} +{{ CLEAN_UP }}{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} rm -rf {{ TEST_LOCATION }} diff --git a/regression/sql/HiveSmokeTest.sql b/regression/sql/HiveSmokeTest.sql new file mode 100644 index 0000000000..e3d031060f --- /dev/null +++ b/regression/sql/HiveSmokeTest.sql @@ -0,0 +1,41 @@ +-- data prep +{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} mkdir -p {{ TEST_LOCATION }} +\!mkdir -p {{ TEST_LOCATION }} +COPY ( + SELECT format('row_%s',i::varchar(255)), + i, + i*0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true' ELSE 'false' END + from generate_series(1, 100) s(i) + ) TO '{{ TEST_LOCATION }}/data.csv' + WITH (FORMAT 'csv'); +{{ GPDB_REMOTE }}-- if GPDB is remote, will need to scp file down from there for beeline +{{ GPDB_REMOTE }}\!scp {{ PGHOST }}:{{ TEST_LOCATION }}/data.csv {{ TEST_LOCATION }} +{{ HIVE_REMOTE }}-- if hive is remote, will need to scp file up there to load it in +{{ HIVE_REMOTE }}\!cat {{ TEST_LOCATION }}/data.csv | ssh {{ HIVE_HOST }} 'mkdir -p {{ TEST_LOCATION }} && cat > {{ TEST_LOCATION }}/data.csv' +\!{{ BEELINE_CMD }} -f {{ SCRIPT create_hive_smoke_test_database.sql }} -u 'jdbc:hive2://{{ HIVE_HOST }}:10000/default{{ HIVE_PRINCIPAL }}' +\!{{ BEELINE_CMD }} -f {{ SCRIPT load_small_data.sql }} -u 'jdbc:hive2://{{ HIVE_HOST }}:10000/hive_smoke_test_database_{{ FULL_TESTNAME }}{{ HIVE_PRINCIPAL }}' + +-- External Table test +CREATE EXTERNAL TABLE hive_smoke_test_external_table ( + name TEXT, + num INTEGER, + dub DOUBLE PRECISION, + longNum BIGINT, + bool BOOLEAN + ) + LOCATION('pxf://hive_smoke_test_database_{{ FULL_TESTNAME }}.hive_small_data_table_{{ FULL_TESTNAME }}?PROFILE=Hive{{ SERVER_PARAM }}') + FORMAT 'CUSTOM' (FORMATTER='pxfwritable_import'); + +-- @description query01 for PXF test on small data +SELECT * FROM hive_smoke_test_external_table ORDER BY name; + +-- @description query02 for PXF test on small data +SELECT name, num FROM hive_smoke_test_external_table WHERE num > 50 ORDER BY name; + +{{ CLEAN_UP }}-- clean up Hive and local disk +{{ CLEAN_UP }}\!rm -rf {{ TEST_LOCATION }} +{{ CLEAN_UP }}\!{{ BEELINE_CMD }} -f {{ SCRIPT cleanup_hive_smoke_test.sql }} +{{ CLEAN_UP }}\!rm -rf {{ SCRIPT cleanup_hive_smoke_test.sql }} {{ SCRIPT load_small_data.sql }} {{ SCRIPT create_hive_smoke_test_database.sql }} +{{ CLEAN_UP }}{{ GPDB_REMOTE }}\!ssh {{ PGHOST }} rm -rf {{ TEST_LOCATION }} diff --git a/regression/sql/MultiBlockDataSmokeTest.sql b/regression/sql/MultiBlockDataSmokeTest.sql new file mode 100644 index 0000000000..2c0e827203 --- /dev/null +++ b/regression/sql/MultiBlockDataSmokeTest.sql @@ -0,0 +1,43 @@ +-- Create writable table to insert data into HCFS +CREATE WRITABLE EXTERNAL TABLE multi_block_data_smoke_test_writable_external_table ( + t1 TEXT, + a1 INTEGER + ) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}?PROFILE={{ HCFS_PROTOCOL }}:csv{{ SERVER_PARAM }}') + FORMAT 'CSV' (DELIMITER ',') + DISTRIBUTED BY (t1); + +-- write to writable table +INSERT INTO multi_block_data_smoke_test_writable_external_table + SELECT format('t%s', i::varchar(255)), i + from generate_series(1, 32000000) s(i); + +-- Verify data entered HCFS correctly +\!{{ HCFS_CMD }} dfs -cat '{{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/*_0' 2>/dev/null | head -1 + +-- External Table test +CREATE EXTERNAL TABLE multi_block_data_smoke_test_external_table ( + t1 TEXT, + a1 INTEGER + ) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}?PROFILE={{ HCFS_PROTOCOL }}:csv{{ SERVER_PARAM }}') + FORMAT 'CSV' (DELIMITER ','); + +-- @description query01 for PXF test on Multi Blocked data +SELECT count(*) FROM multi_block_data_smoke_test_external_table; + +-- @description query02 for PXF test on Multi Blocked data +SELECT sum(a1) FROM multi_block_data_smoke_test_external_table; + +-- @description query03 for PXF test on Multi Blocked data +SELECT t1, a1 FROM multi_block_data_smoke_test_external_table ORDER BY t1 LIMIT 10; + +-- @description query04 for PXF test on Multi Blocked data +SELECT cnt < 32000000 AS check FROM ( + SELECT COUNT(*) AS cnt + FROM multi_block_data_smoke_test_external_table + WHERE gp_segment_id = 0 + ) AS a; + +{{ CLEAN_UP }}-- clean up HCFS +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r -f {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }} diff --git a/regression/sql/WritableSmokeTest.sql b/regression/sql/WritableSmokeTest.sql new file mode 100644 index 0000000000..64667218f9 --- /dev/null +++ b/regression/sql/WritableSmokeTest.sql @@ -0,0 +1,30 @@ +-- create writable external table +CREATE WRITABLE EXTERNAL TABLE writable_smoke_test_external_writable_table + (name TEXT, num INTEGER, dub DOUBLE PRECISION, longNum BIGINT, bool BOOLEAN) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_et?PROFILE={{ HCFS_PROTOCOL }}:text{{ SERVER_PARAM }}') + FORMAT 'TEXT' (DELIMITER '|') + DISTRIBUTED BY (num); + +-- write to writable table +INSERT INTO writable_smoke_test_external_writable_table + SELECT format('row_%s',i::varchar(255)), + i, + i+0.0001, + i*100000000000, + CASE WHEN (i%2) = 0 THEN 'true'::boolean ELSE 'false'::boolean END + from generate_series(1, 100) s(i); + +-- Verify data entered HCFS correctly +\!{{ HCFS_CMD }} dfs -cat '{{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_et/*_0' 2>/dev/null | head -1 + +-- External Table test +CREATE EXTERNAL TABLE writable_smoke_test_external_readable_table + (name TEXT, num INTEGER, dub DOUBLE PRECISION, longNum BIGINT, bool BOOLEAN) + LOCATION('pxf://{{ HCFS_BUCKET }}{{ TEST_LOCATION }}/bzip_et?PROFILE={{ HCFS_PROTOCOL }}:text{{ SERVER_PARAM }}') + FORMAT 'CSV' (DELIMITER '|'); + +SELECT * FROM writable_smoke_test_external_readable_table ORDER BY name; +SELECT name, num FROM writable_smoke_test_external_readable_table WHERE num > 50 ORDER BY name; + +{{ CLEAN_UP }}-- clean up HCFS +{{ CLEAN_UP }}\!{{ HCFS_CMD }} dfs -rm -r {{ HCFS_SCHEME }}{{ HCFS_BUCKET }}{{ TEST_LOCATION }}