Skip to content

Commit

Permalink
Merge branch 'main' into kafka-connect-pt1
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanck committed Dec 6, 2023
2 parents 9fed273 + 70ec4e5 commit f6e7bbd
Show file tree
Hide file tree
Showing 320 changed files with 14,767 additions and 1,845 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/iceberg_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ body:
description: What Apache Iceberg version are you using?
multiple: false
options:
- "1.4.1 (latest release)"
- "1.4.2 (latest release)"
- "1.4.1"
- "1.4.0"
- "1.3.1"
- "1.3.0"
Expand Down
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ updates:
interval: "weekly"
day: "sunday"
open-pull-requests-limit: 50
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
open-pull-requests-limit: 5

2 changes: 1 addition & 1 deletion .github/workflows/api-binary-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
#
# See https://github.com/actions/checkout/issues/124
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/delta-conversion-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flink-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/hive-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
Expand All @@ -86,7 +86,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/java-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
Expand All @@ -81,7 +81,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
Expand All @@ -91,7 +91,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jmh-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
with:
repository: ${{ github.event.inputs.repo }}
ref: ${{ github.event.inputs.ref }}
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
# we need to fetch all tags so that getProjectVersion() in build.gradle correctly determines the next SNAPSHOT version from the newest tag
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/recurring-jmh-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
with:
repository: ${{ github.event.inputs.repo }}
ref: ${{ github.event.inputs.ref }}
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/spark-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
Expand Down
5 changes: 5 additions & 0 deletions .palantir/revapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,11 @@ acceptedBreaks:
old: "method void org.apache.iceberg.encryption.Ciphers::<init>()"
new: "method void org.apache.iceberg.encryption.Ciphers::<init>()"
justification: "Static utility class - should not have public constructor"
"1.4.0":
org.apache.iceberg:iceberg-core:
- code: "java.field.serialVersionUIDChanged"
new: "field org.apache.iceberg.util.SerializableMap<K, V>.serialVersionUID"
justification: "Serialization is not be used"
apache-iceberg-0.14.0:
org.apache.iceberg:iceberg-api:
- code: "java.class.defaultSerializationChanged"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,44 @@
import java.util.Map;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
import org.apache.iceberg.relocated.com.google.common.collect.Maps;
import org.junit.Assert;
import org.junit.Test;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

