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

Support adding fields to nested Parquet structs #40

Open
wants to merge 134 commits into
base: twitter-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
cc95c27
Ignore if the partitions have no corresponfing hdfs valid path.
Sep 25, 2015
bce8187
Append nulls for missing values in Parquet.
Oct 1, 2015
5e68e6b
Merge pull request #1 from twitter-forks/twtr-filenotfound-bypass
saileshmittal Oct 1, 2015
2fef94e
Merge pull request #2 from twitter-forks/appendNullsForMissingParquet…
saileshmittal Oct 1, 2015
3bbcbb7
[maven-release-plugin] prepare for tw-0.1 release.
Oct 1, 2015
ca8560f
[maven-release-plugin] prepare for release 0.119-tw-0.1.
Oct 1, 2015
eff7e3b
Merge branch 'master' into twitter-master
Oct 2, 2015
ec109d1
Compare types ignoring cases. This is not complete solution and shoul…
Oct 2, 2015
413468d
Merge branch 'master' into twitter-master
Oct 2, 2015
d5cb455
Merge branch 'twitter-master' into case-insensitive-types
Oct 2, 2015
cc53eb2
Merge pull request #3 from twitter-forks/case-insensitive-types
saileshmittal Oct 2, 2015
c76b42e
Revert "Reduce allocation of hadoop configuration objects"
Oct 9, 2015
4e1dd9e
Merge branch 'master' into twitter-master
Oct 9, 2015
f0d9ab0
Bump up zookeeper version to 3.4.6
Oct 13, 2015
3bbabce
Read metastore info from zookeeper.
Oct 13, 2015
202e620
Add some tests and fix injection issue.
Oct 13, 2015
93f55bb
Remove Created by comments added by Idea.
Oct 14, 2015
37bd730
Merge pull request #5 from twitter-forks/zookeeperBasedMetastore
saileshmittal Oct 14, 2015
2154bf1
Merge branch 'master' into twitter-master
Oct 21, 2015
6083339
Fix some warnings after merging latest master.
Oct 22, 2015
972d5d1
Create ParquetHiveRecordCursor as user, so that hdfs reads happen as …
Oct 23, 2015
d014001
Propagate user session information throughout hive metastore.
Oct 26, 2015
bae9de6
Revert 972d5d166bc8174c9cef50b1066f6efc9a07a02b
Oct 26, 2015
a393158
Load splits as user so that hdfs reads happen as that user.
Oct 26, 2015
1b65e2f
UserBasedHiveMetastore to access metastore as user issuing the query.
Oct 26, 2015
32c7e9d
Merge pull request #6 from twitter-forks/run-queries-as-user
saileshmittal Oct 26, 2015
7cbc53a
Import missed import.
Oct 26, 2015
acfd0c7
Use standard charset for UTF-8 instead of string.
Oct 26, 2015
a5a4f8c
Pick username from unix system and disallow overriding it.
Nov 3, 2015
d1d87ac
Merge pull request #7 from twitter-forks/disable-setting-user
saileshmittal Nov 3, 2015
e26fd78
Revert "Propagate user session information throughout hive metastore."
Nov 23, 2015
8c99eeb
Revert "Load splits as user so that hdfs reads happen as that user."
Nov 23, 2015
884902f
Revert "UserBasedHiveMetastore to access metastore as user issuing th…
Nov 23, 2015
318bbaf
Merge pull request #8 from twitter-forks/revert-user-based-metastore
saileshmittal Nov 23, 2015
4a8c8bd
Merge tag '0.126' into twitter-master
Nov 23, 2015
fe37227
Prepare for release 0.126-tw-0.7.
Nov 23, 2015
344c8f0
HiveSplitManager to start HiveSplitLoader as session user
Dec 8, 2015
378c4ed
fixing indentation
Dec 8, 2015
484e255
fixing indentation
Dec 8, 2015
54bb135
Merge pull request #9 from billonahill/billg/IQ-23_runAsUser
saileshmittal Dec 8, 2015
4300a90
Updating version from to 0.126-tw-0.8
Dec 9, 2015
b00c53a
Revert runAsUser in preparation for 0.130 upgrade
Dec 17, 2015
adb149c
Changing pom version to 0.130 to avoid merge conflicts when merging i…
Dec 17, 2015
72b408d
Merge 0.130 from master
Dec 17, 2015
e84c4a4
Prepare for release 0.130-tw-0.9
Dec 17, 2015
fb45efb
Merge pull request #10 from billonahill/billg/revert_run_as
saileshmittal Dec 17, 2015
3861dc3
Remove empty line to fix stylecheck error
Dec 17, 2015
500fd08
Merge pull request #11 from billonahill/upgrade_to_130
Dec 17, 2015
7dd60e5
Allow Hive queries to read as the querying user
Dec 23, 2015
efc25af
add links to jiras
Dec 23, 2015
ef06e47
Clean up comments and constant order
Dec 23, 2015
2c22d81
Merge pull request #12 from billonahill/billg/IQ-39_hive_run_as_user
Jan 4, 2016
2200cde
Upgrading to 0.130-tw-0.10
Jan 4, 2016
1b38bdf
Updating unit tests for ReadAsQueryUser flag
Jan 4, 2016
44bd89e
Merge pull request #13 from billonahill/billg/IQ-39_hive_run_as_user_…
Jan 4, 2016
9f646d1
Avoid NPE when ZK changed state is related to connection change.
Jan 6, 2016
347e913
Merge pull request #14 from twitter-forks/IQ-96_zk_metastore_NPE
Jan 6, 2016
4897330
Cache the UGI object per user in BackgroundHiveSplitLoader
Jan 12, 2016
a40603c
Merge pull request #15 from billonahill/billg/IQ-93_hive_ugi_leak
Jan 12, 2016
53ae65b
Upgrading version to 0.130-tw-0.11
Jan 12, 2016
d2d2923
Merge pull request #16 from billonahill/upgrade_to_130_11
Jan 12, 2016
eff466b
Change version to 0.132.
Jan 13, 2016
84a1cb1
Merge tag '0.132' into upgrade_to_0.132_12
Jan 13, 2016
14fdca1
Change version to 0.132-tw-0.12.
Jan 13, 2016
f32a4ba
Merge pull request #17 from saileshmittal/upgrade_to_0.132_12
Jan 14, 2016
310441d
HivePageSourceProvider to support query as user from workers
Jan 15, 2016
75713e7
Merge pull request #18 from billonahill/billg/IQ-122_presto_tasks_as_…
Jan 15, 2016
cab14e9
Upgrading presto to 0.132-tw-13
Jan 15, 2016
d8e5545
Merge pull request #19 from billonahill/upgrade_to_132_13
saileshmittal Jan 15, 2016
cfc2113
Revert PR#3, case insensitive types, since it is now supported.
Jan 31, 2016
b25b9f0
Update to use UGI.createProxyUser instead of createRemoteUser
Feb 3, 2016
3fe2d59
Merge pull request #21 from billonahill/billg/IQ-85_fix_run_as
Feb 3, 2016
ea2c8c3
Upgrade to 0.132-tw-0.14
Feb 3, 2016
228255b
Merge pull request #22 from billonahill/upgrade_to_132_14
Feb 3, 2016
6ac4bc4
Whitelist zeppelin temporarily
Feb 4, 2016
99f824d
Merge pull request #23 from billonahill/billg/IQ-152_zeppelin_whitelist
Feb 4, 2016
6d857e6
Upgrade to 0.132-tw-0.15
Feb 4, 2016
ddc1960
Merge pull request #24 from billonahill/upgrade_to_132_15
Feb 4, 2016
91a7875
Merge pull request #20 from saileshmittal/revert-pr-3
Feb 8, 2016
207a2cc
Rolling back Zeppelin auth hack, add some logging
Feb 11, 2016
b71b9f7
Merge pull request #25 from billonahill/billg/IQ-152_roll_back_zeppel…
Feb 11, 2016
daa3773
Upgrading to 0.132-tw-0.16
Feb 11, 2016
b71195c
Merge pull request #26 from billonahill/upgrade_to_132_16
Feb 11, 2016
f4fed25
Change version to 0.139 to not conflict with merge
Feb 24, 2016
b3a94e1
merge from 0.139
Feb 24, 2016
2c9da60
upgrade pom version to 0.139-tw-0.17
Feb 24, 2016
d295eea
Merge pull request #27 from billonahill/upgrade_to_139_17
Feb 24, 2016
582df38
Adding query logging to presto queries
Feb 24, 2016
04e60cc
Add a few logs in DiscoveryNodeManager to debug 'No worker nodes' error.
Feb 29, 2016
56582c3
Merge pull request #29 from saileshmittal/add-logs-to-discovery
saileshmittal Feb 29, 2016
280e37c
Merge pull request #28 from billonahill/billg/log_presto_queries
saileshmittal Feb 29, 2016
4ca01a7
Upgrade to 0.139-tw-0.18
Feb 29, 2016
3a4a156
Merge pull request #30 from saileshmittal/upgrade_to_139_18
saileshmittal Feb 29, 2016
f1085e0
Look up parquet columns by name case-insensitive
Mar 1, 2016
775eee8
Merge pull request #31 from billonahill/billg/case_insensitive_parque…
Mar 2, 2016
5b4647a
Upgrading to 0.139-tw-0.19
Mar 2, 2016
f766a0c
Handle hive keywords when doing a name-based parquet field lookup
Mar 2, 2016
a062c56
Merge branch 'billg/keyword_aware_parquet_column_match' into upgrade_…
Mar 2, 2016
ca9961e
Refactor to make diff cleaner
Mar 2, 2016
423f5cf
Merge branch 'billg/keyword_aware_parquet_column_match' into upgrade_…
Mar 2, 2016
a1807ed
Merge pull request #32 from billonahill/billg/keyword_aware_parquet_c…
Mar 2, 2016
d687155
Merge branch 'twitter-master' into upgrade_to_139_19
Mar 2, 2016
7eb8909
Merge pull request #33 from billonahill/upgrade_to_139_19
Mar 2, 2016
d7d66a2
Upgrade to 0.141.
Mar 11, 2016
a7a5233
Merge tag '0.141' into upgrade_to_141_20
Mar 11, 2016
94bcf3e
Upgrade to 0.141-tw-0.20.
Mar 11, 2016
dc6bebe
Merge pull request #34 from saileshmittal/upgrade_to_141_20
Mar 11, 2016
3de1ca4
Use modules and query events for logging
Mar 24, 2016
f055db6
Add javadocs
Mar 24, 2016
3c1c7b6
Add javadocs
Mar 24, 2016
d8afd62
fix imports
Mar 24, 2016
251db4d
add splits, rows and bytes
Mar 24, 2016
95035ec
Change to use QueryComplete
Mar 24, 2016
c95c702
Merge pull request #36 from billonahill/billg/IQ-192_refactor_logging
Mar 24, 2016
dbb4c42
Add event process and handlers and scribe query completion events
Mar 29, 2016
38e6d09
code clean-up
Mar 29, 2016
2ac4c42
Fix package leakage
Mar 29, 2016
a8d1ffc
Move twitter classes to a twitter package
Mar 29, 2016
73c5302
Default package is presto and thrift is custom
Mar 29, 2016
850e71c
Merge pull request #38 from billonahill/billg/twitter_specific_cleanup
Mar 30, 2016
fadd0f1
Removing test from scribe category
Mar 30, 2016
c45e721
Merge pull request #37 from billonahill/billg/scribe_query_complete_e…
Mar 30, 2016
2e5c3f2
change version to avoid merge conflicts
Mar 30, 2016
06134ba
Merge from 0.143
Mar 30, 2016
1673479
Update version to 0.143-tw-21
Mar 30, 2016
4e48cbd
Fixed to not use illegal import
Mar 30, 2016
55a3960
Reduce logging of unsupported HttpRequest events
Mar 30, 2016
57b91f2
Merge pull request #39 from billonahill/upgrade_to_143_21
Mar 30, 2016
8729a4e
Fix version from 0.143-tw-21 to 0.143-tw-0.21
Mar 30, 2016
e6579ab
Fix name of log category
Mar 31, 2016
9681aa1
Support adding fields to nested Parquet structs
Apr 4, 2016
b2cea9f
Fix table partition typo
Apr 5, 2016
f85de53
Fix table partition typo
Apr 5, 2016
9b936c8
Refactored type comparison to use HiveType
Apr 5, 2016
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
73 changes: 68 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
<packaging>pom</packaging>

