Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orc diff part cols #37

Open
wants to merge 2 commits into
base: shark-0.11
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ql/src/test/queries/clientpositive/orc_diff_part_cols.q
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ INSERT OVERWRITE TABLE test_orc PARTITION (part = '1') SELECT key FROM src LIMIT

ALTER TABLE test_orc ADD COLUMNS (cnt INT);

INSERT OVERWRITE TABLE test_orc PARTITION (part = '2') SELECT key, count(*) FROM src GROUP BY key LIMIT 5;
INSERT OVERWRITE TABLE test_orc PARTITION (part = '2') SELECT key, count(*) FROM src GROUP BY key ORDER BY key LIMIT 5;

SELECT * FROM test_orc;
4 changes: 2 additions & 2 deletions ql/src/test/results/clientpositive/orc_diff_part_cols.q.out
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ POSTHOOK: type: ALTERTABLE_ADDCOLS
POSTHOOK: Input: default@test_orc
POSTHOOK: Output: default@test_orc
POSTHOOK: Lineage: test_orc PARTITION(part=1).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
PREHOOK: query: INSERT OVERWRITE TABLE test_orc PARTITION (part = '2') SELECT key, count(*) FROM src GROUP BY key LIMIT 5
PREHOOK: query: INSERT OVERWRITE TABLE test_orc PARTITION (part = '2') SELECT key, count(*) FROM src GROUP BY key ORDER BY key LIMIT 5
PREHOOK: type: QUERY
PREHOOK: Input: default@src
PREHOOK: Output: default@test_orc@part=2
POSTHOOK: query: INSERT OVERWRITE TABLE test_orc PARTITION (part = '2') SELECT key, count(*) FROM src GROUP BY key LIMIT 5
POSTHOOK: query: INSERT OVERWRITE TABLE test_orc PARTITION (part = '2') SELECT key, count(*) FROM src GROUP BY key ORDER BY key LIMIT 5
POSTHOOK: type: QUERY
POSTHOOK: Input: default@src
POSTHOOK: Output: default@test_orc@part=2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.HashSet;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
Expand All @@ -21,27 +20,6 @@ public class TUGIContainingProcessor implements TProcessor{
private final HadoopShims shim;
private final boolean isFsCacheDisabled;

// Keep all session UGIs to close their filesystems at Statement.close() and Connection.close()
// it's done to prevent LeaseChecker thread leak and to clean FileSystem.CACHE
private static final ThreadLocal<HashSet<UserGroupInformation>> ugis = new ThreadLocal<HashSet<UserGroupInformation>>() {
@Override
protected HashSet<UserGroupInformation> initialValue() {
return new HashSet<UserGroupInformation>();
}
};

/**
* Close FileSystem for session UGIs
*/
public static void closeAllFsForUGIs() {
HashSet<UserGroupInformation> ugisSet = ugis.get();
HadoopShims sh = ShimLoader.getHadoopShims();
for (UserGroupInformation ugi : ugisSet) {
sh.closeAllForUGI(ugi);
}
ugisSet.clear();
}

public TUGIContainingProcessor(TProcessor wrapped, Configuration conf) {
this.wrapped = wrapped;
this.isFsCacheDisabled = conf.getBoolean(String.format("fs.%s.impl.disable.cache",
Expand All @@ -56,8 +34,6 @@ public boolean process(final TProtocol in, final TProtocol out) throws TExceptio
try {
clientUgi = shim.createRemoteUser(((TSaslServerTransport)in.getTransport()).
getSaslServer().getAuthorizationID(), new ArrayList<String>());
// remember all UGIs created during the session
ugis.get().add(clientUgi);
return shim.doAs(clientUgi, new PrivilegedExceptionAction<Boolean>() {
public Boolean run() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@

package org.apache.hive.service.cli.session;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.conf.HiveConf;
Expand All @@ -35,7 +37,6 @@
import org.apache.hadoop.hive.ql.history.HiveHistory;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.hive.common.util.HiveVersionInfo;
import org.apache.hive.service.auth.TUGIContainingProcessor;
import org.apache.hive.service.cli.FetchOrientation;
import org.apache.hive.service.cli.GetInfoType;
import org.apache.hive.service.cli.GetInfoValue;
Expand Down Expand Up @@ -310,8 +311,6 @@ public void close() throws HiveSQLException {
hiveHist.closeStream();
}
sessionState.close();
// close all FileSystem for all UGIs created during this Connection live time
TUGIContainingProcessor.closeAllFsForUGIs();
release();
} catch (IOException ioe) {
release();
Expand Down Expand Up @@ -346,8 +345,6 @@ public void closeOperation(OperationHandle opHandle) throws HiveSQLException {
try {
operationManager.closeOperation(opHandle);
opHandleSet.remove(opHandle);
// close all FileSystem for all UGIs created during this Statement live time
TUGIContainingProcessor.closeAllFsForUGIs();
} finally {
release();
}
Expand Down