Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
clairemcginty committed Dec 18, 2023
1 parent 1925d7e commit 875ae0e
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ public Map<Class<?>, Coder<?>> coderOverrides() {
}

@Override
public int hashPrimaryKeyMetadata() {
int hashPrimaryKeyMetadata() {
return Objects.hash(keyField, getKeyClass());
}

@Override
public int hashSecondaryKeyMetadata() {
int hashSecondaryKeyMetadata() {
return Objects.hash(keyFieldSecondary, getKeyClassSecondary());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ public Set<Class<? extends BucketMetadata>> compatibleMetadataTypes() {

public abstract K2 extractKeySecondary(V value);

public abstract int hashPrimaryKeyMetadata();
abstract int hashPrimaryKeyMetadata();

public abstract int hashSecondaryKeyMetadata();
abstract int hashSecondaryKeyMetadata();

public SortedBucketIO.ComparableKeyBytes primaryComparableKeyBytes(V value) {
return new SortedBucketIO.ComparableKeyBytes(getKeyBytesPrimary(value), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ public void populateDisplayData(Builder builder) {
}

@Override
public int hashPrimaryKeyMetadata() {
int hashPrimaryKeyMetadata() {
return Objects.hash(keyField, getKeyClass());
}

@Override
public int hashSecondaryKeyMetadata() {
int hashSecondaryKeyMetadata() {
return Objects.hash(keyFieldSecondary, getKeyClassSecondary());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ public void populateDisplayData(DisplayData.Builder builder) {
}

@Override
public int hashPrimaryKeyMetadata() {
int hashPrimaryKeyMetadata() {
return Objects.hash(keyField, getKeyClass());
}

@Override
public int hashSecondaryKeyMetadata() {
int hashSecondaryKeyMetadata() {
return Objects.hash(keyFieldSecondary, getKeyClassSecondary());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@ public Predicate<V> getPredicate() {
}

public Coder<V> getCoder() {
return directories.entrySet().iterator().next().getValue().getValue().getCoder();
final KV<String, FileOperations<V>> sampledSource =
directories.entrySet().iterator().next().getValue();
return sampledSource.getValue().getCoder();
}

static CoGbkResultSchema schemaOf(List<BucketedInput<?>> sources) {
Expand Down Expand Up @@ -523,13 +525,13 @@ long getOrSampleByteSize() {
entry -> {
// Take at most 10 buckets from the directory to sample
// Check for single-shard filenames template first, then multi-shard
final String filenameSuffix = entry.getValue().getKey();
List<Metadata> sampledFiles =
sampleDirectory(entry.getKey(), "*-0000?-of-?????" + entry.getValue().getKey());
sampleDirectory(entry.getKey(), "*-0000?-of-?????" + filenameSuffix);
if (sampledFiles.isEmpty()) {
sampledFiles =
sampleDirectory(
entry.getKey(),
"*-0000?-of-*-shard-00000-of-?????" + entry.getValue().getKey());
entry.getKey(), "*-0000?-of-*-shard-00000-of-?????" + filenameSuffix);
}

int numBuckets = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ public void populateDisplayData(Builder builder) {
}

@Override
public int hashPrimaryKeyMetadata() {
int hashPrimaryKeyMetadata() {
return Objects.hash(keyField, getKeyClass());
}

@Override
public int hashSecondaryKeyMetadata() {
int hashSecondaryKeyMetadata() {
return Objects.hash(keyFieldSecondary, getKeyClassSecondary());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public Void extractKeySecondary(Object value) {
}

@Override
public int hashPrimaryKeyMetadata() {
int hashPrimaryKeyMetadata() {
return -1;
}

@Override
public int hashSecondaryKeyMetadata() {
int hashSecondaryKeyMetadata() {
return -1;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ public Void extractKeySecondary(final String value) {
}

@Override
public int hashPrimaryKeyMetadata() {
int hashPrimaryKeyMetadata() {
return Objects.hash(getClass(), keyIndex);
}

@Override
public int hashSecondaryKeyMetadata() {
int hashSecondaryKeyMetadata() {
throw new IllegalArgumentException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ public String extractKeySecondary(final String value) {
}

@Override
public int hashPrimaryKeyMetadata() {
int hashPrimaryKeyMetadata() {
return Objects.hash(keyIndex);
}

@Override
public int hashSecondaryKeyMetadata() {
int hashSecondaryKeyMetadata() {
return Objects.hash(keyIndexSecondary);
}
}

0 comments on commit 875ae0e

Please sign in to comment.