<name>presto-root</name>
Expand All @@ -28,9 +28,9 @@
</licenses>

<scm>
<connection>scm:git:git://github.com/facebook/presto.git</connection>
<url>https://github.com/facebook/presto</url>
<tag>0.143</tag>
<connection>scm:git:git://github.com/twitter-forks/presto.git</connection>
<url>https://github.com/twitter-forks/presto</url>
<tag>0.143-tw-0.21</tag>
</scm>

<properties>
Expand Down Expand Up @@ -663,7 +663,7 @@
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.3.6</version>
<version>3.4.6</version>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
Expand All @@ -673,6 +673,14 @@
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -729,6 +737,61 @@
<artifactId>hive-apache-jdbc</artifactId>
<version>0.13.1-1</version>
</dependency>

<!-- twitter deps -->
<dependency>
<groupId>com.twitter</groupId>
<artifactId>presto-thrift-java</artifactId>
<version>0.0.1</version>
<exclusions>
<exclusion>
<groupId>com.twitter</groupId>
<artifactId>util-core_2.11</artifactId>
</exclusion>
<exclusion>
<groupId>com.twitter</groupId>
<artifactId>util-core-java</artifactId>
</exclusion>
<exclusion>
<groupId>com.twitter</groupId>
<artifactId>util-function_2.10</artifactId>
</exclusion>
<exclusion>
<groupId>com.twitter</groupId>
<artifactId>util-function-java</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-parser-combinators_2.11</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.twitter</groupId>
<artifactId>util-logging_2.11</artifactId>
<version>6.33.0</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.7</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
2 changes: 1 addition & 1 deletion presto-base-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-base-jdbc</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-benchmark-driver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-benchmark-driver</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>presto-root</artifactId>
<groupId>com.facebook.presto</groupId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-benchmark</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-blackhole/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-blackhole</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-bytecode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-bytecode</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-cassandra</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-cli</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
import com.google.common.net.HostAndPort;
import com.sun.security.auth.module.UnixSystem;
import io.airlift.airline.Option;
import io.airlift.http.client.spnego.KerberosConfig;
import io.airlift.units.Duration;
Expand Down Expand Up @@ -68,8 +69,9 @@ public class ClientOptions
@Option(name = "--keystore-password", title = "keystore password", description = "Keystore password")
public String keystorePassword;

