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/11 21:23:25 UTC
[GitHub] [hive] belugabehr opened a new pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
belugabehr opened a new pull request #1634:
URL: https://github.com/apache/hive/pull/1634
<!--
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] miklosgergely commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
miklosgergely commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r542031088
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/TablePropertyEnrichmentOptimizer.java
##########
@@ -115,13 +115,13 @@ public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx, Obje
String deserializerClassName = null;
try {
deserializerClassName = tableScanDesc.getTableMetadata().getSd().getSerdeInfo().getSerializationLib();
- Deserializer deserializer = ReflectionUtil.newInstance(
+ AbstractSerDe deserializer = ReflectionUtil.newInstance(
Review comment:
Please call the variable serDe.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DynamicValueRegistryTez.java
##########
@@ -104,8 +105,8 @@ public void init(RegistryConf conf) throws Exception {
RuntimeValuesInfo runtimeValuesInfo = rct.baseWork.getInputSourceToRuntimeValuesInfo().get(inputSourceName);
// Setup deserializer/obj inspectors for the incoming data source
- Deserializer deserializer = ReflectionUtils.newInstance(runtimeValuesInfo.getTableDesc().getDeserializerClass(), null);
- deserializer.initialize(rct.conf, runtimeValuesInfo.getTableDesc().getProperties());
+ AbstractSerDe deserializer = ReflectionUtils.newInstance(runtimeValuesInfo.getTableDesc().getSerDeClass(), null);
Review comment:
Please call this serDe.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/spark/SparkReduceRecordHandler.java
##########
@@ -132,10 +133,12 @@ public void init(JobConf job, OutputCollector output, Reporter reporter) throws
isTagged = gWork.getNeedsTagging();
try {
keyTableDesc = gWork.getKeyDesc();
- inputKeyDeserializer = ReflectionUtils.newInstance(keyTableDesc
- .getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputKeyDeserializer, null, keyTableDesc.getProperties(), null);
- keyObjectInspector = inputKeyDeserializer.getObjectInspector();
+ AbstractSerDe serde = ReflectionUtils.newInstance(keyTableDesc
+ .getSerDeClass(), null);
+ serde.initialize(null, keyTableDesc.getProperties(), null);
+ keyObjectInspector = serde.getObjectInspector();
+
+ inputKeyDeserializer = serde;
Review comment:
Please call this inputKeySerDe. Also no need to create a variable called serde for an interim time.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableSinkOperator.java
##########
@@ -179,18 +178,18 @@ protected void initializeOp(Configuration hconf) throws HiveException {
}
try {
TableDesc keyTableDesc = conf.getKeyTblDesc();
- AbstractSerDe keySerde = (AbstractSerDe) ReflectionUtils.newInstance(keyTableDesc.getDeserializerClass(),
+ AbstractSerDe keySerde = (AbstractSerDe) ReflectionUtils.newInstance(keyTableDesc.getSerDeClass(),
Review comment:
Nit: please call this keySerDe for consistency.
##########
File path: hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/InternalUtil.java
##########
@@ -143,18 +142,16 @@ private static ObjectInspector getObjectInspector(TypeInfo type) throws IOExcept
//TODO this has to find a better home, it's also hardcoded as default in hive would be nice
// if the default was decided by the serde
static void initializeOutputSerDe(AbstractSerDe serDe, Configuration conf, OutputJobInfo jobInfo)
- throws SerDeException {
- SerDeUtils.initializeSerDe(serDe, conf,
- getSerdeProperties(jobInfo.getTableInfo(),
- jobInfo.getOutputSchema()),
- null);
+ throws SerDeException {
+ serDe.initialize(conf, getSerdeProperties(jobInfo.getTableInfo(), jobInfo.getOutputSchema()), null);
}
static void initializeDeserializer(Deserializer deserializer, Configuration conf,
HCatTableInfo info, HCatSchema schema) throws SerDeException {
Properties props = getSerdeProperties(info, schema);
LOG.info("Initializing " + deserializer.getClass().getName() + " with properties " + props);
- SerDeUtils.initializeSerDe(deserializer, conf, props, null);
+ AbstractSerDe serde = (AbstractSerDe)deserializer;
Review comment:
Nit: please call this serDe for consistency.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ReduceRecordSource.java
##########
@@ -152,10 +152,11 @@ void init(JobConf jconf, Operator<?> reducer, boolean vectorized, TableDesc keyT
this.tag = tag;
try {
- inputKeyDeserializer = ReflectionUtils.newInstance(keyTableDesc
- .getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputKeyDeserializer, null, keyTableDesc.getProperties(), null);
- keyObjectInspector = inputKeyDeserializer.getObjectInspector();
+ AbstractSerDe serde = ReflectionUtils.newInstance(keyTableDesc.getSerDeClass(), null);
+ serde.initialize(null, keyTableDesc.getProperties(), null);
+
+ inputKeyDeserializer = serde;
Review comment:
I suggest to call it inputKeySerDe, and it can be created under this name, no need to call it serde for an interim time.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ReduceRecordSource.java
##########
@@ -164,10 +165,8 @@ void init(JobConf jconf, Operator<?> reducer, boolean vectorized, TableDesc keyT
// We should initialize the SerDe with the TypeInfo when available.
this.valueTableDesc = valueTableDesc;
- inputValueDeserializer = (AbstractSerDe) ReflectionUtils.newInstance(
- valueTableDesc.getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputValueDeserializer, null,
- valueTableDesc.getProperties(), null);
+ inputValueDeserializer = (AbstractSerDe) ReflectionUtils.newInstance(valueTableDesc.getSerDeClass(), null);
Review comment:
Please call this inputValueSerDe
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/spark/SparkReduceRecordHandler.java
##########
@@ -154,10 +157,11 @@ public void init(JobConf job, OutputCollector output, Reporter reporter) throws
for (int tag = 0; tag < gWork.getTagToValueDesc().size(); tag++) {
// We should initialize the SerDe with the TypeInfo when available.
valueTableDesc[tag] = gWork.getTagToValueDesc().get(tag);
- inputValueDeserializer[tag] = ReflectionUtils.newInstance(
- valueTableDesc[tag].getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputValueDeserializer[tag], null,
- valueTableDesc[tag].getProperties(), null);
+
+ AbstractSerDe sd = ReflectionUtils.newInstance(valueTableDesc[tag].getSerDeClass(), null);
+ sd.initialize(null, valueTableDesc[tag].getProperties(), null);
+
+ inputValueDeserializer[tag] = sd;
Review comment:
Please call this inputValueSerDe.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java
##########
@@ -273,15 +273,14 @@ protected void initializeOp(Configuration hconf) throws HiveException {
try {
this.hconf = hconf;
- scriptOutputDeserializer = conf.getScriptOutputInfo()
- .getDeserializerClass().newInstance();
- SerDeUtils.initializeSerDe(scriptOutputDeserializer, hconf,
- conf.getScriptOutputInfo().getProperties(), null);
+ AbstractSerDe outputSerde = conf.getScriptOutputInfo().getSerDeClass().newInstance();
Review comment:
Nit: outputSerDe for consistency.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionDesc.java
##########
@@ -171,9 +171,9 @@ public String getDeserializerClassName() {
public Deserializer getDeserializer(Configuration conf) throws Exception {
Properties schema = getProperties();
String clazzName = getDeserializerClassName();
- Deserializer deserializer = ReflectionUtil.newInstance(conf.getClassByName(clazzName)
- .asSubclass(Deserializer.class), conf);
- SerDeUtils.initializeSerDe(deserializer, conf, getTableDesc().getProperties(), schema);
+ AbstractSerDe deserializer = ReflectionUtil.newInstance(conf.getClassByName(clazzName)
Review comment:
Please call the variable serDe, and the function getSerDeClass, to be consistent with TableDesc.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java
##########
@@ -775,7 +775,7 @@ public static void setTaskPlan(Path path, String alias,
if (topOp instanceof TableScanOperator) {
try {
Utilities.addSchemaEvolutionToTableScanOperator(
- (StructObjectInspector) tt_desc.getDeserializer().getObjectInspector(),
+ (StructObjectInspector) tt_desc.getSerDe().getObjectInspector(),
Review comment:
Nit: please rename tt_desc so that it follows the java naming conventions.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/MapOperator.java
##########
@@ -407,7 +407,7 @@ public void initEmptyInputChildren(List<Operator<?>> children, Configuration hco
StructObjectInspector soi = null;
PartitionDesc partDesc = conf.getAliasToPartnInfo().get(tsOp.getConf().getAlias());
Configuration newConf = tableNameToConf.get(partDesc.getTableDesc().getTableName());
- Deserializer serde = partDesc.getTableDesc().getDeserializer();
+ Deserializer serde = partDesc.getTableDesc().getSerDe();
Review comment:
Nit: AbstractSerDe serDe for consistency.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecReducer.java
##########
@@ -100,20 +101,19 @@ public void configure(JobConf job) {
isTagged = gWork.getNeedsTagging();
try {
keyTableDesc = gWork.getKeyDesc();
- inputKeyDeserializer = ReflectionUtils.newInstance(keyTableDesc
- .getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputKeyDeserializer, null, keyTableDesc.getProperties(), null);
+ AbstractSerDe serDe = ReflectionUtils.newInstance(keyTableDesc
+ .getSerDeClass(), null);
+ serDe.initialize(null, keyTableDesc.getProperties(), null);
+ inputKeyDeserializer = serDe;
keyObjectInspector = inputKeyDeserializer.getObjectInspector();
valueTableDesc = new TableDesc[gWork.getTagToValueDesc().size()];
for (int tag = 0; tag < gWork.getTagToValueDesc().size(); tag++) {
// We should initialize the SerDe with the TypeInfo when available.
valueTableDesc[tag] = gWork.getTagToValueDesc().get(tag);
- inputValueDeserializer[tag] = ReflectionUtils.newInstance(
- valueTableDesc[tag].getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputValueDeserializer[tag], null,
- valueTableDesc[tag].getProperties(), null);
- valueObjectInspector[tag] = inputValueDeserializer[tag]
- .getObjectInspector();
+ AbstractSerDe sd = ReflectionUtils.newInstance(valueTableDesc[tag].getSerDeClass(), null);
+ sd.initialize(null, valueTableDesc[tag].getProperties(), null);
+ inputValueDeserializer[tag] = sd;
+ valueObjectInspector[tag] = inputValueDeserializer[tag].getObjectInspector();
Review comment:
Please call this valueObjectSerDe
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecReducer.java
##########
@@ -100,20 +101,19 @@ public void configure(JobConf job) {
isTagged = gWork.getNeedsTagging();
try {
keyTableDesc = gWork.getKeyDesc();
- inputKeyDeserializer = ReflectionUtils.newInstance(keyTableDesc
- .getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputKeyDeserializer, null, keyTableDesc.getProperties(), null);
+ AbstractSerDe serDe = ReflectionUtils.newInstance(keyTableDesc
+ .getSerDeClass(), null);
+ serDe.initialize(null, keyTableDesc.getProperties(), null);
+ inputKeyDeserializer = serDe;
Review comment:
Please call this inputKeySerDe, also no need for the interim serde variable.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableDummyOperator.java
##########
@@ -45,8 +44,8 @@ protected void initializeOp(Configuration hconf) throws HiveException {
super.initializeOp(hconf);
TableDesc tbl = this.getConf().getTbl();
try {
- Deserializer serde = tbl.getDeserializerClass().newInstance();
- SerDeUtils.initializeSerDe(serde, hconf, tbl.getProperties(), null);
+ AbstractSerDe serde = tbl.getSerDeClass().newInstance();
Review comment:
Nit: please call this serDe for consistency.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java
##########
@@ -352,8 +351,8 @@ public void generateMapMetaData() throws HiveException {
try {
TableDesc keyTableDesc = conf.getKeyTblDesc();
AbstractSerDe keySerializer = (AbstractSerDe) ReflectionUtil.newInstance(
Review comment:
Please call this keySerDe
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java
##########
@@ -273,15 +273,14 @@ protected void initializeOp(Configuration hconf) throws HiveException {
try {
this.hconf = hconf;
- scriptOutputDeserializer = conf.getScriptOutputInfo()
- .getDeserializerClass().newInstance();
- SerDeUtils.initializeSerDe(scriptOutputDeserializer, hconf,
- conf.getScriptOutputInfo().getProperties(), null);
+ AbstractSerDe outputSerde = conf.getScriptOutputInfo().getSerDeClass().newInstance();
+ outputSerde.initialize(hconf, conf.getScriptOutputInfo().getProperties(), null);
- scriptInputSerializer = (Serializer) conf.getScriptInputInfo()
- .getDeserializerClass().newInstance();
- scriptInputSerializer.initialize(hconf, conf.getScriptInputInfo()
- .getProperties());
+ AbstractSerDe inputSerde = conf.getScriptInputInfo().getSerDeClass().newInstance();
Review comment:
Nit: inputSerDe for consistency.
##########
File path: serde/src/java/org/apache/hadoop/hive/serde2/SerDe.java
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.hadoop.hive.serde2;
+
+/**
+ * A Hive Serializer/Deserializer.
+ */
+public interface SerDe {
+
+ /**
+ * Returns statistics collected when serializing
Review comment:
Modify comment to "(de)serializing"
----------------------------------------------------------------
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] belugabehr closed pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr closed pull request #1634:
URL: https://github.com/apache/hive/pull/1634
----------------------------------------------------------------
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543373993
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionDesc.java
##########
@@ -171,9 +171,9 @@ public String getDeserializerClassName() {
public Deserializer getDeserializer(Configuration conf) throws Exception {
Properties schema = getProperties();
String clazzName = getDeserializerClassName();
- Deserializer deserializer = ReflectionUtil.newInstance(conf.getClassByName(clazzName)
- .asSubclass(Deserializer.class), conf);
- SerDeUtils.initializeSerDe(deserializer, conf, getTableDesc().getProperties(), schema);
+ AbstractSerDe deserializer = ReflectionUtil.newInstance(conf.getClassByName(clazzName)
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543374966
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ReduceRecordSource.java
##########
@@ -164,10 +165,8 @@ void init(JobConf jconf, Operator<?> reducer, boolean vectorized, TableDesc keyT
// We should initialize the SerDe with the TypeInfo when available.
this.valueTableDesc = valueTableDesc;
- inputValueDeserializer = (AbstractSerDe) ReflectionUtils.newInstance(
- valueTableDesc.getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputValueDeserializer, null,
- valueTableDesc.getProperties(), null);
+ inputValueDeserializer = (AbstractSerDe) ReflectionUtils.newInstance(valueTableDesc.getSerDeClass(), null);
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543372574
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java
##########
@@ -775,7 +775,7 @@ public static void setTaskPlan(Path path, String alias,
if (topOp instanceof TableScanOperator) {
try {
Utilities.addSchemaEvolutionToTableScanOperator(
- (StructObjectInspector) tt_desc.getDeserializer().getObjectInspector(),
+ (StructObjectInspector) tt_desc.getSerDe().getObjectInspector(),
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543394455
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java
##########
@@ -273,15 +273,14 @@ protected void initializeOp(Configuration hconf) throws HiveException {
try {
this.hconf = hconf;
- scriptOutputDeserializer = conf.getScriptOutputInfo()
- .getDeserializerClass().newInstance();
- SerDeUtils.initializeSerDe(scriptOutputDeserializer, hconf,
- conf.getScriptOutputInfo().getProperties(), null);
+ AbstractSerDe outputSerde = conf.getScriptOutputInfo().getSerDeClass().newInstance();
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543376678
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableSinkOperator.java
##########
@@ -179,18 +178,18 @@ protected void initializeOp(Configuration hconf) throws HiveException {
}
try {
TableDesc keyTableDesc = conf.getKeyTblDesc();
- AbstractSerDe keySerde = (AbstractSerDe) ReflectionUtils.newInstance(keyTableDesc.getDeserializerClass(),
+ AbstractSerDe keySerde = (AbstractSerDe) ReflectionUtils.newInstance(keyTableDesc.getSerDeClass(),
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543379546
##########
File path: serde/src/java/org/apache/hadoop/hive/serde2/SerDe.java
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.hadoop.hive.serde2;
+
+/**
+ * A Hive Serializer/Deserializer.
+ */
+public interface SerDe {
+
+ /**
+ * Returns statistics collected when serializing
Review comment:
Thanks. 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.
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] belugabehr merged pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr merged pull request #1634:
URL: https://github.com/apache/hive/pull/1634
----------------------------------------------------------------
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543395685
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java
##########
@@ -273,15 +273,14 @@ protected void initializeOp(Configuration hconf) throws HiveException {
try {
this.hconf = hconf;
- scriptOutputDeserializer = conf.getScriptOutputInfo()
- .getDeserializerClass().newInstance();
- SerDeUtils.initializeSerDe(scriptOutputDeserializer, hconf,
- conf.getScriptOutputInfo().getProperties(), null);
+ AbstractSerDe outputSerde = conf.getScriptOutputInfo().getSerDeClass().newInstance();
+ outputSerde.initialize(hconf, conf.getScriptOutputInfo().getProperties(), null);
- scriptInputSerializer = (Serializer) conf.getScriptInputInfo()
- .getDeserializerClass().newInstance();
- scriptInputSerializer.initialize(hconf, conf.getScriptInputInfo()
- .getProperties());
+ AbstractSerDe inputSerde = conf.getScriptInputInfo().getSerDeClass().newInstance();
Review comment:
Done.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/MapOperator.java
##########
@@ -407,7 +407,7 @@ public void initEmptyInputChildren(List<Operator<?>> children, Configuration hco
StructObjectInspector soi = null;
PartitionDesc partDesc = conf.getAliasToPartnInfo().get(tsOp.getConf().getAlias());
Configuration newConf = tableNameToConf.get(partDesc.getTableDesc().getTableName());
- Deserializer serde = partDesc.getTableDesc().getDeserializer();
+ Deserializer serde = partDesc.getTableDesc().getSerDe();
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543375870
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/MapJoinOperator.java
##########
@@ -352,8 +351,8 @@ public void generateMapMetaData() throws HiveException {
try {
TableDesc keyTableDesc = conf.getKeyTblDesc();
AbstractSerDe keySerializer = (AbstractSerDe) ReflectionUtil.newInstance(
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543389456
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ReduceRecordSource.java
##########
@@ -152,10 +152,11 @@ void init(JobConf jconf, Operator<?> reducer, boolean vectorized, TableDesc keyT
this.tag = tag;
try {
- inputKeyDeserializer = ReflectionUtils.newInstance(keyTableDesc
- .getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputKeyDeserializer, null, keyTableDesc.getProperties(), null);
- keyObjectInspector = inputKeyDeserializer.getObjectInspector();
+ AbstractSerDe serde = ReflectionUtils.newInstance(keyTableDesc.getSerDeClass(), null);
+ serde.initialize(null, keyTableDesc.getProperties(), null);
+
+ inputKeyDeserializer = serde;
Review comment:
Done. I had it this way because `inputKeyDeserializer` is a `Deserializer` class which does not have an 'initialize' method. However, I change the type to be `AbstractSerDe` to address your comments here.
----------------------------------------------------------------
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543397112
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecReducer.java
##########
@@ -100,20 +101,19 @@ public void configure(JobConf job) {
isTagged = gWork.getNeedsTagging();
try {
keyTableDesc = gWork.getKeyDesc();
- inputKeyDeserializer = ReflectionUtils.newInstance(keyTableDesc
- .getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputKeyDeserializer, null, keyTableDesc.getProperties(), null);
+ AbstractSerDe serDe = ReflectionUtils.newInstance(keyTableDesc
+ .getSerDeClass(), null);
+ serDe.initialize(null, keyTableDesc.getProperties(), null);
+ inputKeyDeserializer = serDe;
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543378128
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableDummyOperator.java
##########
@@ -45,8 +44,8 @@ protected void initializeOp(Configuration hconf) throws HiveException {
super.initializeOp(hconf);
TableDesc tbl = this.getConf().getTbl();
try {
- Deserializer serde = tbl.getDeserializerClass().newInstance();
- SerDeUtils.initializeSerDe(serde, hconf, tbl.getProperties(), null);
+ AbstractSerDe serde = tbl.getSerDeClass().newInstance();
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.
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] miklosgergely commented on pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
miklosgergely commented on pull request #1634:
URL: https://github.com/apache/hive/pull/1634#issuecomment-748636635
Thanks for the changes @belugabehr , approved!
----------------------------------------------------------------
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543377449
##########
File path: hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/InternalUtil.java
##########
@@ -143,18 +142,16 @@ private static ObjectInspector getObjectInspector(TypeInfo type) throws IOExcept
//TODO this has to find a better home, it's also hardcoded as default in hive would be nice
// if the default was decided by the serde
static void initializeOutputSerDe(AbstractSerDe serDe, Configuration conf, OutputJobInfo jobInfo)
- throws SerDeException {
- SerDeUtils.initializeSerDe(serDe, conf,
- getSerdeProperties(jobInfo.getTableInfo(),
- jobInfo.getOutputSchema()),
- null);
+ throws SerDeException {
+ serDe.initialize(conf, getSerdeProperties(jobInfo.getTableInfo(), jobInfo.getOutputSchema()), null);
}
static void initializeDeserializer(Deserializer deserializer, Configuration conf,
HCatTableInfo info, HCatSchema schema) throws SerDeException {
Properties props = getSerdeProperties(info, schema);
LOG.info("Initializing " + deserializer.getClass().getName() + " with properties " + props);
- SerDeUtils.initializeSerDe(deserializer, conf, props, null);
+ AbstractSerDe serde = (AbstractSerDe)deserializer;
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543391931
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/spark/SparkReduceRecordHandler.java
##########
@@ -132,10 +133,12 @@ public void init(JobConf job, OutputCollector output, Reporter reporter) throws
isTagged = gWork.getNeedsTagging();
try {
keyTableDesc = gWork.getKeyDesc();
- inputKeyDeserializer = ReflectionUtils.newInstance(keyTableDesc
- .getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputKeyDeserializer, null, keyTableDesc.getProperties(), null);
- keyObjectInspector = inputKeyDeserializer.getObjectInspector();
+ AbstractSerDe serde = ReflectionUtils.newInstance(keyTableDesc
+ .getSerDeClass(), null);
+ serde.initialize(null, keyTableDesc.getProperties(), null);
+ keyObjectInspector = serde.getObjectInspector();
+
+ inputKeyDeserializer = serde;
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.
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] belugabehr commented on pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on pull request #1634:
URL: https://github.com/apache/hive/pull/1634#issuecomment-747465709
@miklosgergely I believe I have made all the changes you requested. Take another swing at it? Thanks!
----------------------------------------------------------------
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543383695
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/TablePropertyEnrichmentOptimizer.java
##########
@@ -115,13 +115,13 @@ public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx, Obje
String deserializerClassName = null;
try {
deserializerClassName = tableScanDesc.getTableMetadata().getSd().getSerdeInfo().getSerializationLib();
- Deserializer deserializer = ReflectionUtil.newInstance(
+ AbstractSerDe deserializer = ReflectionUtil.newInstance(
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543390071
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DynamicValueRegistryTez.java
##########
@@ -104,8 +105,8 @@ public void init(RegistryConf conf) throws Exception {
RuntimeValuesInfo runtimeValuesInfo = rct.baseWork.getInputSourceToRuntimeValuesInfo().get(inputSourceName);
// Setup deserializer/obj inspectors for the incoming data source
- Deserializer deserializer = ReflectionUtils.newInstance(runtimeValuesInfo.getTableDesc().getDeserializerClass(), null);
- deserializer.initialize(rct.conf, runtimeValuesInfo.getTableDesc().getProperties());
+ AbstractSerDe deserializer = ReflectionUtils.newInstance(runtimeValuesInfo.getTableDesc().getSerDeClass(), null);
Review comment:
Resolved.
----------------------------------------------------------------
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543393854
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecReducer.java
##########
@@ -100,20 +101,19 @@ public void configure(JobConf job) {
isTagged = gWork.getNeedsTagging();
try {
keyTableDesc = gWork.getKeyDesc();
- inputKeyDeserializer = ReflectionUtils.newInstance(keyTableDesc
- .getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputKeyDeserializer, null, keyTableDesc.getProperties(), null);
+ AbstractSerDe serDe = ReflectionUtils.newInstance(keyTableDesc
+ .getSerDeClass(), null);
+ serDe.initialize(null, keyTableDesc.getProperties(), null);
+ inputKeyDeserializer = serDe;
keyObjectInspector = inputKeyDeserializer.getObjectInspector();
valueTableDesc = new TableDesc[gWork.getTagToValueDesc().size()];
for (int tag = 0; tag < gWork.getTagToValueDesc().size(); tag++) {
// We should initialize the SerDe with the TypeInfo when available.
valueTableDesc[tag] = gWork.getTagToValueDesc().get(tag);
- inputValueDeserializer[tag] = ReflectionUtils.newInstance(
- valueTableDesc[tag].getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputValueDeserializer[tag], null,
- valueTableDesc[tag].getProperties(), null);
- valueObjectInspector[tag] = inputValueDeserializer[tag]
- .getObjectInspector();
+ AbstractSerDe sd = ReflectionUtils.newInstance(valueTableDesc[tag].getSerDeClass(), null);
+ sd.initialize(null, valueTableDesc[tag].getProperties(), null);
+ inputValueDeserializer[tag] = sd;
+ valueObjectInspector[tag] = inputValueDeserializer[tag].getObjectInspector();
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.
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] belugabehr commented on a change in pull request #1634: HIVE-24332: Make AbstractSerDe Superclass of all SerDes
Posted by GitBox <gi...@apache.org>.
belugabehr commented on a change in pull request #1634:
URL: https://github.com/apache/hive/pull/1634#discussion_r543393380
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/spark/SparkReduceRecordHandler.java
##########
@@ -154,10 +157,11 @@ public void init(JobConf job, OutputCollector output, Reporter reporter) throws
for (int tag = 0; tag < gWork.getTagToValueDesc().size(); tag++) {
// We should initialize the SerDe with the TypeInfo when available.
valueTableDesc[tag] = gWork.getTagToValueDesc().get(tag);
- inputValueDeserializer[tag] = ReflectionUtils.newInstance(
- valueTableDesc[tag].getDeserializerClass(), null);
- SerDeUtils.initializeSerDe(inputValueDeserializer[tag], null,
- valueTableDesc[tag].getProperties(), null);
+
+ AbstractSerDe sd = ReflectionUtils.newInstance(valueTableDesc[tag].getSerDeClass(), null);
+ sd.initialize(null, valueTableDesc[tag].getProperties(), null);
+
+ inputValueDeserializer[tag] = sd;
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.
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