-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix the wrong parsing of jvm parameters in jdbc URL #11
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -97,6 +97,12 @@ SCOPE_TABLE: 'SCOPE_TABLE'; | |
SOURCE_DATA_TYPE: 'SOURCE_DATA_TYPE'; | ||
IS_AUTOINCREMENT: 'IS_AUTOINCREMENT'; | ||
IS_GENERATEDCOLUMN: 'IS_GENERATEDCOLUMN'; | ||
VARCHAR: 'VARCHAR'; | ||
SMALLINT: 'SMALLINT'; | ||
CAST: 'CAST'; | ||
AS: 'AS'; | ||
KEY_SEQ: 'KEY_SEQ'; | ||
PK_NAME: 'PK_NAME'; | ||
|
||
fragment SEARCH_STRING_ESCAPE: '\'' '\\' '\''; | ||
|
||
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. 这段代码是一个补丁(patch),它包含了一些变量的添加和一个字符转义片段。 添加的变量有:
这些变量是用于数据库模型中的一些属性的,该补丁在数据库操作时可能会用到。 另外,代码中还定义了一个字符转义片段 SEARCH_STRING_ESCAPE,用于转义单引号和反斜杠符号。 就整体而言,这个补丁代码没有看到任何明显的风险和改进建议。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,13 @@ statement | |
SOURCE_DATA_TYPE COMMA IS_AUTOINCREMENT COMMA IS_GENERATEDCOLUMN FROM SYSTEM_JDBC_COLUMNS | ||
(WHERE tableCatalogFilter? AND? tableSchemaFilter? AND? tableNameFilter? AND? colNameFilter?)? | ||
ORDER BY TABLE_CAT COMMA TABLE_SCHEM COMMA TABLE_NAME COMMA ORDINAL_POSITION #getColumns | ||
| SELECT CAST LEFT_PAREN NULL AS VARCHAR RIGHT_PAREN TABLE_CAT COMMA | ||
CAST LEFT_PAREN NULL AS VARCHAR RIGHT_PAREN TABLE_SCHEM COMMA | ||
CAST LEFT_PAREN NULL AS VARCHAR RIGHT_PAREN TABLE_NAME COMMA | ||
CAST LEFT_PAREN NULL AS VARCHAR RIGHT_PAREN COLUMN_NAME COMMA | ||
CAST LEFT_PAREN NULL AS SMALLINT RIGHT_PAREN KEY_SEQ COMMA | ||
CAST LEFT_PAREN NULL AS VARCHAR RIGHT_PAREN PK_NAME | ||
WHERE FALSE #getPrimaryKeys | ||
| .*? #passThrough | ||
; | ||
|
||
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. 这段代码补丁看起来是在修改 SQL 查询语句,主要的变化如下:
如果查询语句本身没有逻辑问题,这个补丁应该不会引入太大的风险。然而,我们无法确认新增的 "getPrimaryKeys" 是否存在潜在的错误或是遗漏的实现部分,需要进行进一步的检查或完善。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ import org.apache.kyuubi.operation.OperationHandle | |
import org.apache.kyuubi.service.BackendService | ||
import org.apache.kyuubi.sql.parser.trino.KyuubiTrinoFeParser | ||
import org.apache.kyuubi.sql.plan.PassThroughNode | ||
import org.apache.kyuubi.sql.plan.trino.{GetCatalogs, GetColumns, GetSchemas, GetTables, GetTableTypes, GetTypeInfo} | ||
import org.apache.kyuubi.sql.plan.trino.{GetCatalogs, GetColumns, GetPrimaryKeys, GetSchemas, GetTables, GetTableTypes, GetTypeInfo} | ||
|
||
class KyuubiTrinoOperationTranslator(backendService: BackendService) { | ||
lazy val parser = new KyuubiTrinoFeParser() | ||
|
@@ -68,6 +68,11 @@ class KyuubiTrinoOperationTranslator(backendService: BackendService) { | |
schemaPattern, | ||
tableNamePattern, | ||
colNamePattern) | ||
case GetPrimaryKeys() => | ||
val operationHandle = backendService.getPrimaryKeys(sessionHandle, null, null, null) | ||
// The trino implementation always returns empty. | ||
operationHandle.setHasResultSet(false) | ||
operationHandle | ||
case PassThroughNode() => | ||
backendService.executeStatement(sessionHandle, statement, configs, runAsync, queryTimeout) | ||
} | ||
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. 这段代码在导入包后,扩展了 在函数 在风险和改进方面,由于我没有上下文信息,无法判断是否存在风险或者提供改进建议。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ import org.apache.kyuubi.sql.KyuubiTrinoFeBaseParser._ | |
import org.apache.kyuubi.sql.KyuubiTrinoFeBaseParserBaseVisitor | ||
import org.apache.kyuubi.sql.parser.KyuubiParser.unescapeSQLString | ||
import org.apache.kyuubi.sql.plan.{KyuubiTreeNode, PassThroughNode} | ||
import org.apache.kyuubi.sql.plan.trino.{GetCatalogs, GetColumns, GetSchemas, GetTables, GetTableTypes, GetTypeInfo} | ||
import org.apache.kyuubi.sql.plan.trino.{GetCatalogs, GetColumns, GetPrimaryKeys, GetSchemas, GetTables, GetTableTypes, GetTypeInfo} | ||
|
||
class KyuubiTrinoFeAstBuilder extends KyuubiTrinoFeBaseParserBaseVisitor[AnyRef] { | ||
|
||
|
@@ -92,6 +92,10 @@ class KyuubiTrinoFeAstBuilder extends KyuubiTrinoFeBaseParserBaseVisitor[AnyRef] | |
GetColumns(catalog, schemaPattern, tableNamePattern, colNamePattern) | ||
} | ||
|
||
override def visitGetPrimaryKeys(ctx: GetPrimaryKeysContext): KyuubiTreeNode = { | ||
GetPrimaryKeys() | ||
} | ||
|
||
override def visitNullCatalog(ctx: NullCatalogContext): AnyRef = { | ||
null | ||
} | ||
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. 这段代码看起来没有明显的错误风险,只是对于该代码功能的了解不足,无法给出完整性能改进建议。 在这个代码段中,开发人员想在Trino查询引擎中添加获取主键信息的功能(通过 GetPrimaryKeys 函数)。此外,还有一些更改涉及导入和类方法重写。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,3 +55,7 @@ case class GetColumns( | |
colNamePattern: String) extends KyuubiTreeNode { | ||
override def name(): String = "Get Columns" | ||
} | ||
|
||
case class GetPrimaryKeys() extends KyuubiTreeNode { | ||
override def name(): String = "Get Primary Keys" | ||
} | ||
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. 这段代码补丁中新增了一个名为 从这段代码来看,似乎没有明显的错误或缺陷。如果想要完整地评估代码中的风险和提出改进建议,则需要更深入地研究该方法使用的编程语言、框架、第三方库以及系统设计。 |
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.
这段代码主要是对Hive JDBC连接字符串进行解析,提取其中的相关信息并填充到对象中。以下是一些注释:
根据这段代码,以下是我的注释: