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
08af18ad
Commit
08af18ad
authored
May 28, 2015
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/hortonworks/metadata
into BUG_37105
parents
fbf32c03
3b9e1b2f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
154 additions
and
9 deletions
+154
-9
HiveDataModelGenerator.java
...he/hadoop/metadata/hive/model/HiveDataModelGenerator.java
+3
-2
HiveHookIT.java
...java/org/apache/hadoop/metadata/hive/hook/HiveHookIT.java
+6
-6
HiveLineageServiceTest.java
...che/hadoop/metadata/discovery/HiveLineageServiceTest.java
+33
-0
GremlinTest.scala
.../scala/org/apache/hadoop/metadata/query/GremlinTest.scala
+7
-0
client.properties
src/conf/client.properties
+36
-0
HiveLineageResource.java
...he/hadoop/metadata/web/resources/HiveLineageResource.java
+1
-1
HiveLineageJerseyResourceIT.java
...p/metadata/web/resources/HiveLineageJerseyResourceIT.java
+68
-0
No files found.
addons/hive-bridge/src/main/java/org/apache/hadoop/metadata/hive/model/HiveDataModelGenerator.java
View file @
08af18ad
...
...
@@ -452,8 +452,9 @@ public class HiveDataModelGenerator {
Multiplicity
.
REQUIRED
,
false
,
null
),
new
AttributeDefinition
(
"functionType"
,
HiveDataTypes
.
HIVE_FUNCTION_TYPE
.
getName
(),
Multiplicity
.
REQUIRED
,
false
,
null
),
new
AttributeDefinition
(
"resourceUris"
,
HiveDataTypes
.
HIVE_RESOURCEURI
.
getName
(),
Multiplicity
.
COLLECTION
,
false
,
null
),
new
AttributeDefinition
(
"resourceUris"
,
DataTypes
.
arrayTypeName
(
HiveDataTypes
.
HIVE_RESOURCEURI
.
getName
()),
Multiplicity
.
OPTIONAL
,
false
,
null
),
};
HierarchicalTypeDefinition
<
ClassType
>
definition
=
new
HierarchicalTypeDefinition
<>(
...
...
addons/hive-bridge/src/test/java/org/apache/hadoop/metadata/hive/hook/HiveHookIT.java
View file @
08af18ad
...
...
@@ -62,8 +62,8 @@ public class HiveHookIT {
hiveConf
.
set
(
"javax.jdo.option.ConnectionURL"
,
"jdbc:derby:./target/metastore_db;create=true"
);
hiveConf
.
set
(
"hive.hook.dgi.synchronous"
,
"true"
);
hiveConf
.
set
(
HiveMetaStoreBridge
.
HIVE_CLUSTER_NAME
,
CLUSTER_NAME
);
//weird, hive prepends test_ to table name
hiveConf
.
set
(
"hive.test.mode"
,
"true
"
);
hiveConf
.
setBoolVar
(
HiveConf
.
ConfVars
.
HIVETESTMODE
,
true
);
//to not use hdfs
hiveConf
.
set
Var
(
HiveConf
.
ConfVars
.
HIVETESTMODEPREFIX
,
"
"
);
hiveConf
.
set
(
"fs.pfile.impl"
,
"org.apache.hadoop.fs.ProxyLocalFileSystem"
);
return
hiveConf
;
}
...
...
@@ -127,7 +127,7 @@ public class HiveHookIT {
@Test
public
void
testLoadData
()
throws
Exception
{
String
tableName
=
"table"
+
random
();
runCommand
(
"create table
test_
"
+
tableName
+
"(id int, name string)"
);
runCommand
(
"create table "
+
tableName
+
"(id int, name string)"
);
String
loadFile
=
file
(
"load"
);
String
query
=
"load data local inpath 'file://"
+
loadFile
+
"' into table "
+
tableName
;
...
...
@@ -142,14 +142,14 @@ public class HiveHookIT {
runCommand
(
"create table "
+
tableName
+
"(id int, name string) partitioned by(dt string)"
);
String
insertTableName
=
"table"
+
random
();
runCommand
(
"create table
test_
"
+
insertTableName
+
"(name string) partitioned by(dt string)"
);
runCommand
(
"create table "
+
insertTableName
+
"(name string) partitioned by(dt string)"
);
String
query
=
"insert into "
+
insertTableName
+
" partition(dt = '2015-01-01') select name from "
+
tableName
+
" where dt = '2015-01-01'"
;
runCommand
(
query
);
assertProcessIsRegistered
(
query
);
assertPartitionIsRegistered
(
"default"
,
"test_"
+
insertTableName
,
"2015-01-01"
);
assertPartitionIsRegistered
(
"default"
,
insertTableName
,
"2015-01-01"
);
}
private
String
random
()
{
...
...
@@ -173,7 +173,7 @@ public class HiveHookIT {
@Test
public
void
testExportImport
()
throws
Exception
{
String
tableName
=
"table"
+
random
();
runCommand
(
"create table
test_
"
+
tableName
+
"(name string)"
);
runCommand
(
"create table "
+
tableName
+
"(name string)"
);
String
filename
=
"pfile://"
+
mkdir
(
"export"
);
String
query
=
"export table "
+
tableName
+
" to '"
+
filename
+
"'"
;
...
...
repository/src/test/java/org/apache/hadoop/metadata/discovery/HiveLineageServiceTest.java
View file @
08af18ad
...
...
@@ -166,6 +166,23 @@ public class HiveLineageServiceTest {
}
@Test
public
void
testGetInputsGraph
()
throws
Exception
{
JSONObject
results
=
new
JSONObject
(
hiveLineageService
.
getInputsGraph
(
"sales_fact_monthly_mv"
));
Assert
.
assertNotNull
(
results
);
System
.
out
.
println
(
"inputs graph = "
+
results
);
JSONObject
values
=
results
.
getJSONObject
(
"values"
);
Assert
.
assertNotNull
(
values
);
final
JSONObject
vertices
=
values
.
getJSONObject
(
"vertices"
);
Assert
.
assertEquals
(
vertices
.
length
(),
4
);
final
JSONObject
edges
=
values
.
getJSONObject
(
"edges"
);
Assert
.
assertEquals
(
edges
.
length
(),
4
);
}
@Test
public
void
testGetOutputs
()
throws
Exception
{
JSONObject
results
=
new
JSONObject
(
hiveLineageService
.
getOutputs
(
"sales_fact"
));
Assert
.
assertNotNull
(
results
);
...
...
@@ -179,6 +196,22 @@ public class HiveLineageServiceTest {
Assert
.
assertTrue
(
paths
.
length
()
>
0
);
}
@Test
public
void
testGetOutputsGraph
()
throws
Exception
{
JSONObject
results
=
new
JSONObject
(
hiveLineageService
.
getOutputsGraph
(
"sales_fact"
));
Assert
.
assertNotNull
(
results
);
System
.
out
.
println
(
"outputs graph = "
+
results
);
JSONObject
values
=
results
.
getJSONObject
(
"values"
);
Assert
.
assertNotNull
(
values
);
final
JSONObject
vertices
=
values
.
getJSONObject
(
"vertices"
);
Assert
.
assertEquals
(
vertices
.
length
(),
3
);
final
JSONObject
edges
=
values
.
getJSONObject
(
"edges"
);
Assert
.
assertEquals
(
edges
.
length
(),
4
);
}
@DataProvider
(
name
=
"tableNamesProvider"
)
private
Object
[][]
tableNames
()
{
return
new
String
[][]
{
...
...
repository/src/test/scala/org/apache/hadoop/metadata/query/GremlinTest.scala
View file @
08af18ad
...
...
@@ -143,4 +143,11 @@ class GremlinTest extends FunSuite with BeforeAndAfterAll with BaseGremlinTest {
val
e
=
p
(
"from blah"
).
right
.
get
an
[
ExpressionException
]
should
be
thrownBy
QueryProcessor
.
evaluate
(
e
,
g
)
}
test
(
"Bug37860"
)
{
val
p
=
new
QueryParser
val
e
=
p
(
"Table as t where name = 'sales_fact' db where name = 'Sales' and owner = 'John ETL' select t"
).
right
.
get
val
r
=
QueryProcessor
.
evaluate
(
e
,
g
)
validateJson
(
r
)
}
}
src/conf/client.properties
0 → 100755
View file @
08af18ad
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
######### Security Properties #########
# SSL config
metadata.enableTLS
=
false
truststore.file
=
/path/to/truststore.jks
cert.stores.credential.provider.path
=
jceks://file/path/to/credentialstore.jceks
# following only required for 2-way SSL
keystore.file
=
/path/to/keystore.jks
# Authentication config
# enabled: true or false
metadata.http.authentication.enabled
=
false
# type: simple or kerberos
metadata.http.authentication.type
=
simple
######### Security Properties #########
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/HiveLineageResource.java
View file @
08af18ad
...
...
@@ -176,7 +176,7 @@ public class HiveLineageResource {
LOG
.
info
(
"Fetching lineage outputs graph for tableName={}"
,
tableName
);
try
{
final
String
jsonResult
=
lineageService
.
getOutputs
(
tableName
);
final
String
jsonResult
=
lineageService
.
getOutputs
Graph
(
tableName
);
JSONObject
response
=
new
JSONObject
();
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/HiveLineageJerseyResourceIT.java
View file @
08af18ad
...
...
@@ -95,6 +95,40 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
}
@Test
public
void
testInputsGraph
()
throws
Exception
{
WebResource
resource
=
service
.
path
(
BASE_URI
)
.
path
(
"sales_fact_monthly_mv"
)
.
path
(
"inputs"
)
.
path
(
"graph"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
String
responseAsString
=
clientResponse
.
getEntity
(
String
.
class
);
Assert
.
assertNotNull
(
responseAsString
);
System
.
out
.
println
(
"inputs graph = "
+
responseAsString
);
JSONObject
response
=
new
JSONObject
(
responseAsString
);
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
REQUEST_ID
));
JSONObject
results
=
response
.
getJSONObject
(
MetadataServiceClient
.
RESULTS
);
Assert
.
assertNotNull
(
results
);
JSONObject
values
=
results
.
getJSONObject
(
"values"
);
Assert
.
assertNotNull
(
values
);
final
JSONObject
vertices
=
values
.
getJSONObject
(
"vertices"
);
Assert
.
assertEquals
(
vertices
.
length
(),
4
);
final
JSONObject
edges
=
values
.
getJSONObject
(
"edges"
);
Assert
.
assertEquals
(
edges
.
length
(),
4
);
}
@Test
public
void
testOutputs
()
throws
Exception
{
WebResource
resource
=
service
.
path
(
BASE_URI
)
...
...
@@ -126,6 +160,40 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
}
@Test
public
void
testOutputsGraph
()
throws
Exception
{
WebResource
resource
=
service
.
path
(
BASE_URI
)
.
path
(
"sales_fact"
)
.
path
(
"outputs"
)
.
path
(
"graph"
);
ClientResponse
clientResponse
=
resource
.
accept
(
MediaType
.
APPLICATION_JSON
)
.
type
(
MediaType
.
APPLICATION_JSON
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
Assert
.
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
String
responseAsString
=
clientResponse
.
getEntity
(
String
.
class
);
Assert
.
assertNotNull
(
responseAsString
);
System
.
out
.
println
(
"outputs graph= "
+
responseAsString
);
JSONObject
response
=
new
JSONObject
(
responseAsString
);
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
REQUEST_ID
));
JSONObject
results
=
response
.
getJSONObject
(
MetadataServiceClient
.
RESULTS
);
Assert
.
assertNotNull
(
results
);
JSONObject
values
=
results
.
getJSONObject
(
"values"
);
Assert
.
assertNotNull
(
values
);
final
JSONObject
vertices
=
values
.
getJSONObject
(
"vertices"
);
Assert
.
assertEquals
(
vertices
.
length
(),
3
);
final
JSONObject
edges
=
values
.
getJSONObject
(
"edges"
);
Assert
.
assertEquals
(
edges
.
length
(),
4
);
}
@Test
public
void
testSchema
()
throws
Exception
{
WebResource
resource
=
service
.
path
(
BASE_URI
)
...
...
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