Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdks/java/extensions/sql/datacatalog/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import groovy.json.JsonOutput

plugins { id 'org.apache.beam.module' }

applyJavaNature(enableChecker:false,automaticModuleName: 'org.apache.beam.sdk.extensions.sql.datacatalog')
applyJavaNature(automaticModuleName: 'org.apache.beam.sdk.extensions.sql.datacatalog')

dependencies {
compile(library.java.google_cloud_datacatalog_v1beta1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Map<String, Table> getTables() {
}

@Override
public @Nullable Table getTableByFullName(TableName fullTableName) {
public Table getTableByFullName(TableName fullTableName) {

ImmutableList<String> allNameParts =
ImmutableList.<String>builder()
Expand All @@ -116,10 +116,14 @@ public Map<String, Table> getTables() {

@Override
public BeamSqlTable buildBeamSqlTable(Table table) {
return DELEGATE_PROVIDERS.get(table.getType()).buildBeamSqlTable(table);
TableProvider tableProvider = DELEGATE_PROVIDERS.get(table.getType());
if (tableProvider == null) {
throw new RuntimeException("TableProvider is null");
}
return tableProvider.buildBeamSqlTable(table);
}

private @Nullable Table loadTable(String tableName) {
private Table loadTable(String tableName) {
if (!tableCache.containsKey(tableName)) {
tableCache.put(tableName, loadTableFromDC(tableName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ public static Iterable<Object[]> dialects() {
});
}

@SuppressWarnings("initialization.fields.uninitialized")
@Parameterized.Parameter(0)
public String dialectName;

@SuppressWarnings("initialization.fields.uninitialized")
@Parameterized.Parameter(1)
public Class<? extends QueryPlanner> queryPlanner;

Expand All @@ -95,7 +97,7 @@ public void testRead() throws Exception {
readPipeline
.getOptions()
.as(BeamSqlPipelineOptions.class)
.setPlannerName(queryPlanner.getCanonicalName());
.setPlannerName(queryPlanner.getName());

try (DataCatalogTableProvider tableProvider =
DataCatalogTableProvider.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.SchemaPlus;
import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.SchemaVersion;
import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.Schemas;
import org.checkerframework.checker.nullness.qual.Nullable;

/** Adapter from {@link TableProvider} to {@link Schema}. */
public class BeamCalciteSchema implements Schema {
Expand Down Expand Up @@ -89,7 +90,7 @@ public Set<String> getTableNames() {
}

@Override
public RelProtoDataType getType(String name) {
public @Nullable RelProtoDataType getType(String name) {
return null;
}

Expand Down