Skip to content

Commit

Permalink
Move isSourceTable method into base IndexTable class.
Browse files Browse the repository at this point in the history
  • Loading branch information
marikomedlock committed Sep 13, 2024
1 parent 08e0983 commit e9580d9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public static SequencedJobSet getJobSetForGroupItems(

// If the relationship lives in an intermediate table, write the table to the index dataset.
// e.g. To allow joins between brand-ingredient.
if (groupItems.getGroupItemsRelationship().isIntermediateTable()) {
Relationship relationship = groupItems.getGroupItemsRelationship();
Relationship relationship = groupItems.getGroupItemsRelationship();
if (relationship.isIntermediateTable()) {
STRelationshipIdPairs sourceIdPairsTable =
underlay
.getSourceSchema()
Expand All @@ -169,10 +169,12 @@ public static SequencedJobSet getJobSetForGroupItems(
groupItems.getName(),
relationship.getEntityA().getName(),
relationship.getEntityB().getName());
jobSet.addJob(
new WriteRelationshipIntermediateTable(
indexerConfig, sourceIdPairsTable, indexIdPairsTable));
jobSet.startNewStage();
if (indexIdPairsTable.isGeneratedIndexTable()) {
jobSet.addJob(
new WriteRelationshipIntermediateTable(
indexerConfig, sourceIdPairsTable, indexIdPairsTable));
jobSet.startNewStage();
}
}

// Compute the criteria rollup counts for the group-items relationship.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ public SqlField getEntityIdField(String entity) {
return entity.equals(entityA) ? getEntityAIdField() : getEntityBIdField();
}

@Override
public boolean isGeneratedIndexTable() {
// TODO: Support using the source table instead of a generated index table for all IT* classes.
return sourceTable == null;
}

public enum Column {
ENTITY_A_ID(new ColumnSchema("entity_A_id", DataType.INT64)),
ENTITY_B_ID(new ColumnSchema("entity_B_id", DataType.INT64));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ public BQTable getTablePointer() {
}

public abstract ImmutableList<ColumnSchema> getColumnSchemas();

public boolean isGeneratedIndexTable() {
return true;
}
}

0 comments on commit e9580d9

Please sign in to comment.