@Option(name = "--user", title = "user", description = "Username")
public String user = System.getProperty("user.name");
// Pick the user name for the logged in user.
// Do not let it be overridden by users.
public String user = new UnixSystem().getUsername();

@Option(name = "--source", title = "source", description = "Name of source making query")
public String source = "presto-cli";
Expand Down
2 changes: 1 addition & 1 deletion presto-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-docs</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-example-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-example-http</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-hive-cdh4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-hive-cdh4</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-hive-cdh5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-hive-cdh5</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-hive-hadoop1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-hive-hadoop1</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-hive-hadoop2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-hive-hadoop2</artifactId>
Expand Down
46 changes: 45 additions & 1 deletion presto-hive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.143</version>
<version>0.143-tw-0.21</version>
</parent>

<artifactId>presto-hive</artifactId>
Expand Down Expand Up @@ -43,6 +43,44 @@
<artifactId>hive-apache</artifactId>
</dependency>

<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>2.8.0</version>
</dependency>

<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>2.8.0</version>
</dependency>

<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
<version>2.8.0</version>
</dependency>

<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<version>2.8.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.6</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
Expand Down Expand Up @@ -88,6 +126,12 @@
<artifactId>configuration</artifactId>
</dependency>

<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.facebook.presto.spi.ConnectorSession;
import com.facebook.presto.spi.HostAddress;
import com.facebook.presto.spi.predicate.TupleDomain;
import com.facebook.presto.twitter.hive.util.UgiUtils;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import io.airlift.units.DataSize;
Expand All @@ -38,8 +39,10 @@
import org.apache.hadoop.mapred.InputFormat;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.security.UserGroupInformation;

