You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@parquet.apache.org by "pitrou (via GitHub)" <gi...@apache.org> on 2024/01/18 11:26:08 UTC
[PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
pitrou opened a new pull request, #1255:
URL: https://github.com/apache/parquet-mr/pull/1255
(no comment)
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #1255:
URL: https://github.com/apache/parquet-mr/pull/1255#discussion_r1457543562
##########
parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestInterOpReadByteStreamSplit.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.parquet.hadoop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.parquet.example.data.Group;
+import org.apache.parquet.hadoop.example.GroupReadSupport;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestInterOpReadByteStreamSplit {
+ // The link includes a reference to a specific commit. To take a newer version - update this link.
+ private static final String PARQUET_TESTING_REPO = "https://github.com/apache/parquet-testing/raw/4cb3cff/data/";
+ private static String PARQUET_TESTING_PATH = "target/parquet-testing/data";
+ private static String FLOATS_FILE = "byte_stream_split.zstd.parquet";
+
+ private static final Logger LOG = LoggerFactory.getLogger(TestInterOpReadByteStreamSplit.class);
+ private OkHttpClient httpClient = new OkHttpClient();
+
+ @Test
+ public void testReadFloats() throws IOException {
+ Path rootPath = new Path(PARQUET_TESTING_PATH);
+
+ // Test simple parquet file with lz4 raw compressed
+ Path floatsFile = downloadInterOpFiles(rootPath, FLOATS_FILE, httpClient);
+ final int expectRows = 300;
+
+ try (ParquetReader<Group> reader =
+ ParquetReader.builder(new GroupReadSupport(), floatsFile).build()) {
+ for (int i = 0; i < expectRows; ++i) {
+ Group group = reader.read();
+ assertTrue(group != null);
+ float fval = group.getFloat("f32", 0);
+ double dval = group.getDouble("f64", 0);
+ // Values are from the normal distribution
+ assertTrue(Math.abs(fval) < 4.0);
+ assertTrue(Math.abs(dval) < 4.0);
+ switch (i) {
+ case 0:
+ assertEquals(1.7640524f, fval, 0.0);
+ assertEquals(-1.3065268517353166, dval, 0.0);
+ break;
+ case 1:
+ assertEquals(0.4001572f, fval, 0.0);
+ assertEquals(1.658130679618188, dval, 0.0);
+ break;
+ case expectRows - 2:
+ assertEquals(-0.39944902f, fval, 0.0);
+ assertEquals(-0.9301565025243212, dval, 0.0);
+ break;
+ case expectRows - 1:
+ assertEquals(0.37005588f, fval, 0.0);
+ assertEquals(-0.17858909208732915, dval, 0.0);
+ break;
+ }
+ }
+ assertTrue(reader.read() == null);
+ }
+ }
+
+ private Path downloadInterOpFiles(Path rootPath, String fileName, OkHttpClient httpClient) throws IOException {
Review Comment:
That would be deeply appreciated if you have the time to refactor. :)
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac merged PR #1255:
URL: https://github.com/apache/parquet-mr/pull/1255
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #1255:
URL: https://github.com/apache/parquet-mr/pull/1255#discussion_r1457311330
##########
parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestInterOpReadByteStreamSplit.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.parquet.hadoop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.parquet.example.data.Group;
+import org.apache.parquet.hadoop.example.GroupReadSupport;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestInterOpReadByteStreamSplit {
+ // The link includes a reference to a specific commit. To take a newer version - update this link.
+ private static final String PARQUET_TESTING_REPO = "https://github.com/apache/parquet-testing/raw/4cb3cff/data/";
+ private static String PARQUET_TESTING_PATH = "target/parquet-testing/data";
+ private static String FLOATS_FILE = "byte_stream_split.zstd.parquet";
+
+ private static final Logger LOG = LoggerFactory.getLogger(TestInterOpReadByteStreamSplit.class);
+ private OkHttpClient httpClient = new OkHttpClient();
+
+ @Test
+ public void testReadFloats() throws IOException {
+ Path rootPath = new Path(PARQUET_TESTING_PATH);
+
+ // Test simple parquet file with lz4 raw compressed
+ Path floatsFile = downloadInterOpFiles(rootPath, FLOATS_FILE, httpClient);
+ final int expectRows = 300;
+
+ try (ParquetReader<Group> reader =
+ ParquetReader.builder(new GroupReadSupport(), floatsFile).build()) {
+ for (int i = 0; i < expectRows; ++i) {
+ Group group = reader.read();
+ assertTrue(group != null);
+ float fval = group.getFloat("f32", 0);
+ double dval = group.getDouble("f64", 0);
+ // Values are from the normal distribution
+ assertTrue(Math.abs(fval) < 4.0);
+ assertTrue(Math.abs(dval) < 4.0);
+ switch (i) {
+ case 0:
+ assertEquals(1.7640524f, fval, 0.0);
+ assertEquals(-1.3065268517353166, dval, 0.0);
+ break;
+ case 1:
+ assertEquals(0.4001572f, fval, 0.0);
+ assertEquals(1.658130679618188, dval, 0.0);
+ break;
+ case expectRows - 2:
+ assertEquals(-0.39944902f, fval, 0.0);
+ assertEquals(-0.9301565025243212, dval, 0.0);
+ break;
+ case expectRows - 1:
+ assertEquals(0.37005588f, fval, 0.0);
+ assertEquals(-0.17858909208732915, dval, 0.0);
+ break;
+ }
+ }
+ assertTrue(reader.read() == null);
+ }
+ }
+
+ private Path downloadInterOpFiles(Path rootPath, String fileName, OkHttpClient httpClient) throws IOException {
Review Comment:
Sorry for the code duplication here (it seems copy-pasting this is a common pattern in the parquet-mr codebase). Should I try to refactor?
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #1255:
URL: https://github.com/apache/parquet-mr/pull/1255#discussion_r1458707357
##########
parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestEncryptionOptions.java:
##########
@@ -24,26 +24,10 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.Response;
+import java.util.*;
Review Comment:
Done.
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #1255:
URL: https://github.com/apache/parquet-mr/pull/1255#discussion_r1457655648
##########
parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestInterOpReadByteStreamSplit.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.parquet.hadoop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.parquet.example.data.Group;
+import org.apache.parquet.hadoop.example.GroupReadSupport;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestInterOpReadByteStreamSplit {
+ // The link includes a reference to a specific commit. To take a newer version - update this link.
+ private static final String PARQUET_TESTING_REPO = "https://github.com/apache/parquet-testing/raw/4cb3cff/data/";
+ private static String PARQUET_TESTING_PATH = "target/parquet-testing/data";
+ private static String FLOATS_FILE = "byte_stream_split.zstd.parquet";
+
+ private static final Logger LOG = LoggerFactory.getLogger(TestInterOpReadByteStreamSplit.class);
+ private OkHttpClient httpClient = new OkHttpClient();
+
+ @Test
+ public void testReadFloats() throws IOException {
+ Path rootPath = new Path(PARQUET_TESTING_PATH);
+
+ // Test simple parquet file with lz4 raw compressed
+ Path floatsFile = downloadInterOpFiles(rootPath, FLOATS_FILE, httpClient);
+ final int expectRows = 300;
+
+ try (ParquetReader<Group> reader =
+ ParquetReader.builder(new GroupReadSupport(), floatsFile).build()) {
+ for (int i = 0; i < expectRows; ++i) {
+ Group group = reader.read();
+ assertTrue(group != null);
+ float fval = group.getFloat("f32", 0);
+ double dval = group.getDouble("f64", 0);
+ // Values are from the normal distribution
+ assertTrue(Math.abs(fval) < 4.0);
+ assertTrue(Math.abs(dval) < 4.0);
+ switch (i) {
+ case 0:
+ assertEquals(1.7640524f, fval, 0.0);
+ assertEquals(-1.3065268517353166, dval, 0.0);
+ break;
+ case 1:
+ assertEquals(0.4001572f, fval, 0.0);
+ assertEquals(1.658130679618188, dval, 0.0);
+ break;
+ case expectRows - 2:
+ assertEquals(-0.39944902f, fval, 0.0);
+ assertEquals(-0.9301565025243212, dval, 0.0);
+ break;
+ case expectRows - 1:
+ assertEquals(0.37005588f, fval, 0.0);
+ assertEquals(-0.17858909208732915, dval, 0.0);
+ break;
+ }
+ }
+ assertTrue(reader.read() == null);
+ }
+ }
+
+ private Path downloadInterOpFiles(Path rootPath, String fileName, OkHttpClient httpClient) throws IOException {
Review Comment:
Done! Can you take a look again?
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #1255:
URL: https://github.com/apache/parquet-mr/pull/1255#discussion_r1458172277
##########
parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestEncryptionOptions.java:
##########
@@ -24,26 +24,10 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.Response;
+import java.util.*;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.apache.parquet.crypto.ColumnDecryptionProperties;
-import org.apache.parquet.crypto.ColumnEncryptionProperties;
-import org.apache.parquet.crypto.DecryptionKeyRetrieverMock;
-import org.apache.parquet.crypto.FileDecryptionProperties;
-import org.apache.parquet.crypto.FileEncryptionProperties;
-import org.apache.parquet.crypto.ParquetCipher;
-import org.apache.parquet.crypto.ParquetCryptoRuntimeException;
-import org.apache.parquet.crypto.SingleRow;
+import org.apache.parquet.crypto.*;
Review Comment:
ditto
##########
parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestEncryptionOptions.java:
##########
@@ -24,26 +24,10 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.Response;
+import java.util.*;
Review Comment:
Please avoid import *
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #1255:
URL: https://github.com/apache/parquet-mr/pull/1255#issuecomment-1898303823
cc @wgtmac @Fokko
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] PARQUET-2418: Add integration test for BYTE_STREAM_SPLIT [parquet-mr]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #1255:
URL: https://github.com/apache/parquet-mr/pull/1255#discussion_r1458700365
##########
parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestEncryptionOptions.java:
##########
@@ -24,26 +24,10 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.Response;
+import java.util.*;
Review Comment:
Sorry. This was done by IntelliJ as part of its (otherwise useful) import optimization feature. I'll try to change the settings.
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org