-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix using logiccal name instead of phsyical name to retireve availabi…
…lity data
- Loading branch information
Showing
19 changed files
with
253 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
.../src/main/java/com/yahoo/bard/webservice/table/resolver/PhysicalDataSourceConstraint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2017 Yahoo Inc. | ||
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms. | ||
package com.yahoo.bard.webservice.table.resolver; | ||
|
||
import com.yahoo.bard.webservice.table.Column; | ||
import com.yahoo.bard.webservice.table.PhysicalTableSchema; | ||
|
||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Data source constraint containing physical name of the columns. | ||
*/ | ||
public class PhysicalDataSourceConstraint extends DataSourceConstraint { | ||
|
||
private final Set<String> allColumnPhysicalNames; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param dataSourceConstraint Data source constraint containing all the column names as logical names | ||
* @param physicalTableSchema A map from logical column name to physical column names | ||
*/ | ||
public PhysicalDataSourceConstraint( | ||
DataSourceConstraint dataSourceConstraint, | ||
PhysicalTableSchema physicalTableSchema | ||
) { | ||
super(dataSourceConstraint); | ||
|
||
Set<String> schemaColumnNames = physicalTableSchema.getColumns().stream() | ||
.map(Column::getName) | ||
.collect(Collectors.toSet()); | ||
|
||
this.allColumnPhysicalNames = dataSourceConstraint.getAllColumnNames().stream() | ||
.filter(schemaColumnNames::contains) | ||
.map(physicalTableSchema::getPhysicalColumnName) | ||
.collect(Collectors.toSet()); | ||
} | ||
|
||
/** | ||
* Getter for the all column names as physical names. | ||
* | ||
* @return the physical name of all the columns | ||
*/ | ||
public Set<String> getAllColumnPhysicalNames() { | ||
return allColumnPhysicalNames; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.