keksmd commented on code in PR #975:
URL: https://github.com/apache/incubator-graphar/pull/975#discussion_r4094046271


##########
maven-projects/io-parquet/src/main/java/org/apache/graphar/io/parquet/ParquetOutputFile.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.graphar.io.parquet;
+
+import java.io.IOException;
+import java.util.Objects;
+import org.apache.graphar.storage.OutputFile;
+import org.apache.graphar.storage.PositionOutput;
+import org.apache.parquet.io.PositionOutputStream;
+
+/** Adapts a GraphAr storage output file to Parquet's output-file interface. */
+final class ParquetOutputFile implements org.apache.parquet.io.OutputFile {
+    private final OutputFile outputFile;
+
+    ParquetOutputFile(OutputFile outputFile) {
+        this.outputFile = Objects.requireNonNull(outputFile, "outputFile");
+    }
+
+    @Override
+    public PositionOutputStream create(long blockSizeHint) throws IOException {
+        return new ParquetPositionOutputStream(outputFile.create());
+    }
+
+    @Override
+    public PositionOutputStream createOrOverwrite(long blockSizeHint) throws 
IOException {
+        return new ParquetPositionOutputStream(outputFile.createOrOverwrite());
+    }
+
+    @Override
+    public boolean supportsBlockSize() {
+        return false;
+    }
+
+    @Override
+    public long defaultBlockSize() {
+        return 0;
+    }
+
+    @Override
+    public String getPath() {
+        return outputFile.uri().toString();
+    }
+
+    private static final class ParquetPositionOutputStream extends 
PositionOutputStream {
+        private final PositionOutput output;
+
+        private ParquetPositionOutputStream(PositionOutput output) {
+            this.output = output;
+        }
+
+        @Override
+        public long getPos() throws IOException {
+            return output.position();
+        }
+
+        @Override
+        public void write(int value) throws IOException {
+            output.write(new byte[] {(byte) value});

Review Comment:
   Fixed in eb0ad12: a per-stream one-byte buffer is reused. Both current 
`PositionOutput` implementations copy the bytes synchronously, so reuse is safe.



##########
maven-projects/io-parquet/pom.xml:
##########
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.graphar</groupId>
+        <artifactId>graphar-root</artifactId>
+        <version>${graphar.version}</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>graphar-io-parquet</artifactId>
+    <packaging>jar</packaging>
+    <version>${graphar.version}</version>
+
+    <name>graphar-io-parquet</name>
+
+    <properties>
+        <maven.compiler.source>11</maven.compiler.source>
+        <maven.compiler.target>11</maven.compiler.target>
+        <hadoop.version>3.3.0</hadoop.version>

Review Comment:
   3.3.0 was the Hadoop version parquet-java 1.18 itself compiles against 
(`provided` in its pom). Hadoop 3.5.0 is compiled for Java 17 (class file major 
61), which the SDK's Java 11 baseline cannot load. In eb0ad12 I replaced 
`hadoop-common` + `hadoop-mapreduce-client-core` with the shaded 
`hadoop-client-api` + `hadoop-client-runtime` 3.4.2 (latest Java 8/11 line): 
io-parquet's runtime classpath drops from 135 jars to 19, and Hadoop's own 
third-party dependencies are relocated, so they no longer conflict with 
consumers.



-- 
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