DataSetLineageService implements LineageService { @Override @GraphTransaction public String getSchema(String datasetName) throws AtlasException { datasetName = ParamChecker.notEmpty(datasetName, "table name"); LOG.info("Fetching schema for tableName={}", datasetName); TypeUtils.Pair<String, String> typeIdPair = validateDatasetNameExists(datasetName); return getSchemaForId(typeIdPair.left, typeIdPair.right); } @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 testGetSchemaInvalidArguments(final String tableName, String expectedException) throws Exception { testInvalidArguments(expectedException, new Invoker() { @Override void run() throws AtlasException { lineageService.getSchema(tableName); } }); }
@Test(enabled = false) public void testGetSchema(String tableName, String expected) throws Exception { JSONObject results = getSchema(tableName); 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)); } }