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-39319][CORE][SQL] Make query contexts as a part of SparkThrowable
#37209
Changes from 22 commits
2ddaf26
9575a41
51e7813
48cc9eb
758ecde
a6ab09f
2dc083a
c421925
0b26f54
d4431f6
cfc1ad2
d77a7f6
508cea4
29e9832
27df456
ee98642
694c272
c6d3a5a
d0542c0
36a2fbf
4338354
18f767f
d02cdeb
4d74636
a93e2d4
d1f9276
59a284e
9159969
0c92987
8dd5b60
113c562
248a2fa
c533267
7095af5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark; | ||
|
||
import org.apache.spark.annotation.Evolving; | ||
|
||
/** | ||
* Query context of a {@link SparkThrowable}. It helps users understand where error occur | ||
* while executing queries. | ||
* | ||
* @since 3.4.0 | ||
*/ | ||
@Evolving | ||
public interface QueryContext { | ||
// The object type of the query which throws the exception. | ||
// If the exception is directly from the main query, it should be an empty string. | ||
// Otherwise, it should be the exact object type in upper case. For example, a "VIEW". | ||
String objectType(); | ||
|
||
// The object name of the query which throws the exception. | ||
// If the exception is directly from the main query, it should be an empty string. | ||
// Otherwise, it should be the object name. For example, a view name "V1". | ||
String objectName(); | ||
|
||
// The starting index in the query text which throws the exception. The index starts from 0. | ||
int startIndex(); | ||
|
||
// The stopping index in the query which throws the exception. The index starts from 0. | ||
int stopIndex(); | ||
|
||
// The corresponding fragment of the query which throws the exception. | ||
String fragment(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark; | ||
|
||
import org.apache.spark.annotation.Evolving; | ||
|
||
/** | ||
* Build textual summary from a query context. | ||
* | ||
* @since 3.4.0 | ||
*/ | ||
@Evolving | ||
public interface QueryContextSummary extends QueryContext { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this need to be a public API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made it as a private one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is Java. Does such syntax work here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it's for internal use only, we can write it in Scala. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, I don't think we need this interface. Having SQLQueryContext is enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me try to remove it ... |
||
// Textual summary of the query context | ||
String summary(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not related to this PR, but we should use javadoc for public APIs, which will show up in our API doc. The same to
SparkThrowable
. We can fix them all in a followup.