[GitHub] spark pull request #15182: [SPARK-17625] [SQL] set expectedOutputAttributes ...

2016-09-22 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/15182


---
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



[GitHub] spark pull request #15182: [SPARK-17625] [SQL] set expectedOutputAttributes ...

2016-09-21 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/15182#discussion_r79946424
  
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
---
@@ -2310,6 +2308,18 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
 }
   }
 
+  test("data source table created in InMemoryCatalog should guarantee 
resolving consistency") {
+val table = "tbl"
+withTable("tbl") {
+  sql("CREATE TABLE tbl(i INT, j STRING) USING parquet")
+  val tableIdent = 
spark.sessionState.sqlParser.parseTableIdentifier(table)
+  val relation = spark.sessionState.catalog.lookupRelation(tableIdent)
+  val expr = relation.resolve("i")
+  val plan = Dataset.ofRows(spark, Project(Seq(expr), relation))
+  plan.queryExecution.assertAnalyzed()
+}
+  }
--- End diff --

Your test case can be simplified to
```Scala
val tableName = "tbl"
withTable(tableName) {
  spark.range(10).select('id as 'i, 'id as 
'j).write.saveAsTable(tableName)
  val relation = 
spark.sessionState.catalog.lookupRelation(TableIdentifier(tableName))
  val expr = relation.resolve("i")
  Dataset.ofRows(spark, Project(Seq(expr), relation))
}
```


---
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