import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Deque;
Expand Down Expand Up @@ -138,8 +141,15 @@ public BackgroundHiveSplitLoader(
public void start(HiveSplitSource splitSource)
{
this.hiveSplitSource = splitSource;

UserGroupInformation ugi = null;

if (HiveSessionProperties.getReadAsQueryUser(session)) {
ugi = UgiUtils.getUgi(session.getUser());
}

for (int i = 0; i < maxPartitionBatchSize; i++) {
ResumableTasks.submit(executor, new HiveSplitLoaderTask());
ResumableTasks.submit(executor, new HiveSplitLoaderTask(ugi));
}
}

Expand All @@ -152,8 +162,30 @@ public void stop()
private class HiveSplitLoaderTask
implements ResumableTask
{
private UserGroupInformation ugi;

public HiveSplitLoaderTask(UserGroupInformation ugi)
{
this.ugi = ugi;
}

@Override
public TaskStatus process()
{
if (ugi != null) {
try {
return ugi.doAs((PrivilegedExceptionAction<TaskStatus>) this::doProcess);
}
catch (IOException | InterruptedException e) {
throw new RuntimeException("Could not runAs " + session.getUser(), e);
}
}
else {
return doProcess();
}
}

private TaskStatus doProcess()
{
while (true) {
if (stopped) {
Expand Down
Loading