Source:
public void testJsonRoundTrip() throws Exception { ImmutableList<HivePartitionKey> partitionKeys = ImmutableList.of(new HivePartitionKey("a", "apple"), new HivePartitionKey("b", "42")); ImmutableList<HostAddress> addresses = ImmutableList.of(HostAddress.fromParts("127.0.0.1", 44), HostAddress.fromParts("127.0.0.1", 45)); HiveSplit expected = new HiveSplit( "db", "table", "partitionId", "path", 42, 87, 88, new Storage( StorageFormat.create("serde", "input", "output"), "location", Optional.empty(), false, ImmutableMap.of()), partitionKeys, addresses, OptionalInt.empty(), OptionalInt.empty(), true, NodeSelectionStrategy.NO_PREFERENCE, 10, ImmutableMap.of(1, new Column("name", HIVE_STRING, Optional.empty())), Optional.of(new HiveSplit.BucketConversion( 32, 16, ImmutableList.of(new HiveColumnHandle("col", HIVE_LONG, BIGINT.getTypeSignature(), 5, ColumnType.REGULAR, Optional.of("comment"))))), false, Optional.empty()); JsonCodec<HiveSplit> codec = getJsonCodec(); String json = codec.toJson(expected); HiveSplit actual = codec.fromJson(json); assertEquals(actual.getDatabase(), expected.getDatabase()); assertEquals(actual.getTable(), expected.getTable()); assertEquals(actual.getPartitionName(), expected.getPartitionName()); assertEquals(actual.getPath(), expected.getPath()); assertEquals(actual.getStart(), expected.getStart()); assertEquals(actual.getLength(), expected.getLength()); assertEquals(actual.getFileSize(), expected.getFileSize()); assertEquals(actual.getStorage(), expected.getStorage()); assertEquals(actual.getPartitionKeys(), expected.getPartitionKeys()); assertEquals(actual.getAddresses(), expected.getAddresses()); assertEquals(actual.getPartitionDataColumnCount(), expected.getPartitionDataColumnCount()); assertEquals(actual.getPartitionSchemaDifference(), expected.getPartitionSchemaDifference()); assertEquals(actual.getBucketConversion(), expected.getBucketConversion()); assertEquals(actual.isForceLocalScheduling(), expected.isForceLocalScheduling()); assertEquals(actual.getNodeSelectionStrategy(), expected.getNodeSelectionStrategy()); assertEquals(actual.isS3SelectPushdownEnabled(), expected.isS3SelectPushdownEnabled()); }

Target:
public void testJsonRoundTrip() throws Exception { ImmutableList<HivePartitionKey> partitionKeys = ImmutableList.of(new HivePartitionKey("a", "apple"), new HivePartitionKey("b", "42")); ImmutableList<HostAddress> addresses = ImmutableList.of(HostAddress.fromParts("127.0.0.1", 44), HostAddress.fromParts("127.0.0.1", 45)); HiveSplit expected = new HiveSplit( "db", "table", "partitionId", "path", 42, 87, 88, new Storage( StorageFormat.create("serde", "input", "output"), "location", Optional.empty(), false, ImmutableMap.of()), partitionKeys, addresses, OptionalInt.empty(), OptionalInt.empty(), true, NO_PREFERENCE, 10, ImmutableMap.of(1, new Column("name", HIVE_STRING, Optional.empty())), Optional.of(new HiveSplit.BucketConversion( 32, 16, ImmutableList.of(new HiveColumnHandle("col", HIVE_LONG, BIGINT.getTypeSignature(), 5, ColumnType.REGULAR, Optional.of("comment"))))), false, Optional.empty()); JsonCodec<HiveSplit> codec = getJsonCodec(); String json = codec.toJson(expected); HiveSplit actual = codec.fromJson(json); assertEquals(actual.getDatabase(), expected.getDatabase()); assertEquals(actual.getTable(), expected.getTable()); assertEquals(actual.getPartitionName(), expected.getPartitionName()); assertEquals(actual.getPath(), expected.getPath()); assertEquals(actual.getStart(), expected.getStart()); assertEquals(actual.getLength(), expected.getLength()); assertEquals(actual.getFileSize(), expected.getFileSize()); assertEquals(actual.getStorage(), expected.getStorage()); assertEquals(actual.getPartitionKeys(), expected.getPartitionKeys()); assertEquals(actual.getAddresses(), expected.getAddresses()); assertEquals(actual.getPartitionDataColumnCount(), expected.getPartitionDataColumnCount()); assertEquals(actual.getPartitionSchemaDifference(), expected.getPartitionSchemaDifference()); assertEquals(actual.getBucketConversion(), expected.getBucketConversion()); assertEquals(actual.isForceLocalScheduling(), expected.isForceLocalScheduling()); assertEquals(actual.getNodeSelectionStrategy(), expected.getNodeSelectionStrategy()); assertEquals(actual.isS3SelectPushdownEnabled(), expected.isS3SelectPushdownEnabled()); }