wang-x-xia commented on a change in pull request #3376:
URL: https://github.com/apache/iceberg/pull/3376#discussion_r808803322



##########
File path: dell/src/main/java/org/apache/iceberg/dell/ecs/EcsURI.java
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.iceberg.dell.ecs;
+
+import java.net.URI;
+import java.util.Objects;
+import java.util.Set;
+import org.apache.iceberg.exceptions.ValidationException;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet;
+
+/**
+ * An immutable record class of ECS location
+ */
+class EcsURI {
+
+  private static final Set<String> VALID_SCHEME = ImmutableSet.of("ecs", "s3", 
"s3a", "s3n");
+
+  private final String location;
+  private final String bucket;
+  private final String name;
+
+  EcsURI(String location) {
+    Preconditions.checkNotNull(location == null, "Location %s can not be 
null", location);
+
+    this.location = location;
+
+    URI uri = URI.create(location);
+    ValidationException.check(
+        VALID_SCHEME.contains(uri.getScheme().toLowerCase()),
+        "Invalid ecs location: %s",
+        location);
+    this.bucket = uri.getHost();
+    this.name = uri.getPath().replaceAll("^/*", "");
+  }
+
+  EcsURI(String bucket, String name) {
+    this.location = String.format("ecs://%s/%s", bucket, name);
+    this.bucket = bucket;
+    this.name = name;
+  }
+
+  /**
+   * Returns ECS bucket name.
+   */
+  public String bucket() {
+    return bucket;
+  }
+
+  /**
+   * Returns ECS object name.
+   */
+  public String name() {
+    return name;
+  }
+
+  /**
+   * Returns original location.
+   */
+  public String location() {
+    return location;
+  }
+
+  @Override
+  public String toString() {
+    return location;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    EcsURI ecsURI = (EcsURI) o;
+    return Objects.equals(location, ecsURI.location) &&
+        Objects.equals(bucket, ecsURI.bucket) &&
+        Objects.equals(name, ecsURI.name);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(location, bucket, name);

Review comment:
       Also removed~

##########
File path: 
dell/src/main/java/org/apache/iceberg/dell/ecs/EcsAppendOutputStream.java
##########
@@ -0,0 +1,149 @@
+/*
+ * 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.iceberg.dell.ecs;
+
+import com.emc.object.s3.S3Client;
+import com.emc.object.s3.request.PutObjectRequest;
+import java.io.ByteArrayInputStream;
+import java.nio.ByteBuffer;
+import org.apache.iceberg.io.PositionOutputStream;
+
+/**
+ * Use ECS append API to write data.
+ */
+class EcsAppendOutputStream extends PositionOutputStream {
+
+  private final S3Client client;
+
+  private final EcsURI key;
+
+  /**
+   * Local bytes cache that avoid too many requests
+   * <p>
+   * Use {@link ByteBuffer} to maintain offset.
+   */
+  private final ByteBuffer localCache;
+
+  /**
+   * A marker for data file to put first part instead of append first part.
+   */
+  private boolean firstPart = true;
+
+  /**
+   * Pos for {@link PositionOutputStream}
+   */
+  private long pos;
+
+  private EcsAppendOutputStream(S3Client client, EcsURI key, byte[] 
localCache) {

Review comment:
       Changed!

##########
File path: build.gradle
##########
@@ -587,6 +587,25 @@ project(':iceberg-nessie') {
   }
 }
 
+project(':iceberg-dell') {
+  dependencies {
+    implementation project(':iceberg-core')
+    implementation project(':iceberg-common')
+    implementation project(path: ':iceberg-bundled-guava', configuration: 
'shadow')
+    compileOnly 'com.emc.ecs:object-client-bundle'
+
+    testImplementation project(path: ':iceberg-api', configuration: 
'testArtifacts')
+    testImplementation("org.apache.hadoop:hadoop-common") {
+      exclude group: 'org.apache.avro', module: 'avro'
+      exclude group: 'org.slf4j', module: 'slf4j-log4j12'
+    }
+    testImplementation 'com.emc.ecs:object-client-bundle'

Review comment:
       Removed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to