Files
impala/bin/set-pythonpath.sh
Lars Volker 82a1aef91b IMPALA-1687: Expand CTAS to allow partition clauses
This changes implements support for PARTITIONED BY clauses in CTAS
statements. The syntax and semantics follow the PARTITION feature of
insert from select statements: inside the PARTITIONED BY (...) column
list the user must specify names of the columns to partition by. These
column names must appear in that particular order at the end of the
select statement. A remapping between columns of the source and
destination tables is not possible, because the destination table does
not yet exist. Specifying static values for the partition columns is
also not possible, as their type needs to be deduced from columns in the
select statement. Example:

CREATE TABLE t (a DOUBLE, b INT);
INSERT INTO t VALUES (1.5, 3);
CREATE TABLE p PARTITIONED BY (b) AS SELECT a, b FROM t;

This change also contains a fix for setting the PYTHONPATH environment
variable correctly, so you can run single python tests from the command
line.

Change-Id: I5f61854d36d1ee30cfcd1c6b2b3eb971f6cf4b2f
Reviewed-on: http://gerrit.cloudera.org:8080/1740
Reviewed-by: Lars Volker <lv@cloudera.com>
Tested-by: Internal Jenkins
2016-01-18 16:55:45 +00:00

46 lines
1.7 KiB
Bash
Executable File

# Copyright 2012 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# set the python path for test modules and beeswax
PYTHONPATH=${IMPALA_HOME}:${IMPALA_HOME}/shell/gen-py:${IMPALA_HOME}/testdata/
# There should be just a single version of python that created the
# site-packages directory. We find it by performing shell independent expansion
# of the following pattern:
# ${THRIFT_HOME}/python/lib{64,}/python*/site-packages
# Note: this could go wrong if we have used two different versions of
# Python to build Thrift on this machine, and the first version is not
# compatible with the second.
for PYTHON_DIR in ${THRIFT_HOME}/python/lib{64,}; do
[[ -d ${PYTHON_DIR} ]] || continue
for PKG_DIR in ${PYTHON_DIR}/python*/site-packages; do
PYTHONPATH=${PYTHONPATH}:${PKG_DIR}/
done
done
# Add Hive after Thrift because Hive supplies its own Thrift modules
PYTHONPATH=${PYTHONPATH}:${HIVE_HOME}/lib/py
# Add all the built eggs to the python path
for EGG in ${IMPALA_HOME}/shell/ext-py/*/dist/*.egg; do
PYTHONPATH=${PYTHONPATH}:${EGG}
done
# Add path to generated thrift modules
for PKG_DIR in ${IMPALA_HOME}/infra/python/env/lib/python*/site-packages; do
PYTHONPATH=${PYTHONPATH}:${PKG_DIR}
done
export PYTHONPATH