Пример #1
0
  @Test
  public void testContinuousSettings() throws Exception {
    Map<String, Object> mb =
        ImmutableMap.<String, Object>builder()
            .put("inbound.column-names", ImmutableList.of("a", "b", "c", "d", "e"))
            .put("inbound.id-columns", ImmutableList.of("a"))
            .put("inbound.numeric-columns", ImmutableList.of(1, "e"))
            .put("inbound.ignored-columns", ImmutableList.of("c"))
            .build();
    Config conf = overlayConfigOnDefault(mb);
    InboundSettings settings = InboundSettings.create(conf);
    assertEquals(ImmutableList.of(0), ImmutableList.copyOf(settings.getIdColumns()));
    assertEquals(ImmutableList.of(3), ImmutableList.copyOf(settings.getCategoricalColumns()));
    assertEquals(ImmutableList.of(1, 4), ImmutableList.copyOf(settings.getNumericColumns()));
    assertEquals(ImmutableList.of(2), ImmutableList.copyOf(settings.getIgnoredColumns()));
    assertNull(settings.getTargetColumn());

    /*
    Spec spec = settings.getSpec();
    Assert.assertEquals(5, spec.size());
    Assert.assertEquals(DataType.STRING, spec.getField(0).spec().getDataType());
    Assert.assertEquals(DataType.DOUBLE, spec.getField(1).spec().getDataType());
    Assert.assertEquals(DataType.STRING, spec.getField(2).spec().getDataType());
     */
  }
Пример #2
0
 @Test
 public void testDefaults() throws Exception {
   Map<String, Object> mb =
       ImmutableMap.<String, Object>builder()
           .put("inbound.categorical-columns", ImmutableList.of())
           .build();
   Config conf = overlayConfigOnDefault(mb);
   InboundSettings settings = InboundSettings.create(conf);
   assertTrue(settings.getIdColumns().isEmpty());
   assertTrue(settings.getIgnoredColumns().isEmpty());
   // assertNull(settings.getSpec());
   assertTrue(settings.getCategoricalColumns().isEmpty());
   assertTrue(settings.getNumericColumns().isEmpty());
   assertEquals(Integer.valueOf(1729), settings.getLookupFunction().apply(1729));
   assertNull(settings.getTargetColumn());
 }