Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
985465fc
Commit
985465fc
authored
Mar 24, 2016
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-588 import-hive.sh fails while importing partitions for a non-partitioned…
ATLAS-588 import-hive.sh fails while importing partitions for a non-partitioned table (sumasai via shwethags)
parent
dd66e158
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
HiveMetaStoreBridge.java
...ava/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+6
-1
HiveMetaStoreBridgeTest.java
...org/apache/atlas/hive/bridge/HiveMetaStoreBridgeTest.java
+31
-0
release-log.txt
release-log.txt
+1
-0
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
View file @
985465fc
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
package
org
.
apache
.
atlas
.
hive
.
bridge
;
package
org
.
apache
.
atlas
.
hive
.
bridge
;
import
com.google.common.base.Joiner
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.ClientResponse
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
...
@@ -435,7 +436,11 @@ public class HiveMetaStoreBridge {
...
@@ -435,7 +436,11 @@ public class HiveMetaStoreBridge {
List
<
Partition
>
tableParts
=
hiveClient
.
getPartitions
(
table
);
List
<
Partition
>
tableParts
=
hiveClient
.
getPartitions
(
table
);
for
(
Partition
hivePart
:
tableParts
)
{
for
(
Partition
hivePart
:
tableParts
)
{
registerPartition
(
tableReferenceable
,
sdReferenceable
,
hivePart
);
if
(
hivePart
.
getValues
()
!=
null
&&
hivePart
.
getValues
().
size
()
>
0
)
{
registerPartition
(
tableReferenceable
,
sdReferenceable
,
hivePart
);
}
else
{
LOG
.
info
(
"Skipping partition for table {} since partition values are {}"
,
getTableQualifiedName
(
clusterName
,
table
.
getDbName
(),
table
.
getTableName
()),
StringUtils
.
join
(
hivePart
.
getValues
(),
","
));
}
}
}
}
}
...
...
addons/hive-bridge/src/test/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridgeTest.java
View file @
985465fc
...
@@ -35,6 +35,7 @@ import org.codehaus.jettison.json.JSONObject;
...
@@ -35,6 +35,7 @@ import org.codehaus.jettison.json.JSONObject;
import
org.mockito.ArgumentMatcher
;
import
org.mockito.ArgumentMatcher
;
import
org.mockito.Mock
;
import
org.mockito.Mock
;
import
org.mockito.MockitoAnnotations
;
import
org.mockito.MockitoAnnotations
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
scala.actors.threadpool.Arrays
;
import
scala.actors.threadpool.Arrays
;
...
@@ -163,6 +164,34 @@ public class HiveMetaStoreBridgeTest {
...
@@ -163,6 +164,34 @@ public class HiveMetaStoreBridgeTest {
new
Integer
(
lastAccessTime
))));
new
Integer
(
lastAccessTime
))));
}
}
@Test
public
void
testImportWhenPartitionKeysAreNull
()
throws
Exception
{
setupDB
(
hiveClient
,
TEST_DB_NAME
);
Table
hiveTable
=
setupTable
(
hiveClient
,
TEST_DB_NAME
,
TEST_TABLE_NAME
);
returnExistingDatabase
(
TEST_DB_NAME
,
atlasClient
,
CLUSTER_NAME
);
when
(
atlasClient
.
searchByDSL
(
HiveMetaStoreBridge
.
getTableDSLQuery
(
CLUSTER_NAME
,
TEST_DB_NAME
,
TEST_TABLE_NAME
,
HiveDataTypes
.
HIVE_TABLE
.
getName
()))).
thenReturn
(
getEntityReference
(
"82e06b34-9151-4023-aa9d-b82103a50e77"
));
when
(
atlasClient
.
getEntity
(
"82e06b34-9151-4023-aa9d-b82103a50e77"
)).
thenReturn
(
createTableReference
());
Partition
partition
=
mock
(
Partition
.
class
);
when
(
partition
.
getTable
()).
thenReturn
(
hiveTable
);
List
partitionValues
=
Arrays
.
asList
(
new
String
[]{});
when
(
partition
.
getValues
()).
thenReturn
(
partitionValues
);
when
(
hiveClient
.
getPartitions
(
hiveTable
)).
thenReturn
(
Arrays
.
asList
(
new
Partition
[]{
partition
}));
HiveMetaStoreBridge
bridge
=
new
HiveMetaStoreBridge
(
CLUSTER_NAME
,
hiveClient
,
atlasClient
);
try
{
bridge
.
importHiveMetadata
();
}
catch
(
Exception
e
)
{
Assert
.
fail
(
"Partition with null key caused import to fail with exception "
,
e
);
}
}
private
JSONArray
getPartitionReference
(
String
id
)
throws
JSONException
{
private
JSONArray
getPartitionReference
(
String
id
)
throws
JSONException
{
JSONObject
resultEntry
=
new
JSONObject
();
JSONObject
resultEntry
=
new
JSONObject
();
resultEntry
.
put
(
HiveMetaStoreBridge
.
SEARCH_ENTRY_GUID_ATTR
,
id
);
resultEntry
.
put
(
HiveMetaStoreBridge
.
SEARCH_ENTRY_GUID_ATTR
,
id
);
...
@@ -203,4 +232,6 @@ public class HiveMetaStoreBridgeTest {
...
@@ -203,4 +232,6 @@ public class HiveMetaStoreBridgeTest {
return
attrValue
.
equals
(((
Referenceable
)
o
).
get
(
attrName
));
return
attrValue
.
equals
(((
Referenceable
)
o
).
get
(
attrName
));
}
}
}
}
}
}
release-log.txt
View file @
985465fc
...
@@ -13,6 +13,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
...
@@ -13,6 +13,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES:
ALL CHANGES:
ATLAS-588 import-hive.sh fails while importing partitions for a non-partitioned table (sumasai via shwethags)
ATLAS-575 jetty-maven-plugin fails with ShutdownMonitorThread already started (shwethags)
ATLAS-575 jetty-maven-plugin fails with ShutdownMonitorThread already started (shwethags)
ATLAS-408 UI : Add a close link (x) on the top right when Tag is added (darshankumar89 via shwethags)
ATLAS-408 UI : Add a close link (x) on the top right when Tag is added (darshankumar89 via shwethags)
ATLAS-524 Support alter database (sumasai via shwethags)
ATLAS-524 Support alter database (sumasai via shwethags)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment