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
12ca5c97
Commit
12ca5c97
authored
7 years ago
by
rmani
Committed by
Sarath Subramanian
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2785: Import Hive script should handle table name with database in -t option
Signed-off-by:
Sarath Subramanian
<
ssubramanian@hortonworks.com
>
parent
59ae59db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
HiveMetaStoreBridge.java
...ava/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+24
-2
No files found.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
View file @
12ca5c97
...
@@ -248,11 +248,25 @@ public class HiveMetaStoreBridge {
...
@@ -248,11 +248,25 @@ public class HiveMetaStoreBridge {
}
}
private
void
importDatabases
(
boolean
failOnError
,
String
databaseToImport
,
String
tableToImport
)
throws
Exception
{
private
void
importDatabases
(
boolean
failOnError
,
String
databaseToImport
,
String
tableToImport
)
throws
Exception
{
final
List
<
String
>
databaseNames
;
List
<
String
>
databaseNames
=
null
;
if
(
StringUtils
.
isEmpty
(
databaseToImport
))
{
if
(
StringUtils
.
isEmpty
(
databaseToImport
)
&&
StringUtils
.
isEmpty
(
tableToImport
))
{
//when both database and table to import are empty, import all
databaseNames
=
hiveClient
.
getAllDatabases
();
databaseNames
=
hiveClient
.
getAllDatabases
();
}
else
if
(
StringUtils
.
isEmpty
(
databaseToImport
)
&&
StringUtils
.
isNotEmpty
(
tableToImport
))
{
//when database is empty and table is not, then check table has database name in it and import that db and table
if
(
isTableWithDatabaseName
(
tableToImport
))
{
String
val
[]
=
tableToImport
.
split
(
"\\."
);
if
(
val
.
length
>
1
)
{
databaseToImport
=
val
[
0
];
tableToImport
=
val
[
1
];
}
databaseNames
=
hiveClient
.
getDatabasesByPattern
(
databaseToImport
);
}
else
{
databaseNames
=
hiveClient
.
getAllDatabases
();
}
}
else
{
}
else
{
//when database to import has some value then, import that db and all table under it.
databaseNames
=
hiveClient
.
getDatabasesByPattern
(
databaseToImport
);
databaseNames
=
hiveClient
.
getDatabasesByPattern
(
databaseToImport
);
}
}
...
@@ -919,4 +933,12 @@ public class HiveMetaStoreBridge {
...
@@ -919,4 +933,12 @@ public class HiveMetaStoreBridge {
entity
.
getRelationshipAttributes
().
clear
();
entity
.
getRelationshipAttributes
().
clear
();
}
}
}
}
private
boolean
isTableWithDatabaseName
(
String
tableName
)
{
boolean
ret
=
false
;
if
(
tableName
.
contains
(
"."
))
{
ret
=
true
;
}
return
ret
;
}
}
}
This diff is collapsed.
Click to expand it.
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