@Test public void testBackwardCompatibleMappingToPartitionStrategy() { Schema schema = new Schema.Parser().parse("{" + " \"type\": \"record\"," + " \"name\": \"User\"," + " \"fields\": [" + " {\"name\": \"id\", \"type\": \"long\", \"mapping\":" + " {\"type\": \"key\", \"value\": \"1\"} }," + " {\"name\": \"username\", \"type\": \"string\", \"mapping\":" + " {\"type\": \"key\", \"value\": \"0\"} }," + " {\"name\": \"real_name\", \"type\": \"string\", \"mapping\":" + " {\"type\": \"column\", \"value\": \"m:name\"} }" + " ]" + "}"); PartitionStrategy expected = new PartitionStrategy.Builder() .identity("username") .identity("id") .build(); DatasetDescriptor descriptor = new DatasetDescriptor.Builder() .schema(schema) .build(); Assert.assertEquals(expected, descriptor.getPartitionStrategy()); }
public PartitionStrategy getPartitionStrategy() { Preconditions .checkState( isPartitioned(), "Attempt to retrieve the partition strategy on a non-partitioned descriptor:%s", this); return partitionStrategy; }
DatasetDescriptor { public PartitionStrategy getPartitionStrategy() { Preconditions .checkState( isPartitioned(), "Attempt to retrieve the partition strategy on a non-partitioned descriptor:%s", this); return partitionStrategy; } }
DatasetDescriptor { public PartitionStrategy getPartitionStrategy() { Preconditions .checkState( isPartitioned(), "Attempt to retrieve the partition strategy on a non-partitioned descriptor:%s", this); return partitionStrategy; } DatasetDescriptor(Schema schema, @Nullable URL schemaUrl, Format format,
      @Nullable URI location, @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy);  DatasetDescriptor(Schema schema, @Nullable URL schemaUrl,
      Format format, @Nullable URI location,
      @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy,
      @Nullable ColumnMapping columnMapping);  DatasetDescriptor(Schema schema, @Nullable URI schemaUri,
      Format format, @Nullable URI location,
      @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy,
      @Nullable ColumnMapping columnMapping,
      @Nullable CompressionType compressionType); }
DatasetDescriptor { public PartitionStrategy getPartitionStrategy() { Preconditions .checkState( isPartitioned(), "Attempt to retrieve the partition strategy on a non-partitioned descriptor:%s", this); return partitionStrategy; } DatasetDescriptor(Schema schema, @Nullable URL schemaUrl, Format format,
      @Nullable URI location, @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy);  DatasetDescriptor(Schema schema, @Nullable URL schemaUrl,
      Format format, @Nullable URI location,
      @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy,
      @Nullable ColumnMapping columnMapping);  DatasetDescriptor(Schema schema, @Nullable URI schemaUri,
      Format format, @Nullable URI location,
      @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy,
      @Nullable ColumnMapping columnMapping,
      @Nullable CompressionType compressionType); Schema getSchema(); @Nullable URL getSchemaUrl(); Format getFormat(); @Nullable URI getLocation(); @Nullable String getProperty(String name); boolean hasProperty(String name); Collection<String> listProperties(); PartitionStrategy getPartitionStrategy(); ColumnMapping getColumnMapping(); CompressionType getCompressionType(); boolean isPartitioned(); boolean isColumnMapped(); @Override int hashCode(); @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value="NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION", justification="Default annotation is not correct for equals") boolean equals(@Nullable Object obj); @Override String toString(); }
DatasetDescriptor { public PartitionStrategy getPartitionStrategy() { Preconditions .checkState( isPartitioned(), "Attempt to retrieve the partition strategy on a non-partitioned descriptor:%s", this); return partitionStrategy; } DatasetDescriptor(Schema schema, @Nullable URL schemaUrl, Format format,
      @Nullable URI location, @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy);  DatasetDescriptor(Schema schema, @Nullable URL schemaUrl,
      Format format, @Nullable URI location,
      @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy,
      @Nullable ColumnMapping columnMapping);  DatasetDescriptor(Schema schema, @Nullable URI schemaUri,
      Format format, @Nullable URI location,
      @Nullable Map<String, String> properties,
      @Nullable PartitionStrategy partitionStrategy,
      @Nullable ColumnMapping columnMapping,
      @Nullable CompressionType compressionType); Schema getSchema(); @Nullable URL getSchemaUrl(); Format getFormat(); @Nullable URI getLocation(); @Nullable String getProperty(String name); boolean hasProperty(String name); Collection<String> listProperties(); PartitionStrategy getPartitionStrategy(); ColumnMapping getColumnMapping(); CompressionType getCompressionType(); boolean isPartitioned(); boolean isColumnMapped(); @Override int hashCode(); @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value="NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION", justification="Default annotation is not correct for equals") boolean equals(@Nullable Object obj); @Override String toString();  }