Commit 6edfdb77 by Venkatesh Seetharam

Added name in hive lineage api.

parent b195719e
...@@ -50,6 +50,9 @@ public class HiveLineageService implements LineageService { ...@@ -50,6 +50,9 @@ public class HiveLineageService implements LineageService {
private static final String HIVE_PROCESS_INPUT_ATTRIBUTE_NAME = "inputTables"; private static final String HIVE_PROCESS_INPUT_ATTRIBUTE_NAME = "inputTables";
private static final String HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME = "outputTables"; private static final String HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME = "outputTables";
private static final Option<List<String>> SELECT_ATTRIBUTES =
Option.<List<String>>apply(List.<String>fromArray(new String[]{"name"}));
private final TitanGraph titanGraph; private final TitanGraph titanGraph;
private final DefaultGraphPersistenceStrategy graphPersistenceStrategy; private final DefaultGraphPersistenceStrategy graphPersistenceStrategy;
...@@ -74,7 +77,7 @@ public class HiveLineageService implements LineageService { ...@@ -74,7 +77,7 @@ public class HiveLineageService implements LineageService {
HiveWhereUsedQuery outputsQuery = new HiveWhereUsedQuery( HiveWhereUsedQuery outputsQuery = new HiveWhereUsedQuery(
HIVE_TABLE_TYPE_NAME, tableName, HIVE_PROCESS_TYPE_NAME, HIVE_TABLE_TYPE_NAME, tableName, HIVE_PROCESS_TYPE_NAME,
HIVE_PROCESS_INPUT_ATTRIBUTE_NAME, HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME, HIVE_PROCESS_INPUT_ATTRIBUTE_NAME, HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME,
Option.empty(), Option.<List<String>>empty(), true, Option.empty(), SELECT_ATTRIBUTES, true,
graphPersistenceStrategy, titanGraph); graphPersistenceStrategy, titanGraph);
Expressions.Expression expression = outputsQuery.expr(); Expressions.Expression expression = outputsQuery.expr();
...@@ -107,7 +110,7 @@ public class HiveLineageService implements LineageService { ...@@ -107,7 +110,7 @@ public class HiveLineageService implements LineageService {
HiveLineageQuery inputsQuery = new HiveLineageQuery( HiveLineageQuery inputsQuery = new HiveLineageQuery(
HIVE_TABLE_TYPE_NAME, tableName, HIVE_PROCESS_TYPE_NAME, HIVE_TABLE_TYPE_NAME, tableName, HIVE_PROCESS_TYPE_NAME,
HIVE_PROCESS_INPUT_ATTRIBUTE_NAME, HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME, HIVE_PROCESS_INPUT_ATTRIBUTE_NAME, HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME,
Option.empty(), Option.<List<String>>empty(), true, Option.empty(), SELECT_ATTRIBUTES, true,
graphPersistenceStrategy, titanGraph); graphPersistenceStrategy, titanGraph);
Expressions.Expression expression = inputsQuery.expr(); Expressions.Expression expression = inputsQuery.expr();
......
...@@ -21,12 +21,10 @@ package org.apache.hadoop.metadata.discovery.graph; ...@@ -21,12 +21,10 @@ package org.apache.hadoop.metadata.discovery.graph;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.TitanGraph;
import com.thinkaurelius.titan.core.TitanGraphQuery;
import com.thinkaurelius.titan.core.TitanProperty; import com.thinkaurelius.titan.core.TitanProperty;
import com.thinkaurelius.titan.core.TitanVertex; import com.thinkaurelius.titan.core.TitanVertex;
import com.thinkaurelius.titan.core.attribute.Text; import com.thinkaurelius.titan.core.attribute.Text;
import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.Vertex;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.metadata.discovery.DiscoveryException; import org.apache.hadoop.metadata.discovery.DiscoveryException;
import org.apache.hadoop.metadata.discovery.DiscoveryService; import org.apache.hadoop.metadata.discovery.DiscoveryService;
import org.apache.hadoop.metadata.query.Expressions; import org.apache.hadoop.metadata.query.Expressions;
...@@ -39,9 +37,6 @@ import org.apache.hadoop.metadata.query.QueryProcessor; ...@@ -39,9 +37,6 @@ import org.apache.hadoop.metadata.query.QueryProcessor;
import org.apache.hadoop.metadata.repository.Constants; import org.apache.hadoop.metadata.repository.Constants;
import org.apache.hadoop.metadata.repository.MetadataRepository; import org.apache.hadoop.metadata.repository.MetadataRepository;
import org.apache.hadoop.metadata.repository.graph.GraphProvider; import org.apache.hadoop.metadata.repository.graph.GraphProvider;
import org.apache.hadoop.metadata.typesystem.Referenceable;
import org.apache.hadoop.metadata.typesystem.json.InstanceSerialization;
import org.apache.hadoop.metadata.typesystem.types.TypeSystem;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import scala.util.Either; import scala.util.Either;
...@@ -54,11 +49,9 @@ import javax.script.ScriptEngineManager; ...@@ -54,11 +49,9 @@ import javax.script.ScriptEngineManager;
import javax.script.ScriptException; import javax.script.ScriptException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* Graph backed implementation of Search. * Graph backed implementation of Search.
......
...@@ -86,6 +86,10 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT { ...@@ -86,6 +86,10 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
JSONArray rows = results.getJSONArray("rows"); JSONArray rows = results.getJSONArray("rows");
Assert.assertTrue(rows.length() > 0); Assert.assertTrue(rows.length() > 0);
final JSONObject row = rows.getJSONObject(0);
JSONArray paths = row.getJSONArray("path");
Assert.assertTrue(paths.length() > 0);
} }
@Test @Test
...@@ -112,6 +116,10 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT { ...@@ -112,6 +116,10 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
JSONArray rows = results.getJSONArray("rows"); JSONArray rows = results.getJSONArray("rows");
Assert.assertTrue(rows.length() > 0); Assert.assertTrue(rows.length() > 0);
final JSONObject row = rows.getJSONObject(0);
JSONArray paths = row.getJSONArray("path");
Assert.assertTrue(paths.length() > 0);
} }
private void setUpTypes() throws Exception { private void setUpTypes() throws Exception {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment