From 358af1ac6f90665bc2c32bb6ebc445bb81d6f944 Mon Sep 17 00:00:00 2001 From: Yin Huai Date: Wed, 30 Jul 2014 13:04:44 -0700 Subject: [PATCH] Make partition_based_table_scan_with_different_serde run atomically. --- ...t_serde-0-1436cccda63b78dd6e43a399da6cc474 | 0 ...t_serde-1-8d9bf54373f45bc35f8cb6e82771b154 | 0 ...t_serde-2-7816c17905012cf381abf93d230faa8d | 0 ...t_serde-3-90089a6db3c3d8ee5ff5ea6b9153b3cc | 0 ..._serde-4-8caed2a6e80250a6d38a59388679c298} | 0 .../hive/execution/HiveTableScanSuite.scala | 45 ++++++++----------- 6 files changed, 19 insertions(+), 26 deletions(-) create mode 100644 sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-0-1436cccda63b78dd6e43a399da6cc474 create mode 100644 sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-1-8d9bf54373f45bc35f8cb6e82771b154 create mode 100644 sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-2-7816c17905012cf381abf93d230faa8d create mode 100644 sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-3-90089a6db3c3d8ee5ff5ea6b9153b3cc rename sql/hive/src/test/resources/golden/{partition_based_table_scan_with_different_serde-0-8caed2a6e80250a6d38a59388679c298 => partition_based_table_scan_with_different_serde-4-8caed2a6e80250a6d38a59388679c298} (100%) diff --git a/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-0-1436cccda63b78dd6e43a399da6cc474 b/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-0-1436cccda63b78dd6e43a399da6cc474 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-1-8d9bf54373f45bc35f8cb6e82771b154 b/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-1-8d9bf54373f45bc35f8cb6e82771b154 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-2-7816c17905012cf381abf93d230faa8d b/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-2-7816c17905012cf381abf93d230faa8d new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-3-90089a6db3c3d8ee5ff5ea6b9153b3cc b/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-3-90089a6db3c3d8ee5ff5ea6b9153b3cc new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-0-8caed2a6e80250a6d38a59388679c298 b/sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-4-8caed2a6e80250a6d38a59388679c298 similarity index 100% rename from sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-0-8caed2a6e80250a6d38a59388679c298 rename to sql/hive/src/test/resources/golden/partition_based_table_scan_with_different_serde-4-8caed2a6e80250a6d38a59388679c298 diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveTableScanSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveTableScanSuite.scala index bcb00f871d185..c5736723b47c0 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveTableScanSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveTableScanSuite.scala @@ -17,32 +17,25 @@ package org.apache.spark.sql.hive.execution -import org.scalatest.{BeforeAndAfterAll, FunSuite} - -import org.apache.spark.{SparkConf, SparkContext} -import org.apache.spark.sql.hive.test.TestHive - class HiveTableScanSuite extends HiveComparisonTest { - // MINOR HACK: You must run a query before calling reset the first time. - TestHive.hql("SHOW TABLES") - TestHive.reset() - - TestHive.hql("""CREATE TABLE part_scan_test (key STRING, value STRING) PARTITIONED BY (ds STRING) - | ROW FORMAT SERDE - | 'org.apache.hadoop.hive.serde2.columnar.LazyBinaryColumnarSerDe' - | STORED AS RCFILE - """.stripMargin) - TestHive.hql("""FROM src - | INSERT INTO TABLE part_scan_test PARTITION (ds='2010-01-01') - | SELECT 100,100 LIMIT 1 - """.stripMargin) - TestHive.hql("""ALTER TABLE part_scan_test SET SERDE - | 'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe' - """.stripMargin) - TestHive.hql("""FROM src INSERT INTO TABLE part_scan_test PARTITION (ds='2010-01-02') - | SELECT 200,200 LIMIT 1 - """.stripMargin) - createQueryTest("partition_based_table_scan_with_different_serde", - "SELECT * from part_scan_test", false) + createQueryTest("partition_based_table_scan_with_different_serde", + """ + |CREATE TABLE part_scan_test (key STRING, value STRING) PARTITIONED BY (ds STRING) + |ROW FORMAT SERDE + |'org.apache.hadoop.hive.serde2.columnar.LazyBinaryColumnarSerDe' + |STORED AS RCFILE; + | + |FROM src + |INSERT INTO TABLE part_scan_test PARTITION (ds='2010-01-01') + |SELECT 100,100 LIMIT 1; + | + |ALTER TABLE part_scan_test SET SERDE + |'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe'; + | + |FROM src INSERT INTO TABLE part_scan_test PARTITION (ds='2010-01-02') + |SELECT 200,200 LIMIT 1; + | + |SELECT * from part_scan_test; + """.stripMargin) }