DataSetLineageService implements LineageService { @Override @GraphTransaction public String getSchemaForEntity(String guid) throws AtlasException { guid = ParamChecker.notEmpty(guid, "Entity id"); LOG.info("Fetching schema for entity guid={}", guid); String typeName = validateDatasetExists(guid); return getSchemaForId(typeName, guid); } @Inject  DataSetLineageService(MetadataRepository metadataRepository,
                          GraphBackedDiscoveryService discoveryService,
                          AtlasGraph atlasGraph); @Override @GraphTransaction String getOutputsGraph(String datasetName); @Override @GraphTransaction String getInputsGraph(String tableName); @Override @GraphTransaction String getInputsGraphForEntity(String guid); @Override @GraphTransaction String getOutputsGraphForEntity(String guid); @Override @GraphTransaction String getSchema(String datasetName); @Override @GraphTransaction String getSchemaForEntity(String guid); static final String SELECT_INSTANCE_GUID; static final String DATASET_SCHEMA_QUERY_PREFIX; }
@Test(enabled = false) public void testGetSchemaForEntityInvalidArguments(final String entityId, String expectedException) throws Exception { testInvalidArguments(expectedException, new Invoker() { @Override void run() throws AtlasException { lineageService.getSchemaForEntity(entityId); } }); }
@Test(enabled = false) public void testGetSchemaForEntity(String tableName, String expected) throws Exception { ITypedReferenceableInstance entity = repository.getEntityDefinition(HIVE_TABLE_TYPE, "name", tableName); JSONObject results = new JSONObject(lineageService.getSchemaForEntity(entity.getId()._getId())); assertNotNull(results); System.out.println("columns = " + results); JSONArray rows = results.getJSONArray("rows"); Assert.assertEquals(rows.length(), Integer.parseInt(expected)); for (int index = 0; index < rows.length(); index++) { assertColumn(rows.getJSONObject(index)); } }
@Test(enabled = false) public void testGetSchemaForDBEntity() throws Exception { String dbId = getEntityId(DATASET_SUBTYPE, "name", "dataSetSubTypeInst1"); JSONObject results = new JSONObject(lineageService.getSchemaForEntity(dbId)); }