Skip to content

Conversation

@cloud-fan
Copy link
Contributor

This PR takes over #8389.

This PR improves checkAnswer to print the partially analyzed plan in addition to the user friendly error message, in order to aid debugging failing tests.

In doing so, I ran into a conflict with the various ways that we bring a SQLContext into the tests. Depending on the trait we refer to the current context as sqlContext, _sqlContext, ctx or hiveContext with access modifiers public, protected and private depending on the defining class.

I propose we refactor as follows:

  1. All tests should only refer to a protected sqlContext when testing general features, and protected hiveContext when it is a method that only exists on a HiveContext.
  2. All tests should only import testImplicits._ (i.e., don't import TestHive.implicits._)

@cloud-fan cloud-fan force-pushed the cleanupTests branch 3 times, most recently from 61708d8 to 41a5f90 Compare September 3, 2015 14:34
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the ctx alias for sqlContext, and changed a lot of lines of code which is trival actually. It's not a big deal to keep an alias, so if you think it's unnecessary, I'll roll back it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. Since we often deal with both spark and sql contexts, I'd like to uniformly use sqlContext throughout the codebase.

@SparkQA
Copy link

SparkQA commented Sep 3, 2015

Test build #41970 has finished for PR 8584 at commit 41a5f90.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • abstract class QueryTest extends PlanTest
    • class PlannerSuite extends SharedSQLContext
    • class JDBCWriteSuite extends SharedSQLContext with BeforeAndAfter
    • implicit class StringToColumn(val sc: StringContext)
    • trait TestHiveSingleton
    • class CachedTableSuite extends QueryTest with TestHiveSingleton
    • class ErrorPositionSuite extends QueryTest with TestHiveSingleton with BeforeAndAfter
    • class HiveDataFrameAnalyticsSuite extends QueryTest with TestHiveSingleton with BeforeAndAfterAll
    • class HiveDataFrameJoinSuite extends QueryTest with TestHiveSingleton
    • class HiveDataFrameWindowSuite extends QueryTest with TestHiveSingleton
    • class HiveMetastoreCatalogSuite extends SparkFunSuite with TestHiveSingleton
    • class HiveParquetSuite extends QueryTest with ParquetTest with TestHiveSingleton
    • class InsertIntoHiveTableSuite extends QueryTest with TestHiveSingleton with BeforeAndAfter
    • class ListTablesSuite extends QueryTest with TestHiveSingleton with BeforeAndAfterAll
    • class MetastoreDataSourcesSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class MultiDatabaseSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class ParquetHiveCompatibilitySuite extends ParquetCompatibilityTest with TestHiveSingleton
    • class QueryPartitionSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class StatisticsSuite extends QueryTest with TestHiveSingleton
    • class UDFSuite extends QueryTest with TestHiveSingleton
    • abstract class AggregationQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class HiveExplainSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class HiveOperatorQueryableSuite extends QueryTest with TestHiveSingleton
    • class HivePlanTest extends QueryTest with TestHiveSingleton
    • class HiveUDFSuite extends QueryTest with TestHiveSingleton
    • class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class ScriptTransformationSuite extends SparkPlanTest with TestHiveSingleton
    • class OrcPartitionDiscoverySuite extends QueryTest with TestHiveSingleton with BeforeAndAfterAll
    • abstract class OrcSuite extends QueryTest with TestHiveSingleton with BeforeAndAfterAll
    • abstract class ParquetPartitioningTest extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class CommitFailureTestRelationSuite extends SQLTestUtils with TestHiveSingleton
    • abstract class HadoopFsRelationTest extends QueryTest with SQLTestUtils with TestHiveSingleton

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't access SQLTestUtils in this file, not sure why.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah weird, I tried it locally too and I can't even import it, we can just leave it then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQLTestUtils is in test scope. TestHive is in main.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK we can just leave it then. (why is TestHive in main??)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used by the hive console (build/sbt -Phive hive/console).

@cloud-fan
Copy link
Contributor Author

retest this please.

@cloud-fan
Copy link
Contributor Author

cc @andrewor14

@SparkQA
Copy link

SparkQA commented Sep 3, 2015

Test build #41973 has finished for PR 8584 at commit a9ae3f5.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai
Copy link
Contributor

yhuai commented Sep 3, 2015

There is compilation error in InMemoryColumnarQuerySuite. Also, why this PR has significantly more changes than the original one?

@andrewor14
Copy link
Contributor

I think it's cause it renames ctx to sqlContext, which I think @marmbrus agrees is a good idea IIRC.

@SparkQA
Copy link

SparkQA commented Sep 3, 2015

Test build #41975 has finished for PR 8584 at commit 0faa5ba.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: these could just be sparkContext I think. You can do a grep to find these.

@andrewor14
Copy link
Contributor

Looks great. There are many places where we still do sqlContext.sparkContext but that's no longer necessary. You can to a search and replace to clean that up (not all occurrences are relevant, however). Looks like it's still failing the style test. Can you fix it?

@SparkQA
Copy link

SparkQA commented Sep 4, 2015

Test build #41988 has finished for PR 8584 at commit 6db29b5.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • abstract class QueryTest extends PlanTest
    • class PlannerSuite extends SharedSQLContext
    • class JDBCWriteSuite extends SharedSQLContext with BeforeAndAfter
    • implicit class StringToColumn(val sc: StringContext)
    • trait TestHiveSingleton
    • class CachedTableSuite extends QueryTest with TestHiveSingleton
    • class ErrorPositionSuite extends QueryTest with TestHiveSingleton with BeforeAndAfter
    • class HiveDataFrameAnalyticsSuite extends QueryTest with TestHiveSingleton with BeforeAndAfterAll
    • class HiveDataFrameJoinSuite extends QueryTest with TestHiveSingleton
    • class HiveDataFrameWindowSuite extends QueryTest with TestHiveSingleton
    • class HiveMetastoreCatalogSuite extends SparkFunSuite with TestHiveSingleton
    • class HiveParquetSuite extends QueryTest with ParquetTest with TestHiveSingleton
    • class InsertIntoHiveTableSuite extends QueryTest with TestHiveSingleton with BeforeAndAfter
    • class ListTablesSuite extends QueryTest with TestHiveSingleton with BeforeAndAfterAll
    • class MetastoreDataSourcesSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class MultiDatabaseSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class ParquetHiveCompatibilitySuite extends ParquetCompatibilityTest with TestHiveSingleton
    • class QueryPartitionSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class StatisticsSuite extends QueryTest with TestHiveSingleton
    • class UDFSuite extends QueryTest with TestHiveSingleton
    • abstract class AggregationQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class HiveExplainSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class HiveOperatorQueryableSuite extends QueryTest with TestHiveSingleton
    • class HivePlanTest extends QueryTest with TestHiveSingleton
    • class HiveUDFSuite extends QueryTest with TestHiveSingleton
    • class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class ScriptTransformationSuite extends SparkPlanTest with TestHiveSingleton
    • class OrcPartitionDiscoverySuite extends QueryTest with TestHiveSingleton with BeforeAndAfterAll
    • abstract class OrcSuite extends QueryTest with TestHiveSingleton with BeforeAndAfterAll
    • abstract class ParquetPartitioningTest extends QueryTest with SQLTestUtils with TestHiveSingleton
    • class CommitFailureTestRelationSuite extends SQLTestUtils with TestHiveSingleton
    • abstract class HadoopFsRelationTest extends QueryTest with SQLTestUtils with TestHiveSingleton

@andrewor14
Copy link
Contributor

OK LGTM I'm merging this into master thanks @marmbrus @cloud-fan

@yhuai
Copy link
Contributor

yhuai commented Sep 4, 2015

@andrewor14 have you merged it?

asfgit pushed a commit that referenced this pull request Sep 5, 2015
Jenkins master builders are currently broken by a merge conflict between PR #8584 and PR #8155.

Author: Cheng Lian <[email protected]>

Closes #8614 from liancheng/hotfix/fix-pr-8155-8584-conflict.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants