Uh oh!
There was an error while loading. Please reload this page.
[SPARK-19265][SQL] make table relation cache general and does not depend on hive - #16621
[SPARK-19265][SQL] make table relation cache general and does not depend on hive#16621cloud-fan wants to merge 1 commit into
Conversation
cloud-fan
commented
Jan 17, 2017
SparkQA
commented
Jan 17, 2017
Test build #71522 has finished for PR 16621 at commit
|
SparkQA
commented
Jan 18, 2017
Test build #71549 has finished for PR 16621 at commit
|
There was a problem hiding this comment.
How about keep the previous comment here?
// refreshTable does not eagerly reload the cache. It just invalidate the cache.
// Next time when we use the table, it will be populated in the cache.
// Since we also cache ParquetRelations converted from Hive Parquet tables and
// adding converted ParquetRelations into the cache is not defined in the load function
// of the cache (instead, we add the cache entry in convertToParquetRelation),
// it is better at here to invalidate the cache to avoid confusing waring logs from the
// cache loader (e.g. cannot find data source provider, which is only defined for
// data source table.).
There was a problem hiding this comment.
After an offline discussion, I am fine to remove it. Thanks!
There was a problem hiding this comment.
We are having a case sensitivity issue here, right? Previously, we always make both database and table to lower cases. Database and table names are not case sensitive.
There was a problem hiding this comment.
If users don't change the case sensitive config at runtime, it will be ok.
There was a problem hiding this comment.
This change is to avoid overriding lookupRelation in HiveMetastoreCatalog , right?
There was a problem hiding this comment.
yea, now lookupRelation will return SimpleCatalogRelation and other analyzer rules will convert it to LogicalRelation or MetastoreRelation
There was a problem hiding this comment.
I checked the test cases. ORC has the same issue, but the default value is false currently. Thus, I think we should set CONVERT_METASTORE_ORC to false too, in case we will change the default value of CONVERT_METASTORE_ORC in the future.
There was a problem hiding this comment.
// In older version(prior to 2.1) of Spark, the table schema can be empty and should be
// inferred at runtime. We should still support it.
Is it still valid?
gatorsmile
commented
Jan 18, 2017
Could we rename |
cloud-fan
commented
Jan 18, 2017
can we do it later? We are going to merge |
SparkQA
commented
Jan 18, 2017
Test build #71567 has finished for PR 16621 at commit
|
gatorsmile
commented
Jan 18, 2017
Sure. No problem. |
SparkQA
commented
Jan 18, 2017
Test build #71572 has started for PR 16621 at commit |
SparkQA
commented
Jan 18, 2017
Test build #71574 has started for PR 16621 at commit |
There was a problem hiding this comment.
Should we keep the existing way? This was introduced for the EXPLAIN command of view. See the PR: #14657
There was a problem hiding this comment.
the existing way is to set None, see https://github.com/apache/spark/pull/16621/files#diff-ca4533edbf148c89cc0c564ab6b0aeaaL75
This shows the evil of duplicated code, we have inconsistent behaviors with and without hive support. I think we should only set table identifier for persisted view, @hvanhovell is that true?
There was a problem hiding this comment.
Sorry, I have been living under a rock for the past month or so.
This is not really needed anymore. Lets remove it.
gatorsmile
commented
Jan 18, 2017
No more comments. It looks pretty good! Let us see whether all the test cases can pass. |
SparkQA
commented
Jan 18, 2017
Test build #71576 has started for PR 16621 at commit |
There was a problem hiding this comment.
Note that, previously we will set expectedOutputAttributes here, which was added by #15182
However, this doesn't work when the table schema needs to be inferred at runtime, and it turns out that we don't need to do it at all. AnalyzeColumnCommand now gets attributes from the resolved table relation plan , so it's fine for rule FindDataSourceTable to change outputs during analysis.
There was a problem hiding this comment.
ok, then we can revert it without changing the analyze part.
There was a problem hiding this comment.
we don't need this test anymore, see https://github.com/apache/spark/pull/16621/files#r96577427
There was a problem hiding this comment.
this test was removed in #16003, but I find it's still useful and is not covered by other tests, so I add it back.
gatorsmile
commented
Jan 18, 2017
After merging #16517, it introduces a few conflicts. |
SparkQA
commented
Jan 18, 2017
Test build #71583 has finished for PR 16621 at commit
|
| /** | ||
| * A cache of qualified table name to table relation plan. | ||
| */ | ||
| val tableRelationCache: Cache[QualifiedTableName, LogicalPlan] = { |
There was a problem hiding this comment.
Hi, @cloud-fan .
Why not making this config in this PR? It seems to be easy.
There was a problem hiding this comment.
yea it's easy, but I wanna minimal the code changes so it's easier to review.
gatorsmile
commented
Jan 19, 2017
LGTM |
gatorsmile
commented
Jan 19, 2017
Thanks! Merging to master. |
…end on hive ## What changes were proposed in this pull request? We have a table relation plan cache in `HiveMetastoreCatalog`, which caches a lot of things: file status, resolved data source, inferred schema, etc. However, it doesn't make sense to limit this cache with hive support, we should move it to SQL core module so that users can use this cache without hive support. It can also reduce the size of `HiveMetastoreCatalog`, so that it's easier to remove it eventually. main changes: 1. move the table relation cache to `SessionCatalog` 2. `SessionCatalog.lookupRelation` will return `SimpleCatalogRelation` and the analyzer will convert it to `LogicalRelation` or `MetastoreRelation` later, then `HiveSessionCatalog` doesn't need to override `lookupRelation` anymore 3. `FindDataSourceTable` will read/write the table relation cache. ## How was this patch tested? existing tests. Author: Wenchen Fan <wenchen@databricks.com> Closesapache#16621 from cloud-fan/plan-cache.
…end on hive ## What changes were proposed in this pull request? We have a table relation plan cache in `HiveMetastoreCatalog`, which caches a lot of things: file status, resolved data source, inferred schema, etc. However, it doesn't make sense to limit this cache with hive support, we should move it to SQL core module so that users can use this cache without hive support. It can also reduce the size of `HiveMetastoreCatalog`, so that it's easier to remove it eventually. main changes: 1. move the table relation cache to `SessionCatalog` 2. `SessionCatalog.lookupRelation` will return `SimpleCatalogRelation` and the analyzer will convert it to `LogicalRelation` or `MetastoreRelation` later, then `HiveSessionCatalog` doesn't need to override `lookupRelation` anymore 3. `FindDataSourceTable` will read/write the table relation cache. ## How was this patch tested? existing tests. Author: Wenchen Fan <wenchen@databricks.com> Closesapache#16621 from cloud-fan/plan-cache.
What changes were proposed in this pull request?
We have a table relation plan cache in
HiveMetastoreCatalog, which caches a lot of things: file status, resolved data source, inferred schema, etc.However, it doesn't make sense to limit this cache with hive support, we should move it to SQL core module so that users can use this cache without hive support.
It can also reduce the size of
HiveMetastoreCatalog, so that it's easier to remove it eventually.main changes:
SessionCatalogSessionCatalog.lookupRelationwill returnSimpleCatalogRelationand the analyzer will convert it toLogicalRelationorMetastoreRelationlater, thenHiveSessionCatalogdoesn't need to overridelookupRelationanymoreFindDataSourceTablewill read/write the table relation cache.How was this patch tested?
existing tests.