Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17924#discussion_r115650693
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala ---
    @@ -0,0 +1,415 @@
    +/*
    + * 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.spark.sql.hive.orc
    +
    +import java.io.File
    +
    +import scala.util.Try
    +
    +import org.apache.hadoop.conf.Configuration
    +import org.apache.hadoop.fs.Path
    +import org.apache.hadoop.io.IntWritable
    +import org.apache.hadoop.mapreduce.{JobID, TaskAttemptID, TaskID, TaskType}
    +import org.apache.hadoop.mapreduce.lib.input.FileSplit
    +import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
    +import org.apache.orc.OrcFile
    +import org.apache.orc.mapred.OrcStruct
    +import org.apache.orc.mapreduce.OrcInputFormat
    +import org.apache.orc.storage.ql.exec.vector.{BytesColumnVector, 
LongColumnVector}
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.sql.internal.SQLConf
    +import org.apache.spark.sql.SparkSession
    +import 
org.apache.spark.sql.execution.datasources.parquet.SpecificParquetRecordReaderBase
    +import org.apache.spark.unsafe.types.UTF8String
    +import org.apache.spark.util.{Benchmark, Utils}
    +
    +
    +/**
    + * Benchmark to measure orc read performance.
    + *
    + * This is in `sql/hive` module in order to compare `sql/core` and 
`sql/hive` ORC data sources.
    + * After removing `sql/hive` ORC data sources, we need to move this into 
`sql/core` module
    + * like the other ORC test suites.
    + */
    +object OrcReadBenchmark {
    +  val conf = new SparkConf()
    +  conf.set("orc.compression", "snappy")
    +
    +  private val spark = SparkSession.builder()
    +    .master("local[1]")
    +    .appName("OrcReadBenchmark")
    +    .config(conf)
    +    .getOrCreate()
    +
    +  // Set default configs. Individual cases will change them if necessary.
    +  spark.conf.set(SQLConf.ORC_VECTORIZED_READER_ENABLED.key, "true")
    +  spark.conf.set(SQLConf.ORC_FILTER_PUSHDOWN_ENABLED.key, "true")
    +  spark.conf.set(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key, "true")
    +
    +  def withTempPath(f: File => Unit): Unit = {
    +    val path = Utils.createTempDir()
    +    path.delete()
    +    try f(path) finally Utils.deleteRecursively(path)
    +  }
    +
    +  def withTempTable(tableNames: String*)(f: => Unit): Unit = {
    +    try f finally tableNames.foreach(spark.catalog.dropTempView)
    +  }
    +
    +  def withSQLConf(pairs: (String, String)*)(f: => Unit): Unit = {
    +    val (keys, values) = pairs.unzip
    +    val currentValues = keys.map(key => Try(spark.conf.get(key)).toOption)
    +    (keys, values).zipped.foreach(spark.conf.set)
    +    try f finally {
    +      keys.zip(currentValues).foreach {
    +        case (key, Some(value)) => spark.conf.set(key, value)
    +        case (key, None) => spark.conf.unset(key)
    +      }
    +    }
    +  }
    +
    +  private val SQL_ORC_FILE_FORMAT = 
"org.apache.spark.sql.execution.datasources.orc.OrcFileFormat"
    +  private val HIVE_ORC_FILE_FORMAT = 
"org.apache.spark.sql.hive.orc.OrcFileFormat"
    --- End diff --
    
    So to avoid datasource name conflict, we may change Hive ORC datasource's 
shortName to other than "orc".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to