You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/12/21 17:11:06 UTC
[GitHub] [hive] abstractdog opened a new pull request #1798: HIVE-22944: Upgrade to Kryo5
abstractdog opened a new pull request #1798:
URL: https://github.com/apache/hive/pull/1798
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
3. Ensure you have added or run the appropriate tests for your PR:
4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX: Your PR title ...'.
5. Be sure to keep the PR description updated to reflect all changes.
6. Please write your PR title to summarize what this PR proposes.
7. If possible, provide a concise example to reproduce the issue for a faster review.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562095994
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/exec/spark/TestSparkInvalidFileFormat.java
##########
@@ -30,11 +30,13 @@
import org.apache.hadoop.hive.ql.session.SessionState;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
+@Ignore("HIVE-22944: Kryo 5 upgrade conflicts with Spark, which is not supported anymore")
Review comment:
yes, it is
maybe I could hack with that, but it would be painful: using kryo5 for tez execution and kryo4 for spark execution
##########
File path: itests/hive-jmh/src/main/java/org/apache/hive/benchmark/ql/exec/KryoBench.java
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.hive.benchmark.ql.exec;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
+import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
+import org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.BigRowInspector;
+import org.apache.hadoop.hive.ql.plan.MapWork;
+import org.apache.hadoop.hive.ql.plan.PartitionDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.plan.VectorPartitionDesc;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.StructField;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.mapred.JobConf;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import com.google.common.io.ByteStreams;
+
+@State(Scope.Benchmark)
+public class KryoBench {
+
+ @BenchmarkMode(Mode.AverageTime)
+ @Fork(1)
+ @State(Scope.Thread)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ public static class BaseBench {
+
+ private MapWork mapWork;
+
+ @Setup
+ public void setup() throws Exception {
+ mapWork = KryoBench.mockMapWork("my_table", 1000, new BigRowInspector());
+ }
+
+ @Benchmark
+ @Warmup(iterations = 2, time = 2, timeUnit = TimeUnit.SECONDS)
+ @Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS)
+ public void testSerializeMapWork() {
+ SerializationUtilities.serializePlan(mapWork, ByteStreams.nullOutputStream());
+ }
+ }
+
+ public static void main(String[] args) throws RunnerException {
Review comment:
there is a benchmark result kryo4 vs kryo5: https://issues.apache.org/jira/secure/attachment/13018768/kryo4_vs_5_benchmark.log
not an over-complicated MapWork, but contains 1000 partitions, which is the most weight of mapworks (+ a few columns)
##########
File path: pom.xml
##########
@@ -170,7 +170,9 @@
<junit.jupiter.version>5.6.2</junit.jupiter.version>
<junit.vintage.version>5.6.2</junit.vintage.version>
<kafka.version>2.5.0</kafka.version>
- <kryo.version>4.0.2</kryo.version>
+ <kryo.version>5.0.3</kryo.version>
+ <kryo4.version>4.0.2</kryo4.version> <!-- old kryo, for spark-client -->
Review comment:
is there a spark removal jira already?
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -278,7 +284,7 @@ public Kryo create() {
* @return kryo instance
*/
public static Kryo borrowKryo() {
- Kryo kryo = kryoPool.borrow();
+ Kryo kryo = kryoPool.obtain();
Review comment:
it's very unfortunate that kryo changed this method name without any reasons (or just I don't understand that :) )...we might want a method name that reflects the behavior of "getting a kryo instance from the pool", I don't have a strong opinion about that, but I'm not sure if we need to change a public method name because kryo changed theirs
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -224,51 +224,57 @@ public Registration readClass(Input input) {
private static final Object FAKE_REFERENCE = new Object();
- private static KryoFactory factory = new KryoFactory() {
- @Override
- public Kryo create() {
- KryoWithHooks kryo = new KryoWithHooks();
- kryo.register(java.sql.Date.class, new SqlDateSerializer());
- kryo.register(java.sql.Timestamp.class, new TimestampSerializer());
- kryo.register(TimestampTZ.class, new TimestampTZSerializer());
- kryo.register(Path.class, new PathSerializer());
- kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
- kryo.register(new java.util.ArrayList().subList(0,0).getClass(), new ArrayListSubListSerializer());
- kryo.register(CopyOnFirstWriteProperties.class, new CopyOnFirstWritePropertiesSerializer());
- kryo.register(PartitionDesc.class, new PartitionDescSerializer(kryo, PartitionDesc.class));
-
- ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
- .setFallbackInstantiatorStrategy(
- new StdInstantiatorStrategy());
- removeField(kryo, AbstractOperatorDesc.class, "colExprMap");
- removeField(kryo, AbstractOperatorDesc.class, "statistics");
- kryo.register(ReduceWork.class);
- kryo.register(TableDesc.class);
- kryo.register(UnionOperator.class);
- kryo.register(FileSinkOperator.class);
- kryo.register(VectorFileSinkOperator.class);
- kryo.register(HiveIgnoreKeyTextOutputFormat.class);
- kryo.register(StandardConstantListObjectInspector.class);
- kryo.register(StandardConstantMapObjectInspector.class);
- kryo.register(StandardConstantStructObjectInspector.class);
- kryo.register(SequenceFileInputFormat.class);
- kryo.register(RCFileInputFormat.class);
- kryo.register(HiveSequenceFileOutputFormat.class);
- kryo.register(LlapOutputFormat.class);
- kryo.register(SparkEdgeProperty.class);
- kryo.register(SparkWork.class);
- kryo.register(Pair.class);
- kryo.register(MemoryMonitorInfo.class);
-
- // This must be called after all the explicit register calls.
- return kryo.processHooks(kryoTypeHooks, globalHook);
- }
- };
-
// Bounded queue could be specified here but that will lead to blocking.
// ConcurrentLinkedQueue is unbounded and will release soft referenced kryo instances under
// memory pressure.
- private static KryoPool kryoPool = new KryoPool.Builder(factory).softReferences().build();
+ private static Pool<Kryo> kryoPool = new Pool<Kryo>(true, false, 8) {
+ protected Kryo create() {
+ return createNewKryo();
+ }
+ };
+
+ public static Kryo createNewKryo() {
+ KryoWithHooks kryo = new KryoWithHooks();
+
+ kryo.setReferences(true);
+ kryo.setCopyReferences(true);
+ kryo.setRegistrationRequired(false);
Review comment:
to be honest, because it works this way :) worst case I'll comment about what issues can come without these options set
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestConvertAstToSearchArg.java
##########
@@ -2855,16 +2836,26 @@ public void TestBigintSarg() throws Exception {
}
@Test
- public void TestBooleanSarg() throws Exception {
- String serialAst =
- "AQEAamF2YS51dGlsLkFycmF5TGlz9AECAQFvcmcuYXBhY2hlLmhhZG9vcC5oaXZlLnFsLnBsYW4uRXh" +
- "wck5vZGVHZW5lcmljRnVuY0Rlc+MBAQABAgECb3JnLmFwYWNoZS5oYWRvb3AuaGl2ZS5xbC5wbGFuLk" +
- "V4cHJOb2RlQ29sdW1uRGVz4wEBYrEAAAFib29sb3LjAQNvcmcuYXBhY2hlLmhhZG9vcC5oaXZlLnNlc" +
- "mRlMi50eXBlaW5mby5QcmltaXRpdmVUeXBlSW5m7wEBYm9vbGVh7gEEb3JnLmFwYWNoZS5oYWRvb3Au" +
- "aGl2ZS5xbC5wbGFuLkV4cHJOb2RlQ29uc3RhbnREZXPjAQEDCQUBAQVvcmcuYXBhY2hlLmhhZG9vcC5" +
- "oaXZlLnFsLnVkZi5nZW5lcmljLkdlbmVyaWNVREZPUEVxdWHsAQAAAYI9AUVRVUHMAQZvcmcuYXBhY2" +
- "hlLmhhZG9vcC5pby5Cb29sZWFuV3JpdGFibOUBAAABAwkBAgEBYrIAAAgBAwkBB29yZy5hcGFjaGUua" +
- "GFkb29wLmhpdmUucWwudWRmLmdlbmVyaWMuR2VuZXJpY1VERk9QQW7kAQEGAQAAAQMJ";
+ public void testBooleanSarg() throws Exception {
+ ExprNodeDesc column1 =
Review comment:
the reason I haven't do that is this case differs from others in the class as we have two columns, and this is the only case...however, I can do a utility method
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on pull request #1798:
URL: https://github.com/apache/hive/pull/1798#issuecomment-770839739
merged to master, thanks @pgaref for the review!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562103283
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestConvertAstToSearchArg.java
##########
@@ -2855,16 +2836,26 @@ public void TestBigintSarg() throws Exception {
}
@Test
- public void TestBooleanSarg() throws Exception {
- String serialAst =
- "AQEAamF2YS51dGlsLkFycmF5TGlz9AECAQFvcmcuYXBhY2hlLmhhZG9vcC5oaXZlLnFsLnBsYW4uRXh" +
- "wck5vZGVHZW5lcmljRnVuY0Rlc+MBAQABAgECb3JnLmFwYWNoZS5oYWRvb3AuaGl2ZS5xbC5wbGFuLk" +
- "V4cHJOb2RlQ29sdW1uRGVz4wEBYrEAAAFib29sb3LjAQNvcmcuYXBhY2hlLmhhZG9vcC5oaXZlLnNlc" +
- "mRlMi50eXBlaW5mby5QcmltaXRpdmVUeXBlSW5m7wEBYm9vbGVh7gEEb3JnLmFwYWNoZS5oYWRvb3Au" +
- "aGl2ZS5xbC5wbGFuLkV4cHJOb2RlQ29uc3RhbnREZXPjAQEDCQUBAQVvcmcuYXBhY2hlLmhhZG9vcC5" +
- "oaXZlLnFsLnVkZi5nZW5lcmljLkdlbmVyaWNVREZPUEVxdWHsAQAAAYI9AUVRVUHMAQZvcmcuYXBhY2" +
- "hlLmhhZG9vcC5pby5Cb29sZWFuV3JpdGFibOUBAAABAwkBAgEBYrIAAAgBAwkBB29yZy5hcGFjaGUua" +
- "GFkb29wLmhpdmUucWwudWRmLmdlbmVyaWMuR2VuZXJpY1VERk9QQW7kAQEGAQAAAQMJ";
+ public void testBooleanSarg() throws Exception {
+ ExprNodeDesc column1 =
Review comment:
the reason I haven't do that is this case differs from others in the class as we have two columns, and this is the only case...however, I can do a utility method
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] pgaref commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562072942
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestConvertAstToSearchArg.java
##########
@@ -2855,16 +2836,26 @@ public void TestBigintSarg() throws Exception {
}
@Test
- public void TestBooleanSarg() throws Exception {
- String serialAst =
- "AQEAamF2YS51dGlsLkFycmF5TGlz9AECAQFvcmcuYXBhY2hlLmhhZG9vcC5oaXZlLnFsLnBsYW4uRXh" +
- "wck5vZGVHZW5lcmljRnVuY0Rlc+MBAQABAgECb3JnLmFwYWNoZS5oYWRvb3AuaGl2ZS5xbC5wbGFuLk" +
- "V4cHJOb2RlQ29sdW1uRGVz4wEBYrEAAAFib29sb3LjAQNvcmcuYXBhY2hlLmhhZG9vcC5oaXZlLnNlc" +
- "mRlMi50eXBlaW5mby5QcmltaXRpdmVUeXBlSW5m7wEBYm9vbGVh7gEEb3JnLmFwYWNoZS5oYWRvb3Au" +
- "aGl2ZS5xbC5wbGFuLkV4cHJOb2RlQ29uc3RhbnREZXPjAQEDCQUBAQVvcmcuYXBhY2hlLmhhZG9vcC5" +
- "oaXZlLnFsLnVkZi5nZW5lcmljLkdlbmVyaWNVREZPUEVxdWHsAQAAAYI9AUVRVUHMAQZvcmcuYXBhY2" +
- "hlLmhhZG9vcC5pby5Cb29sZWFuV3JpdGFibOUBAAABAwkBAgEBYrIAAAgBAwkBB29yZy5hcGFjaGUua" +
- "GFkb29wLmhpdmUucWwudWRmLmdlbmVyaWMuR2VuZXJpY1VERk9QQW7kAQEGAQAAAQMJ";
+ public void testBooleanSarg() throws Exception {
+ ExprNodeDesc column1 =
Review comment:
nit: maybe move Sarg Expr creation to separate method for consistency?
##########
File path: pom.xml
##########
@@ -170,7 +170,9 @@
<junit.jupiter.version>5.6.2</junit.jupiter.version>
<junit.vintage.version>5.6.2</junit.vintage.version>
<kafka.version>2.5.0</kafka.version>
- <kryo.version>4.0.2</kryo.version>
+ <kryo.version>5.0.3</kryo.version>
+ <kryo4.version>4.0.2</kryo4.version> <!-- old kryo, for spark-client -->
Review comment:
Add a comment linking to Spark removal JIRA as a TODO?
##########
File path: itests/hive-jmh/src/main/java/org/apache/hive/benchmark/ql/exec/KryoBench.java
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.hive.benchmark.ql.exec;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
+import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
+import org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.BigRowInspector;
+import org.apache.hadoop.hive.ql.plan.MapWork;
+import org.apache.hadoop.hive.ql.plan.PartitionDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.plan.VectorPartitionDesc;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.StructField;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.mapred.JobConf;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import com.google.common.io.ByteStreams;
+
+@State(Scope.Benchmark)
+public class KryoBench {
+
+ @BenchmarkMode(Mode.AverageTime)
+ @Fork(1)
+ @State(Scope.Thread)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ public static class BaseBench {
+
+ private MapWork mapWork;
+
+ @Setup
+ public void setup() throws Exception {
+ mapWork = KryoBench.mockMapWork("my_table", 1000, new BigRowInspector());
+ }
+
+ @Benchmark
+ @Warmup(iterations = 2, time = 2, timeUnit = TimeUnit.SECONDS)
+ @Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS)
+ public void testSerializeMapWork() {
+ SerializationUtilities.serializePlan(mapWork, ByteStreams.nullOutputStream());
+ }
+ }
+
+ public static void main(String[] args) throws RunnerException {
Review comment:
This is cool! Shall we add a more complex Map for bench here and a perf number for reference?
Maybe previous kryo4 vs kryo5?
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -224,51 +224,57 @@ public Registration readClass(Input input) {
private static final Object FAKE_REFERENCE = new Object();
- private static KryoFactory factory = new KryoFactory() {
- @Override
- public Kryo create() {
- KryoWithHooks kryo = new KryoWithHooks();
- kryo.register(java.sql.Date.class, new SqlDateSerializer());
- kryo.register(java.sql.Timestamp.class, new TimestampSerializer());
- kryo.register(TimestampTZ.class, new TimestampTZSerializer());
- kryo.register(Path.class, new PathSerializer());
- kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
- kryo.register(new java.util.ArrayList().subList(0,0).getClass(), new ArrayListSubListSerializer());
- kryo.register(CopyOnFirstWriteProperties.class, new CopyOnFirstWritePropertiesSerializer());
- kryo.register(PartitionDesc.class, new PartitionDescSerializer(kryo, PartitionDesc.class));
-
- ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
- .setFallbackInstantiatorStrategy(
- new StdInstantiatorStrategy());
- removeField(kryo, AbstractOperatorDesc.class, "colExprMap");
- removeField(kryo, AbstractOperatorDesc.class, "statistics");
- kryo.register(ReduceWork.class);
- kryo.register(TableDesc.class);
- kryo.register(UnionOperator.class);
- kryo.register(FileSinkOperator.class);
- kryo.register(VectorFileSinkOperator.class);
- kryo.register(HiveIgnoreKeyTextOutputFormat.class);
- kryo.register(StandardConstantListObjectInspector.class);
- kryo.register(StandardConstantMapObjectInspector.class);
- kryo.register(StandardConstantStructObjectInspector.class);
- kryo.register(SequenceFileInputFormat.class);
- kryo.register(RCFileInputFormat.class);
- kryo.register(HiveSequenceFileOutputFormat.class);
- kryo.register(LlapOutputFormat.class);
- kryo.register(SparkEdgeProperty.class);
- kryo.register(SparkWork.class);
- kryo.register(Pair.class);
- kryo.register(MemoryMonitorInfo.class);
-
- // This must be called after all the explicit register calls.
- return kryo.processHooks(kryoTypeHooks, globalHook);
- }
- };
-
// Bounded queue could be specified here but that will lead to blocking.
// ConcurrentLinkedQueue is unbounded and will release soft referenced kryo instances under
// memory pressure.
- private static KryoPool kryoPool = new KryoPool.Builder(factory).softReferences().build();
+ private static Pool<Kryo> kryoPool = new Pool<Kryo>(true, false, 8) {
+ protected Kryo create() {
+ return createNewKryo();
+ }
+ };
+
+ public static Kryo createNewKryo() {
+ KryoWithHooks kryo = new KryoWithHooks();
+
+ kryo.setReferences(true);
+ kryo.setCopyReferences(true);
+ kryo.setRegistrationRequired(false);
Review comment:
Maybe add a comment why the above 3 lines are needed?
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -278,7 +284,7 @@ public Kryo create() {
* @return kryo instance
*/
public static Kryo borrowKryo() {
- Kryo kryo = kryoPool.borrow();
+ Kryo kryo = kryoPool.obtain();
Review comment:
Maybe rename the method itself here as well? something like obtainKryo() ?
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/exec/spark/TestSparkInvalidFileFormat.java
##########
@@ -30,11 +30,13 @@
import org.apache.hadoop.hive.ql.session.SessionState;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
+@Ignore("HIVE-22944: Kryo 5 upgrade conflicts with Spark, which is not supported anymore")
Review comment:
Does this mean this is a breaking change for Spark?
##########
File path: pom.xml
##########
@@ -170,7 +170,9 @@
<junit.jupiter.version>5.6.2</junit.jupiter.version>
<junit.vintage.version>5.6.2</junit.vintage.version>
<kafka.version>2.5.0</kafka.version>
- <kryo.version>4.0.2</kryo.version>
+ <kryo.version>5.0.3</kryo.version>
+ <kryo4.version>4.0.2</kryo4.version> <!-- old kryo, for spark-client -->
Review comment:
sure, that would be HIVE-23885
##########
File path: itests/hive-jmh/src/main/java/org/apache/hive/benchmark/ql/exec/KryoBench.java
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.hive.benchmark.ql.exec;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
+import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
+import org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.BigRowInspector;
+import org.apache.hadoop.hive.ql.plan.MapWork;
+import org.apache.hadoop.hive.ql.plan.PartitionDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.plan.VectorPartitionDesc;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.StructField;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.mapred.JobConf;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import com.google.common.io.ByteStreams;
+
+@State(Scope.Benchmark)
+public class KryoBench {
+
+ @BenchmarkMode(Mode.AverageTime)
+ @Fork(1)
+ @State(Scope.Thread)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ public static class BaseBench {
+
+ private MapWork mapWork;
+
+ @Setup
+ public void setup() throws Exception {
+ mapWork = KryoBench.mockMapWork("my_table", 1000, new BigRowInspector());
+ }
+
+ @Benchmark
+ @Warmup(iterations = 2, time = 2, timeUnit = TimeUnit.SECONDS)
+ @Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS)
+ public void testSerializeMapWork() {
+ SerializationUtilities.serializePlan(mapWork, ByteStreams.nullOutputStream());
+ }
+ }
+
+ public static void main(String[] args) throws RunnerException {
Review comment:
Nice, I missed that -- the numbers are only for 5 though right?
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -224,51 +224,57 @@ public Registration readClass(Input input) {
private static final Object FAKE_REFERENCE = new Object();
- private static KryoFactory factory = new KryoFactory() {
- @Override
- public Kryo create() {
- KryoWithHooks kryo = new KryoWithHooks();
- kryo.register(java.sql.Date.class, new SqlDateSerializer());
- kryo.register(java.sql.Timestamp.class, new TimestampSerializer());
- kryo.register(TimestampTZ.class, new TimestampTZSerializer());
- kryo.register(Path.class, new PathSerializer());
- kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
- kryo.register(new java.util.ArrayList().subList(0,0).getClass(), new ArrayListSubListSerializer());
- kryo.register(CopyOnFirstWriteProperties.class, new CopyOnFirstWritePropertiesSerializer());
- kryo.register(PartitionDesc.class, new PartitionDescSerializer(kryo, PartitionDesc.class));
-
- ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
- .setFallbackInstantiatorStrategy(
- new StdInstantiatorStrategy());
- removeField(kryo, AbstractOperatorDesc.class, "colExprMap");
- removeField(kryo, AbstractOperatorDesc.class, "statistics");
- kryo.register(ReduceWork.class);
- kryo.register(TableDesc.class);
- kryo.register(UnionOperator.class);
- kryo.register(FileSinkOperator.class);
- kryo.register(VectorFileSinkOperator.class);
- kryo.register(HiveIgnoreKeyTextOutputFormat.class);
- kryo.register(StandardConstantListObjectInspector.class);
- kryo.register(StandardConstantMapObjectInspector.class);
- kryo.register(StandardConstantStructObjectInspector.class);
- kryo.register(SequenceFileInputFormat.class);
- kryo.register(RCFileInputFormat.class);
- kryo.register(HiveSequenceFileOutputFormat.class);
- kryo.register(LlapOutputFormat.class);
- kryo.register(SparkEdgeProperty.class);
- kryo.register(SparkWork.class);
- kryo.register(Pair.class);
- kryo.register(MemoryMonitorInfo.class);
-
- // This must be called after all the explicit register calls.
- return kryo.processHooks(kryoTypeHooks, globalHook);
- }
- };
-
// Bounded queue could be specified here but that will lead to blocking.
// ConcurrentLinkedQueue is unbounded and will release soft referenced kryo instances under
// memory pressure.
- private static KryoPool kryoPool = new KryoPool.Builder(factory).softReferences().build();
+ private static Pool<Kryo> kryoPool = new Pool<Kryo>(true, false, 8) {
+ protected Kryo create() {
+ return createNewKryo();
+ }
+ };
+
+ public static Kryo createNewKryo() {
+ KryoWithHooks kryo = new KryoWithHooks();
+
+ kryo.setReferences(true);
+ kryo.setCopyReferences(true);
+ kryo.setRegistrationRequired(false);
Review comment:
Sure, makes sense!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog removed a comment on pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog removed a comment on pull request #1798:
URL: https://github.com/apache/hive/pull/1798#issuecomment-773994032
cc: @rbalamohan
find attached test in commit
```
Benchmark Mode Cnt Score Error Units
HiveCharBench.BaseBench.testStrippedValueNew avgt 10 0.299 ± 0.017 ms/op
HiveCharBench.BaseBench.testStrippedValueOld avgt 10 1.523 ± 0.041 ms/op
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r563830614
##########
File path: itests/hive-jmh/src/main/java/org/apache/hive/benchmark/ql/exec/KryoBench.java
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.hive.benchmark.ql.exec;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
+import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
+import org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.BigRowInspector;
+import org.apache.hadoop.hive.ql.plan.MapWork;
+import org.apache.hadoop.hive.ql.plan.PartitionDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.plan.VectorPartitionDesc;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.StructField;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.mapred.JobConf;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import com.google.common.io.ByteStreams;
+
+@State(Scope.Benchmark)
+public class KryoBench {
+
+ @BenchmarkMode(Mode.AverageTime)
+ @Fork(1)
+ @State(Scope.Thread)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ public static class BaseBench {
+
+ private MapWork mapWork;
+
+ @Setup
+ public void setup() throws Exception {
+ mapWork = KryoBench.mockMapWork("my_table", 1000, new BigRowInspector());
+ }
+
+ @Benchmark
+ @Warmup(iterations = 2, time = 2, timeUnit = TimeUnit.SECONDS)
+ @Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS)
+ public void testSerializeMapWork() {
+ SerializationUtilities.serializePlan(mapWork, ByteStreams.nullOutputStream());
+ }
+ }
+
+ public static void main(String[] args) throws RunnerException {
Review comment:
it's an edited file, scroll down in it for kryo4 results
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562098820
##########
File path: pom.xml
##########
@@ -170,7 +170,9 @@
<junit.jupiter.version>5.6.2</junit.jupiter.version>
<junit.vintage.version>5.6.2</junit.vintage.version>
<kafka.version>2.5.0</kafka.version>
- <kryo.version>4.0.2</kryo.version>
+ <kryo.version>5.0.3</kryo.version>
+ <kryo4.version>4.0.2</kryo4.version> <!-- old kryo, for spark-client -->
Review comment:
is there a spark removal jira already?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] pgaref commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562072942
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestConvertAstToSearchArg.java
##########
@@ -2855,16 +2836,26 @@ public void TestBigintSarg() throws Exception {
}
@Test
- public void TestBooleanSarg() throws Exception {
- String serialAst =
- "AQEAamF2YS51dGlsLkFycmF5TGlz9AECAQFvcmcuYXBhY2hlLmhhZG9vcC5oaXZlLnFsLnBsYW4uRXh" +
- "wck5vZGVHZW5lcmljRnVuY0Rlc+MBAQABAgECb3JnLmFwYWNoZS5oYWRvb3AuaGl2ZS5xbC5wbGFuLk" +
- "V4cHJOb2RlQ29sdW1uRGVz4wEBYrEAAAFib29sb3LjAQNvcmcuYXBhY2hlLmhhZG9vcC5oaXZlLnNlc" +
- "mRlMi50eXBlaW5mby5QcmltaXRpdmVUeXBlSW5m7wEBYm9vbGVh7gEEb3JnLmFwYWNoZS5oYWRvb3Au" +
- "aGl2ZS5xbC5wbGFuLkV4cHJOb2RlQ29uc3RhbnREZXPjAQEDCQUBAQVvcmcuYXBhY2hlLmhhZG9vcC5" +
- "oaXZlLnFsLnVkZi5nZW5lcmljLkdlbmVyaWNVREZPUEVxdWHsAQAAAYI9AUVRVUHMAQZvcmcuYXBhY2" +
- "hlLmhhZG9vcC5pby5Cb29sZWFuV3JpdGFibOUBAAABAwkBAgEBYrIAAAgBAwkBB29yZy5hcGFjaGUua" +
- "GFkb29wLmhpdmUucWwudWRmLmdlbmVyaWMuR2VuZXJpY1VERk9QQW7kAQEGAQAAAQMJ";
+ public void testBooleanSarg() throws Exception {
+ ExprNodeDesc column1 =
Review comment:
nit: maybe move Sarg Expr creation to separate method for consistency?
##########
File path: pom.xml
##########
@@ -170,7 +170,9 @@
<junit.jupiter.version>5.6.2</junit.jupiter.version>
<junit.vintage.version>5.6.2</junit.vintage.version>
<kafka.version>2.5.0</kafka.version>
- <kryo.version>4.0.2</kryo.version>
+ <kryo.version>5.0.3</kryo.version>
+ <kryo4.version>4.0.2</kryo4.version> <!-- old kryo, for spark-client -->
Review comment:
Add a comment linking to Spark removal JIRA as a TODO?
##########
File path: itests/hive-jmh/src/main/java/org/apache/hive/benchmark/ql/exec/KryoBench.java
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.hive.benchmark.ql.exec;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
+import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
+import org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.BigRowInspector;
+import org.apache.hadoop.hive.ql.plan.MapWork;
+import org.apache.hadoop.hive.ql.plan.PartitionDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.plan.VectorPartitionDesc;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.StructField;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.mapred.JobConf;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import com.google.common.io.ByteStreams;
+
+@State(Scope.Benchmark)
+public class KryoBench {
+
+ @BenchmarkMode(Mode.AverageTime)
+ @Fork(1)
+ @State(Scope.Thread)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ public static class BaseBench {
+
+ private MapWork mapWork;
+
+ @Setup
+ public void setup() throws Exception {
+ mapWork = KryoBench.mockMapWork("my_table", 1000, new BigRowInspector());
+ }
+
+ @Benchmark
+ @Warmup(iterations = 2, time = 2, timeUnit = TimeUnit.SECONDS)
+ @Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS)
+ public void testSerializeMapWork() {
+ SerializationUtilities.serializePlan(mapWork, ByteStreams.nullOutputStream());
+ }
+ }
+
+ public static void main(String[] args) throws RunnerException {
Review comment:
This is cool! Shall we add a more complex Map for bench here and a perf number for reference?
Maybe previous kryo4 vs kryo5?
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -224,51 +224,57 @@ public Registration readClass(Input input) {
private static final Object FAKE_REFERENCE = new Object();
- private static KryoFactory factory = new KryoFactory() {
- @Override
- public Kryo create() {
- KryoWithHooks kryo = new KryoWithHooks();
- kryo.register(java.sql.Date.class, new SqlDateSerializer());
- kryo.register(java.sql.Timestamp.class, new TimestampSerializer());
- kryo.register(TimestampTZ.class, new TimestampTZSerializer());
- kryo.register(Path.class, new PathSerializer());
- kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
- kryo.register(new java.util.ArrayList().subList(0,0).getClass(), new ArrayListSubListSerializer());
- kryo.register(CopyOnFirstWriteProperties.class, new CopyOnFirstWritePropertiesSerializer());
- kryo.register(PartitionDesc.class, new PartitionDescSerializer(kryo, PartitionDesc.class));
-
- ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
- .setFallbackInstantiatorStrategy(
- new StdInstantiatorStrategy());
- removeField(kryo, AbstractOperatorDesc.class, "colExprMap");
- removeField(kryo, AbstractOperatorDesc.class, "statistics");
- kryo.register(ReduceWork.class);
- kryo.register(TableDesc.class);
- kryo.register(UnionOperator.class);
- kryo.register(FileSinkOperator.class);
- kryo.register(VectorFileSinkOperator.class);
- kryo.register(HiveIgnoreKeyTextOutputFormat.class);
- kryo.register(StandardConstantListObjectInspector.class);
- kryo.register(StandardConstantMapObjectInspector.class);
- kryo.register(StandardConstantStructObjectInspector.class);
- kryo.register(SequenceFileInputFormat.class);
- kryo.register(RCFileInputFormat.class);
- kryo.register(HiveSequenceFileOutputFormat.class);
- kryo.register(LlapOutputFormat.class);
- kryo.register(SparkEdgeProperty.class);
- kryo.register(SparkWork.class);
- kryo.register(Pair.class);
- kryo.register(MemoryMonitorInfo.class);
-
- // This must be called after all the explicit register calls.
- return kryo.processHooks(kryoTypeHooks, globalHook);
- }
- };
-
// Bounded queue could be specified here but that will lead to blocking.
// ConcurrentLinkedQueue is unbounded and will release soft referenced kryo instances under
// memory pressure.
- private static KryoPool kryoPool = new KryoPool.Builder(factory).softReferences().build();
+ private static Pool<Kryo> kryoPool = new Pool<Kryo>(true, false, 8) {
+ protected Kryo create() {
+ return createNewKryo();
+ }
+ };
+
+ public static Kryo createNewKryo() {
+ KryoWithHooks kryo = new KryoWithHooks();
+
+ kryo.setReferences(true);
+ kryo.setCopyReferences(true);
+ kryo.setRegistrationRequired(false);
Review comment:
Maybe add a comment why the above 3 lines are needed?
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -278,7 +284,7 @@ public Kryo create() {
* @return kryo instance
*/
public static Kryo borrowKryo() {
- Kryo kryo = kryoPool.borrow();
+ Kryo kryo = kryoPool.obtain();
Review comment:
Maybe rename the method itself here as well? something like obtainKryo() ?
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/exec/spark/TestSparkInvalidFileFormat.java
##########
@@ -30,11 +30,13 @@
import org.apache.hadoop.hive.ql.session.SessionState;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
+@Ignore("HIVE-22944: Kryo 5 upgrade conflicts with Spark, which is not supported anymore")
Review comment:
Does this mean this is a breaking change for Spark?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on pull request #1798:
URL: https://github.com/apache/hive/pull/1798#issuecomment-773994032
cc: @rbalamohan
find attached test in commit
```
Benchmark Mode Cnt Score Error Units
HiveCharBench.BaseBench.testStrippedValueNew avgt 10 0.299 ± 0.017 ms/op
HiveCharBench.BaseBench.testStrippedValueOld avgt 10 1.523 ± 0.041 ms/op
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562100712
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -278,7 +284,7 @@ public Kryo create() {
* @return kryo instance
*/
public static Kryo borrowKryo() {
- Kryo kryo = kryoPool.borrow();
+ Kryo kryo = kryoPool.obtain();
Review comment:
it's very unfortunate that kryo changed this method name without any reasons (or just I don't understand that :) )...we might want a method name that reflects the behavior of "getting a kryo instance from the pool", I don't have a strong opinion about that, but I'm not sure if we need to change a public method name because kryo changed theirs
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562101436
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -224,51 +224,57 @@ public Registration readClass(Input input) {
private static final Object FAKE_REFERENCE = new Object();
- private static KryoFactory factory = new KryoFactory() {
- @Override
- public Kryo create() {
- KryoWithHooks kryo = new KryoWithHooks();
- kryo.register(java.sql.Date.class, new SqlDateSerializer());
- kryo.register(java.sql.Timestamp.class, new TimestampSerializer());
- kryo.register(TimestampTZ.class, new TimestampTZSerializer());
- kryo.register(Path.class, new PathSerializer());
- kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
- kryo.register(new java.util.ArrayList().subList(0,0).getClass(), new ArrayListSubListSerializer());
- kryo.register(CopyOnFirstWriteProperties.class, new CopyOnFirstWritePropertiesSerializer());
- kryo.register(PartitionDesc.class, new PartitionDescSerializer(kryo, PartitionDesc.class));
-
- ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
- .setFallbackInstantiatorStrategy(
- new StdInstantiatorStrategy());
- removeField(kryo, AbstractOperatorDesc.class, "colExprMap");
- removeField(kryo, AbstractOperatorDesc.class, "statistics");
- kryo.register(ReduceWork.class);
- kryo.register(TableDesc.class);
- kryo.register(UnionOperator.class);
- kryo.register(FileSinkOperator.class);
- kryo.register(VectorFileSinkOperator.class);
- kryo.register(HiveIgnoreKeyTextOutputFormat.class);
- kryo.register(StandardConstantListObjectInspector.class);
- kryo.register(StandardConstantMapObjectInspector.class);
- kryo.register(StandardConstantStructObjectInspector.class);
- kryo.register(SequenceFileInputFormat.class);
- kryo.register(RCFileInputFormat.class);
- kryo.register(HiveSequenceFileOutputFormat.class);
- kryo.register(LlapOutputFormat.class);
- kryo.register(SparkEdgeProperty.class);
- kryo.register(SparkWork.class);
- kryo.register(Pair.class);
- kryo.register(MemoryMonitorInfo.class);
-
- // This must be called after all the explicit register calls.
- return kryo.processHooks(kryoTypeHooks, globalHook);
- }
- };
-
// Bounded queue could be specified here but that will lead to blocking.
// ConcurrentLinkedQueue is unbounded and will release soft referenced kryo instances under
// memory pressure.
- private static KryoPool kryoPool = new KryoPool.Builder(factory).softReferences().build();
+ private static Pool<Kryo> kryoPool = new Pool<Kryo>(true, false, 8) {
+ protected Kryo create() {
+ return createNewKryo();
+ }
+ };
+
+ public static Kryo createNewKryo() {
+ KryoWithHooks kryo = new KryoWithHooks();
+
+ kryo.setReferences(true);
+ kryo.setCopyReferences(true);
+ kryo.setRegistrationRequired(false);
Review comment:
to be honest, because it works this way :) worst case I'll comment about what issues can come without these options set
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog merged pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog merged pull request #1798:
URL: https://github.com/apache/hive/pull/1798
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562095994
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/exec/spark/TestSparkInvalidFileFormat.java
##########
@@ -30,11 +30,13 @@
import org.apache.hadoop.hive.ql.session.SessionState;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
+@Ignore("HIVE-22944: Kryo 5 upgrade conflicts with Spark, which is not supported anymore")
Review comment:
yes, it is
maybe I could hack with that, but it would be painful: using kryo5 for tez execution and kryo4 for spark execution
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] pgaref commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562130303
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java
##########
@@ -224,51 +224,57 @@ public Registration readClass(Input input) {
private static final Object FAKE_REFERENCE = new Object();
- private static KryoFactory factory = new KryoFactory() {
- @Override
- public Kryo create() {
- KryoWithHooks kryo = new KryoWithHooks();
- kryo.register(java.sql.Date.class, new SqlDateSerializer());
- kryo.register(java.sql.Timestamp.class, new TimestampSerializer());
- kryo.register(TimestampTZ.class, new TimestampTZSerializer());
- kryo.register(Path.class, new PathSerializer());
- kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
- kryo.register(new java.util.ArrayList().subList(0,0).getClass(), new ArrayListSubListSerializer());
- kryo.register(CopyOnFirstWriteProperties.class, new CopyOnFirstWritePropertiesSerializer());
- kryo.register(PartitionDesc.class, new PartitionDescSerializer(kryo, PartitionDesc.class));
-
- ((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
- .setFallbackInstantiatorStrategy(
- new StdInstantiatorStrategy());
- removeField(kryo, AbstractOperatorDesc.class, "colExprMap");
- removeField(kryo, AbstractOperatorDesc.class, "statistics");
- kryo.register(ReduceWork.class);
- kryo.register(TableDesc.class);
- kryo.register(UnionOperator.class);
- kryo.register(FileSinkOperator.class);
- kryo.register(VectorFileSinkOperator.class);
- kryo.register(HiveIgnoreKeyTextOutputFormat.class);
- kryo.register(StandardConstantListObjectInspector.class);
- kryo.register(StandardConstantMapObjectInspector.class);
- kryo.register(StandardConstantStructObjectInspector.class);
- kryo.register(SequenceFileInputFormat.class);
- kryo.register(RCFileInputFormat.class);
- kryo.register(HiveSequenceFileOutputFormat.class);
- kryo.register(LlapOutputFormat.class);
- kryo.register(SparkEdgeProperty.class);
- kryo.register(SparkWork.class);
- kryo.register(Pair.class);
- kryo.register(MemoryMonitorInfo.class);
-
- // This must be called after all the explicit register calls.
- return kryo.processHooks(kryoTypeHooks, globalHook);
- }
- };
-
// Bounded queue could be specified here but that will lead to blocking.
// ConcurrentLinkedQueue is unbounded and will release soft referenced kryo instances under
// memory pressure.
- private static KryoPool kryoPool = new KryoPool.Builder(factory).softReferences().build();
+ private static Pool<Kryo> kryoPool = new Pool<Kryo>(true, false, 8) {
+ protected Kryo create() {
+ return createNewKryo();
+ }
+ };
+
+ public static Kryo createNewKryo() {
+ KryoWithHooks kryo = new KryoWithHooks();
+
+ kryo.setReferences(true);
+ kryo.setCopyReferences(true);
+ kryo.setRegistrationRequired(false);
Review comment:
Sure, makes sense!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] pgaref commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562128407
##########
File path: pom.xml
##########
@@ -170,7 +170,9 @@
<junit.jupiter.version>5.6.2</junit.jupiter.version>
<junit.vintage.version>5.6.2</junit.vintage.version>
<kafka.version>2.5.0</kafka.version>
- <kryo.version>4.0.2</kryo.version>
+ <kryo.version>5.0.3</kryo.version>
+ <kryo4.version>4.0.2</kryo4.version> <!-- old kryo, for spark-client -->
Review comment:
sure, that would be HIVE-23885
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] pgaref commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562130096
##########
File path: itests/hive-jmh/src/main/java/org/apache/hive/benchmark/ql/exec/KryoBench.java
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.hive.benchmark.ql.exec;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
+import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
+import org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.BigRowInspector;
+import org.apache.hadoop.hive.ql.plan.MapWork;
+import org.apache.hadoop.hive.ql.plan.PartitionDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.plan.VectorPartitionDesc;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.StructField;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.mapred.JobConf;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import com.google.common.io.ByteStreams;
+
+@State(Scope.Benchmark)
+public class KryoBench {
+
+ @BenchmarkMode(Mode.AverageTime)
+ @Fork(1)
+ @State(Scope.Thread)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ public static class BaseBench {
+
+ private MapWork mapWork;
+
+ @Setup
+ public void setup() throws Exception {
+ mapWork = KryoBench.mockMapWork("my_table", 1000, new BigRowInspector());
+ }
+
+ @Benchmark
+ @Warmup(iterations = 2, time = 2, timeUnit = TimeUnit.SECONDS)
+ @Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS)
+ public void testSerializeMapWork() {
+ SerializationUtilities.serializePlan(mapWork, ByteStreams.nullOutputStream());
+ }
+ }
+
+ public static void main(String[] args) throws RunnerException {
Review comment:
Nice, I missed that -- the numbers are only for 5 though right?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r562097646
##########
File path: itests/hive-jmh/src/main/java/org/apache/hive/benchmark/ql/exec/KryoBench.java
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.hive.benchmark.ql.exec;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
+import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
+import org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.BigRowInspector;
+import org.apache.hadoop.hive.ql.plan.MapWork;
+import org.apache.hadoop.hive.ql.plan.PartitionDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.plan.VectorPartitionDesc;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.StructField;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.mapred.JobConf;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import com.google.common.io.ByteStreams;
+
+@State(Scope.Benchmark)
+public class KryoBench {
+
+ @BenchmarkMode(Mode.AverageTime)
+ @Fork(1)
+ @State(Scope.Thread)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ public static class BaseBench {
+
+ private MapWork mapWork;
+
+ @Setup
+ public void setup() throws Exception {
+ mapWork = KryoBench.mockMapWork("my_table", 1000, new BigRowInspector());
+ }
+
+ @Benchmark
+ @Warmup(iterations = 2, time = 2, timeUnit = TimeUnit.SECONDS)
+ @Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS)
+ public void testSerializeMapWork() {
+ SerializationUtilities.serializePlan(mapWork, ByteStreams.nullOutputStream());
+ }
+ }
+
+ public static void main(String[] args) throws RunnerException {
Review comment:
there is a benchmark result kryo4 vs kryo5: https://issues.apache.org/jira/secure/attachment/13018768/kryo4_vs_5_benchmark.log
not an over-complicated MapWork, but contains 1000 partitions, which is the most weight of mapworks (+ a few columns)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a change in pull request #1798: HIVE-22944: Upgrade to Kryo5
Posted by GitBox <gi...@apache.org>.
abstractdog commented on a change in pull request #1798:
URL: https://github.com/apache/hive/pull/1798#discussion_r563830614
##########
File path: itests/hive-jmh/src/main/java/org/apache/hive/benchmark/ql/exec/KryoBench.java
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.hive.benchmark.ql.exec;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
+import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat;
+import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
+import org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.BigRowInspector;
+import org.apache.hadoop.hive.ql.plan.MapWork;
+import org.apache.hadoop.hive.ql.plan.PartitionDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.plan.VectorPartitionDesc;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.StructField;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.mapred.JobConf;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import com.google.common.io.ByteStreams;
+
+@State(Scope.Benchmark)
+public class KryoBench {
+
+ @BenchmarkMode(Mode.AverageTime)
+ @Fork(1)
+ @State(Scope.Thread)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ public static class BaseBench {
+
+ private MapWork mapWork;
+
+ @Setup
+ public void setup() throws Exception {
+ mapWork = KryoBench.mockMapWork("my_table", 1000, new BigRowInspector());
+ }
+
+ @Benchmark
+ @Warmup(iterations = 2, time = 2, timeUnit = TimeUnit.SECONDS)
+ @Measurement(iterations = 20, time = 2, timeUnit = TimeUnit.SECONDS)
+ public void testSerializeMapWork() {
+ SerializationUtilities.serializePlan(mapWork, ByteStreams.nullOutputStream());
+ }
+ }
+
+ public static void main(String[] args) throws RunnerException {
Review comment:
it's an edited file, scroll down in it for kryo4 results
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org