Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-36895][SQL][FOLLOWUP] Use property to specify index type #34486

Closed
wants to merge 9 commits into from

Conversation

huaxingao
Copy link
Contributor

What changes were proposed in this pull request?

use property to specify index type

Why are the changes needed?

to address this comment #34148 (comment)

Does this PR introduce any user-facing change?

Yes

  void createIndex(String indexName,
      String indexType,
      NamedReference[] columns,
      Map<NamedReference, Map<String, String>> columnsProperties,
      Map<String, String> properties)

changed to

createIndex(String indexName,
      NamedReference[] columns,
      Map<NamedReference, Map<String, String>> columnsProperties,
      Map<String, String> properties

How was this patch tested?

new test

@github-actions github-actions bot added the SQL label Nov 4, 2021
@SparkQA
Copy link

SparkQA commented Nov 4, 2021

Test build #144909 has finished for PR 34486 at commit e282022.

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

@SparkQA
Copy link

SparkQA commented Nov 4, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49379/

@SparkQA
Copy link

SparkQA commented Nov 4, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49379/

@SparkQA
Copy link

SparkQA commented Nov 4, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49380/

@SparkQA
Copy link

SparkQA commented Nov 4, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49380/

@SparkQA
Copy link

SparkQA commented Nov 4, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49381/

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49381/

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49382/

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49382/

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Test build #144910 has finished for PR 34486 at commit f6decfb.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Test build #144911 has finished for PR 34486 at commit b9ce735.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Test build #144912 has finished for PR 34486 at commit 9ba3f8a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.


CreateIndex(
createUnresolvedTable(ctx.multipartIdentifier(), "CREATE INDEX"),
indexName,
indexType,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep the plan unchanged. We should put indexType in the properties in CreateIndexExec.

Also let's not hardcode the property name. We can add a static constant in SupportsIndex, similar to TableCatalog.PROP_PROVIDER

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49410/

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49410/

@SparkQA
Copy link

SparkQA commented Nov 5, 2021

Test build #144938 has finished for PR 34486 at commit b2f1f90.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

// MySQL doesn't allow property set on individual column, so use empty Array for
// column properties
jdbcTable.createIndex("i1", "BTREE", Array(FieldReference("col1")),
jdbcTable.createIndex("i1", Array(FieldReference("col1")),
Copy link
Contributor

Choose a reason for hiding this comment

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

TBH it's a bit weird to write UT in this suite. Can we turn it into end-to-end test now as we have the SQL syntax ready?

table match {
case s: SupportsIndex =>
val propertiesWithIndexType: Map[String, String] = if (indexType.nonEmpty) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we put it inside CreateIndexExec?

table match {
case s: SupportsIndex =>
val propertiesWithIndexType: Map[String, String] = if (indexType.nonEmpty) {
properties + ("indexType" -> indexType)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's not hardcode the property name

…log/index/SupportsIndex.java

Co-authored-by: Wenchen Fan <cloud0fan@gmail.com>
@SparkQA
Copy link

SparkQA commented Nov 8, 2021

Test build #144984 has finished for PR 34486 at commit 27939f8.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 8, 2021

Kubernetes integration test unable to build dist.

exiting with code: 1
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49455/

@@ -432,7 +432,7 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
AlterTableExec(table.catalog, table.identifier, a.changes) :: Nil

case CreateIndex(ResolvedTable(_, _, table, _),
indexName, indexType, ifNotExists, columns, properties) =>
indexName, indexType, ifNotExists, columns, properties) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary change.

@SparkQA
Copy link

SparkQA commented Nov 8, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49457/

@SparkQA
Copy link

SparkQA commented Nov 8, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49459/

@SparkQA
Copy link

SparkQA commented Nov 8, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49457/

@SparkQA
Copy link

SparkQA commented Nov 8, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49459/

@SparkQA
Copy link

SparkQA commented Nov 8, 2021

Test build #144987 has finished for PR 34486 at commit 277e741.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 4011dd6 Nov 8, 2021
@sarutak
Copy link
Member

sarutak commented Nov 8, 2021

@huaxingao @cloud-fan Sorry, but I'll revert this change because of the GA failure, which seems to be related this change.
https://github.com/huaxingao/spark/runs/4135539301?check_suite_focus=true#step:9:5083

@huaxingao
Copy link
Contributor Author

sorry

sarutak pushed a commit that referenced this pull request Nov 8, 2021
### What changes were proposed in this pull request?
use property to specify index type

### Why are the changes needed?
fix scala doc in #34486 and resubmit

### Does this PR introduce _any_ user-facing change?
Yes
```
  void createIndex(String indexName,
      String indexType,
      NamedReference[] columns,
      Map<NamedReference, Map<String, String>> columnsProperties,
      Map<String, String> properties)
```
changed to
```
createIndex(String indexName,
      NamedReference[] columns,
      Map<NamedReference, Map<String, String>> columnsProperties,
      Map<String, String> properties
```

### How was this patch tested?
new test

Closes #34523 from huaxingao/newDelete.

Authored-by: Huaxin Gao <huaxin_gao@apple.com>
Signed-off-by: Kousuke Saruta <sarutak@oss.nttdata.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants