Skip to content

Commit

Permalink
[apache#5192][flink-connector]Support paimon catalog ddl operation
Browse files Browse the repository at this point in the history
  • Loading branch information
coolderli committed Oct 23, 2024
1 parent a60b199 commit 661b042
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
1 change: 1 addition & 0 deletions flink-connector/flink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies {
compileOnly("org.apache.flink:flink-connector-hive_$scalaVersion:$flinkVersion")
compileOnly("org.apache.flink:flink-table-common:$flinkVersion")
compileOnly("org.apache.flink:flink-table-api-java:$flinkVersion")
compileOnly(libs.paimon.flink)

compileOnly(libs.hive2.exec) {
artifact {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.gravitino.flink.connector.paimon;

import static org.apache.paimon.flink.FlinkCatalogOptions.DEFAULT_DATABASE;

import org.apache.flink.table.catalog.AbstractCatalog;
import org.apache.flink.table.factories.CatalogFactory;
import org.apache.gravitino.flink.connector.PartitionConverter;
import org.apache.gravitino.flink.connector.PropertiesConverter;
import org.apache.gravitino.flink.connector.catalog.BaseCatalog;
import org.apache.paimon.flink.FlinkGenericCatalog;
import org.apache.paimon.flink.FlinkGenericCatalogFactory;

public class GravitinoPaimonCatalog extends BaseCatalog {
private FlinkGenericCatalog paimonCatalog;

GravitinoPaimonCatalog(FlinkGenericCatalogFactory factory, CatalogFactory.Context context) {
super(context.getName(), context.getOptions().get(DEFAULT_DATABASE.key()));
this.paimonCatalog = factory.createCatalog(context);
}

@Override
protected AbstractCatalog realCatalog() {
return paimonCatalog;
}

@Override
protected PropertiesConverter getPropertiesConverter() {
return null;
}

@Override
protected PartitionConverter getPartitionConverter() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.gravitino.flink.connector.paimon;

import java.util.Set;
import org.apache.flink.configuration.ConfigOption;
import org.apache.flink.table.catalog.Catalog;
import org.apache.flink.table.factories.CatalogFactory;
import org.apache.paimon.flink.FlinkGenericCatalogFactory;

public class GravitinoPaimonCatalogFactory implements CatalogFactory {
private FlinkGenericCatalogFactory paimonCatalogFactory;

@Override
public Catalog createCatalog(Context context) {
this.paimonCatalogFactory = new FlinkGenericCatalogFactory();
return new GravitinoPaimonCatalog(paimonCatalogFactory, context);
}

@Override
public String factoryIdentifier() {
return paimonCatalogFactory.factoryIdentifier();
}

@Override
public Set<ConfigOption<?>> requiredOptions() {
return paimonCatalogFactory.requiredOptions();
}

@Override
public Set<ConfigOption<?>> optionalOptions() {
return paimonCatalogFactory.optionalOptions();
}
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ paimon-hive-catalog = { group = "org.apache.paimon", name = "paimon-hive-catalog
paimon-s3 = { group = "org.apache.paimon", name = "paimon-s3", version.ref = "paimon" }
paimon-oss = { group = "org.apache.paimon", name = "paimon-oss", version.ref = "paimon" }
paimon-spark = { group = "org.apache.paimon", name = "paimon-spark", version.ref = "paimon" }
paimon-flink = { group = "org.apache.paimon", name = "paimon-flink-common", version.ref = "paimon" }

trino-spi= { group = "io.trino", name = "trino-spi", version.ref = "trino" }
trino-testing= { group = "io.trino", name = "trino-testing", version.ref = "trino" }
Expand Down

0 comments on commit 661b042

Please sign in to comment.