[
https://issues.apache.org/jira/browse/HIVE-27268?focusedWorklogId=860807&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-860807
]
ASF GitHub Bot logged work on HIVE-27268:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 05/May/23 17:26
Start Date: 05/May/23 17:26
Worklog Time Spent: 10m
Work Description: saihemanth-cloudera commented on code in PR #4241:
URL: https://github.com/apache/hive/pull/4241#discussion_r1186339099
##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnNoBuckets.java:
##########
@@ -909,5 +910,30 @@ public void testEmptyCompactionResult() throws Exception {
Assert.assertEquals(stringifyValues(data), rs);
}
+
+ /**
+ * HIVE-27268
+ */
+ @Test
+ public void testGetPartitionsNoSession() throws Exception {
+ hiveConf.setIntVar(HiveConf.ConfVars.HIVEOPTSORTDYNAMICPARTITIONTHRESHOLD,
-1);
+ runStatementOnDriver("drop table if exists T");
+ runStatementOnDriver("create table T(a int, b int) partitioned by (p int,
q int) " +
+ "stored as orc TBLPROPERTIES ('transactional'='true')");
+
+ int[][] targetVals = {{4, 1, 1}, {4, 2, 2}, {4, 3, 1}, {4, 4, 2}};
+ //we only recompute stats after major compact if they existed before
+ runStatementOnDriver("insert into T partition(p=1,q) " +
makeValuesClause(targetVals));
+ runStatementOnDriver("analyze table T partition(p=1) compute statistics
for columns");
+
+ Hive hive = Hive.get();
+ org.apache.hadoop.hive.ql.metadata.Table hiveTable = hive.getTable("T");
+ // this will ensure the getValidWriteIdList has no session to work with
(thru getPartitions)
+ SessionState.detachSession();
+ List<org.apache.hadoop.hive.ql.metadata.Partition> partitions =
hive.getPartitions(hiveTable);
+ Assert.assertNotNull(partitions);
+ // prevent tear down failure
+ d = null;
Review Comment:
Should we do `d.close()` instead of assigning it to null?
Issue Time Tracking
-------------------
Worklog Id: (was: 860807)
Time Spent: 1h 10m (was: 1h)
> Hive.getPartitionsByNames should not enforce SessionState to be available
> -------------------------------------------------------------------------
>
> Key: HIVE-27268
> URL: https://issues.apache.org/jira/browse/HIVE-27268
> Project: Hive
> Issue Type: Bug
> Components: Hive
> Affects Versions: 3.1.3
> Reporter: Henri Biestro
> Priority: Minor
> Labels: pull-request-available
> Fix For: 4.0.0
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> HIVE-24743, HIVE-24392 is enforcing to check for valid write Id list for
> "Hive.getPartitionsByName".
> This breaks basic API integration. For a user who needs to get basic
> partition detail, he is forced to have SessionState.
> Request in this ticket is to ensure that if SessionState.get() is null, it
> should return empty validWriteIdList.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)