@Ignore @Test public void testGet() throws Exception { getQueryStore().save(TestUtils.TEST_TABLE_NAME, TestUtils.getMappingDocuments(getMapper())); await().pollDelay(500, TimeUnit.MILLISECONDS).until(() -> true); Set<FieldMetadata> mappings = new HashSet<>(); mappings.add(FieldMetadata.builder() .field("time") .type(FieldType.LONG) .build()); mappings.add(FieldMetadata.builder() .field("word") .type(FieldType.STRING) .build()); mappings.add(FieldMetadata.builder() .field("data.data") .type(FieldType.STRING) .build()); mappings.add(FieldMetadata.builder() .field("header.hello") .type(FieldType.STRING) .build()); mappings.add(FieldMetadata.builder() .field("head.hello") .type(FieldType.LONG) .build()); mappings.add(FieldMetadata.builder() .field("date.dayOfWeek") .type(FieldType.LONG) .build()); mappings.add(FieldMetadata.builder() .field("date.minuteOfDay") .type(FieldType.LONG) .build()); mappings.add(FieldMetadata.builder() .field("date.monthOfYear") .type(FieldType.LONG) .build()); mappings.add(FieldMetadata.builder() .field("date.hourOfDay") .type(FieldType.LONG) .build()); mappings.add(FieldMetadata.builder() .field("date.year") .type(FieldType.LONG) .build()); mappings.add(FieldMetadata.builder() .field("date.dayOfMonth") .type(FieldType.LONG) .build()); mappings.add(FieldMetadata.builder() .field("date.minuteOfHour") .type(FieldType.LONG) .build()); TableFieldMapping tableFieldMapping = new TableFieldMapping(TestUtils.TEST_TABLE_NAME, mappings); String response = resources.client() .target(String.format("/v1/tables/%s/fields", TestUtils.TEST_TABLE_NAME)) .request() .get(String.class); TableFieldMapping mapping = getMapper().readValue(response, TableFieldMapping.class); assertEquals(tableFieldMapping.getTable(), mapping.getTable()); assertTrue(tableFieldMapping.getMappings() .equals(mapping.getMappings())); }
@GET @Timed @Path("/{name}/fields") @ApiOperation("Get fields") public Response get(@PathParam("name") final String table, @QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality, @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality) { return Response.ok(tableMetadataManager.getFieldMappings(table, withCardinality, calculateCardinality)) .build(); }
TableFieldMappingResource { @GET @Timed @Path("/{name}/fields") @ApiOperation("Get fields") public Response get(@PathParam("name") final String table, @QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality, @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality) { return Response.ok(tableMetadataManager.getFieldMappings(table, withCardinality, calculateCardinality)) .build(); } }
TableFieldMappingResource { @GET @Timed @Path("/{name}/fields") @ApiOperation("Get fields") public Response get(@PathParam("name") final String table, @QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality, @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality) { return Response.ok(tableMetadataManager.getFieldMappings(table, withCardinality, calculateCardinality)) .build(); } @Inject  TableFieldMappingResource(TableManager tableManager, TableMetadataManager tableMetadataManager); }
TableFieldMappingResource { @GET @Timed @Path("/{name}/fields") @ApiOperation("Get fields") public Response get(@PathParam("name") final String table, @QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality, @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality) { return Response.ok(tableMetadataManager.getFieldMappings(table, withCardinality, calculateCardinality)) .build(); } @Inject  TableFieldMappingResource(TableManager tableManager, TableMetadataManager tableMetadataManager); @GET @Timed @Path("/{name}/fields") @ApiOperation("Get fields") Response get(@PathParam("name") final String table,
                        @QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality,
                        @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality); @GET @Timed @Path("/fields") @ApiOperation("Get all Fields") Response getAllFields(@QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality,
                                 @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality); @POST @Timed @Path("/{name}/fields/update") @ApiOperation("Update Fields") Response updateEstimation(@PathParam("name") final String table, @QueryParam("time") @DefaultValue("0") long epoch); }
TableFieldMappingResource { @GET @Timed @Path("/{name}/fields") @ApiOperation("Get fields") public Response get(@PathParam("name") final String table, @QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality, @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality) { return Response.ok(tableMetadataManager.getFieldMappings(table, withCardinality, calculateCardinality)) .build(); } @Inject  TableFieldMappingResource(TableManager tableManager, TableMetadataManager tableMetadataManager); @GET @Timed @Path("/{name}/fields") @ApiOperation("Get fields") Response get(@PathParam("name") final String table,
                        @QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality,
                        @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality); @GET @Timed @Path("/fields") @ApiOperation("Get all Fields") Response getAllFields(@QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality,
                                 @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality); @POST @Timed @Path("/{name}/fields/update") @ApiOperation("Update Fields") Response updateEstimation(@PathParam("name") final String table, @QueryParam("time") @DefaultValue("0") long epoch);  }