public class TestAliyunClientFactories {

@Test
public void testLoadDefault() {
Assert.assertEquals(
"Default client should be singleton",
AliyunClientFactories.defaultFactory(),
AliyunClientFactories.defaultFactory());
Assertions.assertThat(AliyunClientFactories.defaultFactory())
.as("Default client should be singleton")
.isEqualTo(AliyunClientFactories.defaultFactory());

AliyunClientFactory defaultFactory = AliyunClientFactories.from(Maps.newHashMap());
Assert.assertTrue(
"Should load default when factory impl not configured",
defaultFactory instanceof AliyunClientFactories.DefaultAliyunClientFactory);
Assert.assertNull(
"Should have no Aliyun properties set", defaultFactory.aliyunProperties().accessKeyId());
Assertions.assertThat(defaultFactory)
.as("Should load default when factory impl not configured")
.isInstanceOf(AliyunClientFactories.DefaultAliyunClientFactory.class);

Assertions.assertThat(defaultFactory.aliyunProperties().accessKeyId())
.as("Should have no Aliyun properties set")
.isNull();

AliyunClientFactory defaultFactoryWithConfig =
AliyunClientFactories.from(ImmutableMap.of(AliyunProperties.CLIENT_ACCESS_KEY_ID, "key"));
Assert.assertTrue(
"Should load default when factory impl not configured",
defaultFactoryWithConfig instanceof AliyunClientFactories.DefaultAliyunClientFactory);
Assert.assertEquals(
"Should have access key set",
"key",
defaultFactoryWithConfig.aliyunProperties().accessKeyId());
Assertions.assertThat(defaultFactoryWithConfig)
.as("Should load default when factory impl not configured")
.isInstanceOf(AliyunClientFactories.DefaultAliyunClientFactory.class);

Assertions.assertThat(defaultFactoryWithConfig.aliyunProperties().accessKeyId())
.as("Should have access key set")
.isEqualTo("key");
}

@Test
public void testLoadCustom() {
Map<String, String> properties = Maps.newHashMap();
properties.put(AliyunProperties.CLIENT_FACTORY, CustomFactory.class.getName());
Assert.assertTrue(
"Should load custom class",
AliyunClientFactories.from(properties) instanceof CustomFactory);
Assertions.assertThat(AliyunClientFactories.from(properties))
.as("Should load custom class")
.isInstanceOf(CustomFactory.class);
}

public static class CustomFactory implements AliyunClientFactory {
Expand Down
27 changes: 14 additions & 13 deletions aliyun/src/test/java/org/apache/iceberg/aliyun/TestUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
package org.apache.iceberg.aliyun;

import org.apache.iceberg.aliyun.oss.AliyunOSSTestRule;
import org.apache.iceberg.aliyun.oss.AliyunOSSExtension;
import org.apache.iceberg.aliyun.oss.OSSURI;
import org.apache.iceberg.aliyun.oss.mock.AliyunOSSMockRule;
import org.apache.iceberg.aliyun.oss.mock.AliyunOSSMockExtension;
import org.apache.iceberg.common.DynConstructors;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
import org.apache.iceberg.relocated.com.google.common.base.Strings;
Expand All @@ -41,33 +41,34 @@ public class TestUtility {

private TestUtility() {}

public static AliyunOSSTestRule initialize() {
AliyunOSSTestRule testRule;
public static AliyunOSSExtension initialize() {
AliyunOSSExtension extension;

String implClass = System.getenv(ALIYUN_TEST_OSS_RULE_CLASS);
if (!Strings.isNullOrEmpty(implClass)) {
LOG.info("The initializing AliyunOSSTestRule implementation is: {}", implClass);
LOG.info("The initializing AliyunOSSExtension implementation is: {}", implClass);
try {
DynConstructors.Ctor<AliyunOSSTestRule> ctor =
DynConstructors.builder(AliyunOSSTestRule.class).impl(implClass).buildChecked();
testRule = ctor.newInstance();
DynConstructors.Ctor<AliyunOSSExtension> ctor =
DynConstructors.builder(AliyunOSSExtension.class).impl(implClass).buildChecked();
extension = ctor.newInstance();
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(
String.format(
"Cannot initialize AliyunOSSTestRule, missing no-arg constructor: %s", implClass),
"Cannot initialize AliyunOSSExtension, missing no-arg constructor: %s", implClass),
e);
} catch (ClassCastException e) {
throw new IllegalArgumentException(
String.format(
"Cannot initialize AliyunOSSTestRule, %s does not implement it.", implClass),
"Cannot initialize AliyunOSSExtension, %s does not implement it.", implClass),
e);
}
} else {
LOG.info("Initializing AliyunOSSTestRule implementation with default AliyunOSSMockRule");
testRule = AliyunOSSMockRule.builder().silent().build();
LOG.info(
"Initializing AliyunOSSExtension implementation with default AliyunOSSMockExtension");
extension = AliyunOSSMockExtension.builder().silent().build();
}

return testRule;
return extension;
}

public static String accessKeyId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@

import com.aliyun.oss.OSS;
import java.util.UUID;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

/**
* API for test Aliyun Object Storage Service (OSS) which is either local mock http server or remote
* aliyun oss server
*
* <p>This API includes start,stop OSS service, create OSS client, setup bucket and teardown bucket.
*/
public interface AliyunOSSTestRule extends TestRule {
public interface AliyunOSSExtension extends BeforeAllCallback, AfterAllCallback {
UUID RANDOM_UUID = java.util.UUID.randomUUID();

/** Returns a specific bucket name for testing purpose. */
Expand All @@ -39,18 +39,13 @@ default String testBucketName() {
}

@Override
default Statement apply(Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
start();
try {
base.evaluate();
} finally {
stop();
}
}
};
default void afterAll(ExtensionContext context) throws Exception {
stop();
}

@Override
default void beforeAll(ExtensionContext context) throws Exception {
start();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,26 @@
import com.aliyun.oss.OSS;
import org.apache.iceberg.aliyun.TestUtility;
import org.apache.iceberg.util.SerializableSupplier;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.RegisterExtension;

public abstract class AliyunOSSTestBase {
@ClassRule public static final AliyunOSSTestRule OSS_TEST_RULE = TestUtility.initialize();
@RegisterExtension
private static final AliyunOSSExtension OSS_TEST_EXTENSION = TestUtility.initialize();

private final SerializableSupplier<OSS> ossClient = OSS_TEST_RULE::createOSSClient;
private final String bucketName = OSS_TEST_RULE.testBucketName();
private final String keyPrefix = OSS_TEST_RULE.keyPrefix();
private final SerializableSupplier<OSS> ossClient = OSS_TEST_EXTENSION::createOSSClient;
private final String bucketName = OSS_TEST_EXTENSION.testBucketName();
private final String keyPrefix = OSS_TEST_EXTENSION.keyPrefix();

@Before
@BeforeEach
public void before() {
OSS_TEST_RULE.setUpBucket(bucketName);
OSS_TEST_EXTENSION.setUpBucket(bucketName);
}

@After
@AfterEach
public void after() {
OSS_TEST_RULE.tearDownBucket(bucketName);
OSS_TEST_EXTENSION.tearDownBucket(bucketName);
}

protected String location(String key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.iceberg.aliyun.TestUtility;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;

public class OSSIntegrationTestRule implements AliyunOSSTestRule {
public class OSSIntegrationExtension implements AliyunOSSExtension {
// Aliyun access key pair.
private String accessKeyId;
private String accessKeySecret;
Expand Down Expand Up @@ -106,7 +106,7 @@ public void tearDownBucket(String bucket) {

private OSS ossClient() {
if (lazyClient == null) {
synchronized (OSSIntegrationTestRule.class) {
synchronized (OSSIntegrationExtension.class) {
if (lazyClient == null) {
lazyClient = createOSSClient();
}
Expand Down
Loading

0 comments on commit f6e7bbd

Please sign in to comment.