-
Notifications
You must be signed in to change notification settings - Fork 938
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
[KYUUBI #2721] Implement dedicated set/get catalog/database operators #2728
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
21e5787
set/get catalog/database operators
cxzl25 9877038
add UT
cxzl25 4982ec7
hive engine 1.8
cxzl25 7f13ad8
fix server spark catalog UT
cxzl25 45caf55
fix import
cxzl25 698fbbd
set catalog/schema empty resultset
cxzl25 f62461c
use placeholders
cxzl25 a0247c7
Merge branch 'master' into KYUUBI-2721
cxzl25 ff9078a
fix UT
cxzl25 e55bb2e
style
cxzl25 3495b28
fix jdbc
cxzl25 8bc40b9
fix UT
cxzl25 2acf0a4
unused import
cxzl25 6705164
use placeholders and confOverlay
cxzl25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/GetCurrentCatalog.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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.kyuubi.engine.flink.operation | ||
|
||
import org.apache.kyuubi.engine.flink.result.ResultSetUtil | ||
import org.apache.kyuubi.operation.OperationType | ||
import org.apache.kyuubi.operation.meta.ResultSetSchemaConstant.TABLE_CAT | ||
import org.apache.kyuubi.session.Session | ||
|
||
class GetCurrentCatalog(session: Session) | ||
extends FlinkOperation(OperationType.EXECUTE_STATEMENT, session) { | ||
|
||
override protected def runInternal(): Unit = { | ||
try { | ||
val tableEnv = sessionContext.getExecutionContext.getTableEnvironment | ||
val catalog = tableEnv.getCurrentCatalog | ||
resultSet = ResultSetUtil.stringListToResultSet(List(catalog), TABLE_CAT) | ||
} catch onError() | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...l-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/GetCurrentDatabase.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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.kyuubi.engine.flink.operation | ||
|
||
import org.apache.kyuubi.engine.flink.result.ResultSetUtil | ||
import org.apache.kyuubi.operation.OperationType | ||
import org.apache.kyuubi.operation.meta.ResultSetSchemaConstant.TABLE_SCHEM | ||
import org.apache.kyuubi.session.Session | ||
|
||
class GetCurrentDatabase(session: Session) | ||
extends FlinkOperation(OperationType.EXECUTE_STATEMENT, session) { | ||
|
||
override protected def runInternal(): Unit = { | ||
try { | ||
val tableEnv = sessionContext.getExecutionContext.getTableEnvironment | ||
val database = tableEnv.getCurrentDatabase | ||
resultSet = ResultSetUtil.stringListToResultSet(List(database), TABLE_SCHEM) | ||
} catch onError() | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...ql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/SetCurrentCatalog.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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.kyuubi.engine.flink.operation | ||
|
||
import org.apache.kyuubi.operation.OperationType | ||
import org.apache.kyuubi.session.Session | ||
|
||
class SetCurrentCatalog(session: Session, catalog: String) | ||
extends FlinkOperation(OperationType.EXECUTE_STATEMENT, session) { | ||
|
||
override protected def runInternal(): Unit = { | ||
try { | ||
val tableEnv = sessionContext.getExecutionContext.getTableEnvironment | ||
tableEnv.useCatalog(catalog) | ||
setHasResultSet(false) | ||
} catch onError() | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...l-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/SetCurrentDatabase.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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.kyuubi.engine.flink.operation | ||
|
||
import org.apache.kyuubi.operation.OperationType | ||
import org.apache.kyuubi.session.Session | ||
|
||
class SetCurrentDatabase(session: Session, database: String) | ||
extends FlinkOperation(OperationType.EXECUTE_STATEMENT, session) { | ||
|
||
override protected def runInternal(): Unit = { | ||
try { | ||
val tableEnv = sessionContext.getExecutionContext.getTableEnvironment | ||
tableEnv.useDatabase(database) | ||
setHasResultSet(false) | ||
} catch onError() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/GetCurrentCatalog.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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.kyuubi.engine.hive.operation | ||
|
||
import scala.collection.JavaConverters._ | ||
|
||
import org.apache.hive.service.cli.operation.Operation | ||
|
||
import org.apache.kyuubi.operation.OperationType | ||
import org.apache.kyuubi.session.Session | ||
|
||
class GetCurrentCatalog(session: Session) | ||
extends HiveOperation(OperationType.EXECUTE_STATEMENT, session) { | ||
// Hive does not support catalog | ||
override val internalHiveOperation: Operation = | ||
delegatedOperationManager.newExecuteStatementOperation( | ||
hive, | ||
"SELECT '' AS TABLE_CAT", | ||
Map.empty[String, String].asJava, | ||
false, | ||
0) | ||
} |
37 changes: 37 additions & 0 deletions
37
...ql-engine/src/main/scala/org/apache/kyuubi/engine/hive/operation/GetCurrentDatabase.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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.kyuubi.engine.hive.operation | ||
|
||
import scala.collection.JavaConverters._ | ||
|
||
import org.apache.hive.service.cli.operation.Operation | ||
|
||
import org.apache.kyuubi.operation.OperationType | ||
import org.apache.kyuubi.session.Session | ||
|
||
class GetCurrentDatabase(session: Session) | ||
extends HiveOperation(OperationType.EXECUTE_STATEMENT, session) { | ||
|
||
override val internalHiveOperation: Operation = | ||
delegatedOperationManager.newExecuteStatementOperation( | ||
hive, | ||
"SELECT current_database()", | ||
Map.empty[String, String].asJava, | ||
false, | ||
0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@link3280 I see you comment it's fixed by FLINK-24685, should we update it?
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.
Yes, the comment could be deleted now.