[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15935547#comment-15935547 ] Rahul Challapalli commented on DRILL-4982: -- [~dechanggu] Kindly automate a testcase when you find some time > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Karthikeyan Manivannan >Priority: Critical > Fix For: 1.10.0 > > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x6 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > print > "{0}".format(x1),"{0}".format(x2),"{0}".format(x3),"{0}".format(x4),"{0}".format(x5),"{0}".format(x6) > python repro.py > repro.csv > 2) put these files in a dfs directory e.g. '/tmp/hiveworkspace/plain'. Under > hive prompt, use the following sql command to create an external table: > CREATE EXTERNAL TABLE `hiveworkspace`.`plain` (`id1` string, `id2` string, > `id3` string, `id4` string, `id5` string, `id6` string) ROW FORMAT SERDE > 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS TEXTFILE LOCATION > '/tmp/hiveworkspace/plain' > 3) create Hive's table of ORC|PARQUET format: > CREATE TABLE `hiveworkspace`.`plainorc` STORED AS ORC AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > CREATE TABLE `hiveworkspace`.`plainparquet` STORED AS PARQUET AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > 4) Query switch between these two tables, then the query time on the same > table significantly lengthened. On my setup, for ORC, it was 15sec -> 26secs. > Queries on table of other formats, after injecting a query to other formats, > all have significant slow down. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15731190#comment-15731190 ] ASF GitHub Bot commented on DRILL-4982: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/638#discussion_r91446474 --- Diff: contrib/storage-hive/core/src/main/codegen/templates/HiveRecordReaders.java --- @@ -0,0 +1,300 @@ +/** + * 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. + */ + +/** + * This template is used to generate different Hive record reader classes for different data formats + * to avoid JIT profile pullusion. These readers are derived from HiveAbstractReader which implements + * codes for init and setup stage, but the repeated - and performance critical part - next() method is + * separately implemented in the classes generated from this template. The internal SkipRecordReeader + * class is also separated as well due to the same reason. + * + * As to the performance gain with this change, please refer to: + * https://issues.apache.org/jira/browse/DRILL-4982 + * + */ +<@pp.dropOutputFile /> +<#list hiveFormat.map as entry> +<@pp.changeOutputFile name="/org/apache/drill/exec/store/hive/Hive${entry.hiveReader}Reader.java" /> +<#include "/@includes/license.ftl" /> + +package org.apache.drill.exec.store.hive; + +import java.io.IOException; +import java.util.List; +import java.util.Properties; +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.common.exceptions.ExecutionSetupException; +import org.apache.drill.common.expression.SchemaPath; +import org.apache.drill.exec.ops.FragmentContext; +import org.apache.drill.exec.vector.AllocationHelper; +import org.apache.drill.exec.vector.ValueVector; +import org.apache.hadoop.hive.metastore.api.Partition; +import org.apache.hadoop.hive.metastore.api.Table; +import org.apache.hadoop.io.Writable; +import org.apache.hadoop.mapred.InputSplit; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.hive.conf.HiveConf; + +import org.apache.hadoop.hive.serde2.SerDeException; + +import org.apache.hadoop.mapred.RecordReader; +<#if entry.hasHeaderFooter == true> +import org.apache.hadoop.hive.serde2.SerDe; +import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector; +import com.google.common.collect.Lists; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Queue; +import java.util.Set; +import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; +import org.apache.hadoop.hive.serde.serdeConstants; + + +public class Hive${entry.hiveReader}Reader extends HiveAbstractReader { + + Object key; +<#if entry.hasHeaderFooter == true> --- End diff -- Free marker allows simple boolean expressions: `<#if entry.hasHeaderFooter>` > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Karthikeyan Manivannan >Priority: Critical > Fix For: 1.10.0 > > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) >
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15731188#comment-15731188 ] ASF GitHub Bot commented on DRILL-4982: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/638#discussion_r91447651 --- Diff: contrib/storage-hive/core/src/main/codegen/templates/HiveRecordReaders.java --- @@ -0,0 +1,300 @@ +/** + * 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. + */ + +/** + * This template is used to generate different Hive record reader classes for different data formats + * to avoid JIT profile pullusion. These readers are derived from HiveAbstractReader which implements + * codes for init and setup stage, but the repeated - and performance critical part - next() method is + * separately implemented in the classes generated from this template. The internal SkipRecordReeader + * class is also separated as well due to the same reason. + * + * As to the performance gain with this change, please refer to: + * https://issues.apache.org/jira/browse/DRILL-4982 + * + */ +<@pp.dropOutputFile /> +<#list hiveFormat.map as entry> +<@pp.changeOutputFile name="/org/apache/drill/exec/store/hive/Hive${entry.hiveReader}Reader.java" /> +<#include "/@includes/license.ftl" /> + +package org.apache.drill.exec.store.hive; + +import java.io.IOException; +import java.util.List; +import java.util.Properties; +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.common.exceptions.ExecutionSetupException; +import org.apache.drill.common.expression.SchemaPath; +import org.apache.drill.exec.ops.FragmentContext; +import org.apache.drill.exec.vector.AllocationHelper; +import org.apache.drill.exec.vector.ValueVector; +import org.apache.hadoop.hive.metastore.api.Partition; +import org.apache.hadoop.hive.metastore.api.Table; +import org.apache.hadoop.io.Writable; +import org.apache.hadoop.mapred.InputSplit; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.hive.conf.HiveConf; + +import org.apache.hadoop.hive.serde2.SerDeException; + +import org.apache.hadoop.mapred.RecordReader; +<#if entry.hasHeaderFooter == true> +import org.apache.hadoop.hive.serde2.SerDe; +import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector; +import com.google.common.collect.Lists; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Queue; +import java.util.Set; +import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; +import org.apache.hadoop.hive.serde.serdeConstants; + + +public class Hive${entry.hiveReader}Reader extends HiveAbstractReader { + + Object key; +<#if entry.hasHeaderFooter == true> + SkipRecordsInspector skipRecordsInspector; +<#else> + Object value; + + + public Hive${entry.hiveReader}Reader(Table table, Partition partition, InputSplit inputSplit, List projectedColumns, + FragmentContext context, final HiveConf hiveConf, + UserGroupInformation proxyUgi) throws ExecutionSetupException { +super(table, partition, inputSplit, projectedColumns, context, hiveConf, proxyUgi); + } + + public void internalInit(Properties tableProperties, RecordReader reader) { + +key = reader.createKey(); +<#if entry.hasHeaderFooter == true> +skipRecordsInspector = new SkipRecordsInspector(tableProperties, reader); +<#else> +value = reader.createValue(); + + + } + private void readHiveRecordAndInsertIntoRecordBatch(Object deSerializedValue, int outputRecordIndex) { +for (int i = 0; i < selectedStructFieldRefs.size(); i++) { + Object hiveValue = finalOI.getStructFieldData(deSerializedValue, selectedStructFieldRefs.get(i
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15731189#comment-15731189 ] ASF GitHub Bot commented on DRILL-4982: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/638#discussion_r91447926 --- Diff: contrib/storage-hive/core/src/main/codegen/templates/HiveRecordReaders.java --- @@ -0,0 +1,300 @@ +/** + * 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. + */ + +/** + * This template is used to generate different Hive record reader classes for different data formats + * to avoid JIT profile pullusion. These readers are derived from HiveAbstractReader which implements + * codes for init and setup stage, but the repeated - and performance critical part - next() method is + * separately implemented in the classes generated from this template. The internal SkipRecordReeader + * class is also separated as well due to the same reason. + * + * As to the performance gain with this change, please refer to: + * https://issues.apache.org/jira/browse/DRILL-4982 + * + */ +<@pp.dropOutputFile /> +<#list hiveFormat.map as entry> +<@pp.changeOutputFile name="/org/apache/drill/exec/store/hive/Hive${entry.hiveReader}Reader.java" /> +<#include "/@includes/license.ftl" /> + +package org.apache.drill.exec.store.hive; + +import java.io.IOException; +import java.util.List; +import java.util.Properties; +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.common.exceptions.ExecutionSetupException; +import org.apache.drill.common.expression.SchemaPath; +import org.apache.drill.exec.ops.FragmentContext; +import org.apache.drill.exec.vector.AllocationHelper; +import org.apache.drill.exec.vector.ValueVector; +import org.apache.hadoop.hive.metastore.api.Partition; +import org.apache.hadoop.hive.metastore.api.Table; +import org.apache.hadoop.io.Writable; +import org.apache.hadoop.mapred.InputSplit; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.hive.conf.HiveConf; + +import org.apache.hadoop.hive.serde2.SerDeException; + +import org.apache.hadoop.mapred.RecordReader; +<#if entry.hasHeaderFooter == true> +import org.apache.hadoop.hive.serde2.SerDe; +import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector; +import com.google.common.collect.Lists; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Queue; +import java.util.Set; +import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; +import org.apache.hadoop.hive.serde.serdeConstants; + + +public class Hive${entry.hiveReader}Reader extends HiveAbstractReader { + + Object key; +<#if entry.hasHeaderFooter == true> + SkipRecordsInspector skipRecordsInspector; +<#else> + Object value; + + + public Hive${entry.hiveReader}Reader(Table table, Partition partition, InputSplit inputSplit, List projectedColumns, + FragmentContext context, final HiveConf hiveConf, + UserGroupInformation proxyUgi) throws ExecutionSetupException { +super(table, partition, inputSplit, projectedColumns, context, hiveConf, proxyUgi); + } + + public void internalInit(Properties tableProperties, RecordReader reader) { + +key = reader.createKey(); +<#if entry.hasHeaderFooter == true> +skipRecordsInspector = new SkipRecordsInspector(tableProperties, reader); +<#else> +value = reader.createValue(); + + + } + private void readHiveRecordAndInsertIntoRecordBatch(Object deSerializedValue, int outputRecordIndex) { +for (int i = 0; i < selectedStructFieldRefs.size(); i++) { + Object hiveValue = finalOI.getStructFieldData(deSerializedValue, selectedStructFieldRefs.get(i
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15731187#comment-15731187 ] ASF GitHub Bot commented on DRILL-4982: --- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/638#discussion_r91448234 --- Diff: contrib/storage-hive/core/src/main/codegen/data/HiveFormats.tdd --- @@ -0,0 +1,50 @@ +# 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. + +{ --- End diff -- Can we explain this a bit? We have 6 reader types. But, the only difference in generated code is has header/footer or not. Can we solve the Java optimization problem with a "classic" type hierarchy: ``` HiveAbstractReader . HiveSimpleReader . . HiveAvroReader . . ... . HiveHeaderFooterReader . . HiveTextReader . . ... ``` Names are just made up. The point is, can a much simpler Java hierarchy, with less duplicated code, solve the problem? If there is one function that is sub-optimized, can just that one function be generated in the subclass rather than generating duplicate code? > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Karthikeyan Manivannan >Priority: Critical > Fix For: 1.10.0 > > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x6 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > print > "{0}".format(x1),"{0}".format(x2),"{0}".format(x3),"{0}".format(x4),"{0}".format(x5),"{0}".format(x6) > python repro.py > repro.csv > 2) put these files in a dfs directory e.g. '/tmp/hiveworkspace/plain'. Under > hive prompt, use the following sql command to create an external table: > CREATE EXTERNAL TABLE `hiveworkspace`.`plain` (`id1` string, `id2` string, > `id3` string, `id4` string, `id5` string, `id6` string) ROW FORMAT SERDE > 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS TEXTFILE LOCATION > '/tmp/hiveworkspace/plain' > 3) create Hive's table of ORC|PARQUET format: > CREATE TABLE `hiveworkspace`.`plainorc` STORED AS ORC AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > CREATE TABLE `hiveworkspace`.`plainparquet` STORED AS PARQUET AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > 4) Query switch between these two tables, then the query time on the same > table significantly lengthened. On my setup, for ORC, it was 15sec -> 26secs. > Queries on table of other formats, after injecting a query to other formats, > all have significant slow down. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15720439#comment-15720439 ] ASF GitHub Bot commented on DRILL-4982: --- Github user asfgit closed the pull request at: https://github.com/apache/drill/pull/638 > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Karthikeyan Manivannan >Priority: Critical > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x6 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > print > "{0}".format(x1),"{0}".format(x2),"{0}".format(x3),"{0}".format(x4),"{0}".format(x5),"{0}".format(x6) > python repro.py > repro.csv > 2) put these files in a dfs directory e.g. '/tmp/hiveworkspace/plain'. Under > hive prompt, use the following sql command to create an external table: > CREATE EXTERNAL TABLE `hiveworkspace`.`plain` (`id1` string, `id2` string, > `id3` string, `id4` string, `id5` string, `id6` string) ROW FORMAT SERDE > 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS TEXTFILE LOCATION > '/tmp/hiveworkspace/plain' > 3) create Hive's table of ORC|PARQUET format: > CREATE TABLE `hiveworkspace`.`plainorc` STORED AS ORC AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > CREATE TABLE `hiveworkspace`.`plainparquet` STORED AS PARQUET AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > 4) Query switch between these two tables, then the query time on the same > table significantly lengthened. On my setup, for ORC, it was 15sec -> 26secs. > Queries on table of other formats, after injecting a query to other formats, > all have significant slow down. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15717102#comment-15717102 ] ASF GitHub Bot commented on DRILL-4982: --- Github user parthchandra commented on the issue: https://github.com/apache/drill/pull/638 LGTM too. +1 > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Karthikeyan Manivannan >Priority: Critical > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x6 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > print > "{0}".format(x1),"{0}".format(x2),"{0}".format(x3),"{0}".format(x4),"{0}".format(x5),"{0}".format(x6) > python repro.py > repro.csv > 2) put these files in a dfs directory e.g. '/tmp/hiveworkspace/plain'. Under > hive prompt, use the following sql command to create an external table: > CREATE EXTERNAL TABLE `hiveworkspace`.`plain` (`id1` string, `id2` string, > `id3` string, `id4` string, `id5` string, `id6` string) ROW FORMAT SERDE > 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS TEXTFILE LOCATION > '/tmp/hiveworkspace/plain' > 3) create Hive's table of ORC|PARQUET format: > CREATE TABLE `hiveworkspace`.`plainorc` STORED AS ORC AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > CREATE TABLE `hiveworkspace`.`plainparquet` STORED AS PARQUET AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > 4) Query switch between these two tables, then the query time on the same > table significantly lengthened. On my setup, for ORC, it was 15sec -> 26secs. > Queries on table of other formats, after injecting a query to other formats, > all have significant slow down. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15715980#comment-15715980 ] ASF GitHub Bot commented on DRILL-4982: --- Github user chunhui-shi commented on the issue: https://github.com/apache/drill/pull/638 Addressed your comments. > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Karthikeyan Manivannan >Priority: Critical > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x6 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > print > "{0}".format(x1),"{0}".format(x2),"{0}".format(x3),"{0}".format(x4),"{0}".format(x5),"{0}".format(x6) > python repro.py > repro.csv > 2) put these files in a dfs directory e.g. '/tmp/hiveworkspace/plain'. Under > hive prompt, use the following sql command to create an external table: > CREATE EXTERNAL TABLE `hiveworkspace`.`plain` (`id1` string, `id2` string, > `id3` string, `id4` string, `id5` string, `id6` string) ROW FORMAT SERDE > 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS TEXTFILE LOCATION > '/tmp/hiveworkspace/plain' > 3) create Hive's table of ORC|PARQUET format: > CREATE TABLE `hiveworkspace`.`plainorc` STORED AS ORC AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > CREATE TABLE `hiveworkspace`.`plainparquet` STORED AS PARQUET AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > 4) Query switch between these two tables, then the query time on the same > table significantly lengthened. On my setup, for ORC, it was 15sec -> 26secs. > Queries on table of other formats, after injecting a query to other formats, > all have significant slow down. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15713740#comment-15713740 ] ASF GitHub Bot commented on DRILL-4982: --- Github user bitblender commented on a diff in the pull request: https://github.com/apache/drill/pull/638#discussion_r90574793 --- Diff: contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveAbstractReader.java --- @@ -218,17 +229,18 @@ private void init() throws ExecutionSetupException { } } } catch (Exception e) { - throw new ExecutionSetupException("Failure while initializing HiveRecordReader: " + e.getMessage(), e); + throw new ExecutionSetupException("Failure while initializing HiveOrcReader: " + e.getMessage(), e); --- End diff -- "HiveOrcReader:" in the exception-string should be changed so that it prints the actual reader type. > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Karthikeyan Manivannan >Priority: Critical > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x6 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > print > "{0}".format(x1),"{0}".format(x2),"{0}".format(x3),"{0}".format(x4),"{0}".format(x5),"{0}".format(x6) > python repro.py > repro.csv > 2) put these files in a dfs directory e.g. '/tmp/hiveworkspace/plain'. Under > hive prompt, use the following sql command to create an external table: > CREATE EXTERNAL TABLE `hiveworkspace`.`plain` (`id1` string, `id2` string, > `id3` string, `id4` string, `id5` string, `id6` string) ROW FORMAT SERDE > 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS TEXTFILE LOCATION > '/tmp/hiveworkspace/plain' > 3) create Hive's table of ORC|PARQUET format: > CREATE TABLE `hiveworkspace`.`plainorc` STORED AS ORC AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > CREATE TABLE `hiveworkspace`.`plainparquet` STORED AS PARQUET AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > 4) Query switch between these two tables, then the query time on the same > table significantly lengthened. On my setup, for ORC, it was 15sec -> 26secs. > Queries on table of other formats, after injecting a query to other formats, > all have significant slow down. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15637501#comment-15637501 ] ASF GitHub Bot commented on DRILL-4982: --- Github user chunhui-shi commented on the issue: https://github.com/apache/drill/pull/638 The performance degradation is worse with larger tables. The degradation is >300% on a 15GB table. After this fix, this degradation disappears. There are other visible performance gains of this fix even when there is no degradation: For a simple query on ORC/Parquet table through HiveReaders, I observed the improvement is about 10%-25% and the average improved percentage is 17.6%. For TPCH tests on a 10 node cluster with Parquet tables + HiveReaders, the average improvement (of two runs) is 5.1% > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Jinfeng Ni >Priority: Critical > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x6 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > print > "{0}".format(x1),"{0}".format(x2),"{0}".format(x3),"{0}".format(x4),"{0}".format(x5),"{0}".format(x6) > python repro.py > repro.csv > 2) put these files in a dfs directory e.g. '/tmp/hiveworkspace/plain'. Under > hive prompt, use the following sql command to create an external table: > CREATE EXTERNAL TABLE `hiveworkspace`.`plain` (`id1` string, `id2` string, > `id3` string, `id4` string, `id5` string, `id6` string) ROW FORMAT SERDE > 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS TEXTFILE LOCATION > '/tmp/hiveworkspace/plain' > 3) create Hive's table of ORC|PARQUET format: > CREATE TABLE `hiveworkspace`.`plainorc` STORED AS ORC AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > CREATE TABLE `hiveworkspace`.`plainparquet` STORED AS PARQUET AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > 4) Query switch between these two tables, then the query time on the same > table significantly lengthened. On my setup, for ORC, it was 15sec -> 26secs. > Queries on table of other formats, after injecting a query to other formats, > all have significant slow down. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4982) Hive Queries degrade when queries switch between different formats
[ https://issues.apache.org/jira/browse/DRILL-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15621361#comment-15621361 ] ASF GitHub Bot commented on DRILL-4982: --- GitHub user chunhui-shi opened a pull request: https://github.com/apache/drill/pull/638 DRILL-4982: Separate Hive reader classes for different data formats t… …o improve performance. 1, Separating Hive reader classes allows optimization to apply on different classes in optimized ways. This separation effectively avoid the performance degradation of scan. 2, Do not apply Skip footer/header mechanism on most Hive formats. This skip mechanism introduces extra checks on each incoming records. You can merge this pull request into a Git repository by running: $ git pull https://github.com/chunhui-shi/drill DRILL-4982 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/drill/pull/638.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #638 commit 1e240a0dfea7970798bd550204388fc0e9bc3d42 Author: chunhui-shi Date: 2016-10-30T08:29:06Z DRILL-4982: Separate Hive reader classes for different data formats to improve performance. 1, Separating Hive reader classes allows optimization to apply on different classes in optimized ways. This separation effectively avoid the performance degradation of scan. 2, Do not apply Skip footer/header mechanism on most Hive formats. This skip mechanism introduces extra checks on each incoming records. > Hive Queries degrade when queries switch between different formats > -- > > Key: DRILL-4982 > URL: https://issues.apache.org/jira/browse/DRILL-4982 > Project: Apache Drill > Issue Type: Bug >Reporter: Chunhui Shi >Assignee: Chunhui Shi >Priority: Critical > > We have seen degraded performance by doing these steps: > 1) generate the repro data: > python script repro.py as below: > import string > import random > > for i in range(3000): > x1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > x6 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ > in range(random.randrange(19, 27))) > print > "{0}".format(x1),"{0}".format(x2),"{0}".format(x3),"{0}".format(x4),"{0}".format(x5),"{0}".format(x6) > python repro.py > repro.csv > 2) put these files in a dfs directory e.g. '/tmp/hiveworkspace/plain'. Under > hive prompt, use the following sql command to create an external table: > CREATE EXTERNAL TABLE `hiveworkspace`.`plain` (`id1` string, `id2` string, > `id3` string, `id4` string, `id5` string, `id6` string) ROW FORMAT SERDE > 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS TEXTFILE LOCATION > '/tmp/hiveworkspace/plain' > 3) create Hive's table of ORC|PARQUET format: > CREATE TABLE `hiveworkspace`.`plainorc` STORED AS ORC AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > CREATE TABLE `hiveworkspace`.`plainparquet` STORED AS PARQUET AS SELECT > id1,id2,id3,id4,id5,id6 from `hiveworkspace`.`plain`; > 4) Query switch between these two tables, then the query time on the same > table significantly lengthened. On my setup, for ORC, it was 15sec -> 26secs. > Queries on table of other formats, after injecting a query to other formats, > all have significant slow down. -- This message was sent by Atlassian JIRA (v6.3.4#6332)