Skip to content

Commit

Permalink
fix: hide TableReference data struct
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan0102 committed Aug 21, 2023
1 parent f8e3da7 commit ba2e7fd
Showing 1 changed file with 8 additions and 7 deletions.
Expand Up @@ -16,13 +16,14 @@

package com.google.cloud.bigquery;

import com.google.api.services.bigquery.model.TableReference;
import com.google.api.core.BetaApi;
import com.google.auto.value.AutoValue;
import java.io.Serializable;
import javax.annotation.Nullable;

/** Represents Reason of why the index was not used in a SQL search. */
@AutoValue
@BetaApi
public abstract class IndexUnusedReason implements Serializable {

@AutoValue.Builder
Expand Down Expand Up @@ -52,9 +53,9 @@ public abstract static class Builder {
/**
* Specifies the base table involved in the reason that no search index was used.
*
* @param tableReference tableReference or {@code null} for none
* @param baseTable baseTable or {@code null} for none
*/
public abstract Builder setBaseTable(TableReference tableReference);
public abstract Builder setBaseTableId(TableId baseTable);

/** Creates a @code IndexUnusedReason} object. */
public abstract IndexUnusedReason build();
Expand Down Expand Up @@ -96,7 +97,7 @@ public static Builder newBuilder() {
* @return value or {@code null} for none
*/
@Nullable
public abstract TableReference getBaseTable();
public abstract TableId getBaseTableId();

com.google.api.services.bigquery.model.IndexUnusedReason toPb() {
com.google.api.services.bigquery.model.IndexUnusedReason indexUnusedReason =
Expand All @@ -110,8 +111,8 @@ com.google.api.services.bigquery.model.IndexUnusedReason toPb() {
if (getMessage() != null) {
indexUnusedReason.setMessage(indexUnusedReason.getMessage());
}
if (getBaseTable() != null) {
indexUnusedReason.setBaseTable(indexUnusedReason.getBaseTable());
if (getBaseTableId() != null) {
indexUnusedReason.setBaseTable(getBaseTableId().toPb());
}
return indexUnusedReason;
}
Expand All @@ -129,7 +130,7 @@ static IndexUnusedReason fromPb(
builder.setMessage(indexUnusedReason.getMessage());
}
if (indexUnusedReason.getBaseTable() != null) {
builder.setBaseTable(indexUnusedReason.getBaseTable());
builder.setBaseTableId(TableId.fromPb(indexUnusedReason.getBaseTable()));
}
return builder.build();
}
Expand Down

0 comments on commit ba2e7fd

Please sign in to comment.