Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
34af3a74
F
flink
项目概览
doujutun3207
/
flink
与 Fork 源项目一致
从无法访问的项目Fork
通知
24
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flink
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
34af3a74
编写于
10月 16, 2018
作者:
T
Timo Walther
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[hotfix] [table] Refactor SqlToConverter configuration
This closes #6857.
上级
9f31d5c7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
26 deletion
+20
-26
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala
...n/scala/org/apache/flink/table/api/TableEnvironment.scala
+16
-20
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala
...ala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala
+2
-2
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/utils/ExpressionTestBase.scala
...he/flink/table/expressions/utils/ExpressionTestBase.scala
+1
-2
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/match/PatternTranslatorTestBase.scala
.../apache/flink/table/match/PatternTranslatorTestBase.scala
+1
-2
未找到文件。
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala
浏览文件 @
34af3a74
...
...
@@ -91,6 +91,7 @@ abstract class TableEnvironment(val config: TableConfig) {
.
costFactory
(
new
DataSetCostFactory
)
.
typeSystem
(
new
FlinkTypeSystem
)
.
operatorTable
(
getSqlOperatorTable
)
.
sqlToRelConverterConfig
(
getSqlToRelConverterConfig
)
// set the executor to evaluate constant expressions
.
executor
(
new
ExpressionReducer
(
config
))
.
build
...
...
@@ -109,15 +110,6 @@ abstract class TableEnvironment(val config: TableConfig) {
// registered external catalog names -> catalog
private
val
externalCatalogs
=
new
mutable
.
HashMap
[
String
,
ExternalCatalog
]
// configuration for SqlToRelConverter
private
[
flink
]
lazy
val
sqlToRelConverterConfig
:
SqlToRelConverter.Config
=
{
val
calciteConfig
=
config
.
getCalciteConfig
calciteConfig
.
getSqlToRelConverterConfig
match
{
case
Some
(
c
)
=>
c
case
None
=>
getSqlToRelConverterConfig
}
}
/** Returns the table config to define the runtime behavior of the Table API. */
def
getConfig
:
TableConfig
=
config
...
...
@@ -132,11 +124,18 @@ abstract class TableEnvironment(val config: TableConfig) {
* Returns the SqlToRelConverter config.
*/
protected
def
getSqlToRelConverterConfig
:
SqlToRelConverter.Config
=
{
SqlToRelConverter
.
configBuilder
()
.
withTrimUnusedFields
(
false
)
.
withConvertTableAccess
(
false
)
.
withInSubQueryThreshold
(
Integer
.
MAX_VALUE
)
.
build
()
val
calciteConfig
=
config
.
getCalciteConfig
calciteConfig
.
getSqlToRelConverterConfig
match
{
case
None
=>
SqlToRelConverter
.
configBuilder
()
.
withTrimUnusedFields
(
false
)
.
withConvertTableAccess
(
false
)
.
withInSubQueryThreshold
(
Integer
.
MAX_VALUE
)
.
build
()
case
Some
(
c
)
=>
c
}
}
/**
...
...
@@ -717,8 +716,7 @@ abstract class TableEnvironment(val config: TableConfig) {
val
planner
=
new
FlinkPlannerImpl
(
getFrameworkConfig
,
getPlanner
,
getTypeFactory
,
sqlToRelConverterConfig
)
getTypeFactory
)
planner
.
getCompletionHints
(
statement
,
position
)
}
...
...
@@ -740,8 +738,7 @@ abstract class TableEnvironment(val config: TableConfig) {
* @return The result of the query as Table
*/
def
sqlQuery
(
query
:
String
)
:
Table
=
{
val
planner
=
new
FlinkPlannerImpl
(
getFrameworkConfig
,
getPlanner
,
getTypeFactory
,
sqlToRelConverterConfig
)
val
planner
=
new
FlinkPlannerImpl
(
getFrameworkConfig
,
getPlanner
,
getTypeFactory
)
// parse the sql query
val
parsed
=
planner
.
parse
(
query
)
if
(
null
!=
parsed
&&
parsed
.
getKind
.
belongsTo
(
SqlKind
.
QUERY
))
{
...
...
@@ -801,8 +798,7 @@ abstract class TableEnvironment(val config: TableConfig) {
* @param config The [[QueryConfig]] to use.
*/
def
sqlUpdate
(
stmt
:
String
,
config
:
QueryConfig
)
:
Unit
=
{
val
planner
=
new
FlinkPlannerImpl
(
getFrameworkConfig
,
getPlanner
,
getTypeFactory
,
sqlToRelConverterConfig
)
val
planner
=
new
FlinkPlannerImpl
(
getFrameworkConfig
,
getPlanner
,
getTypeFactory
)
// parse the sql query
val
parsed
=
planner
.
parse
(
stmt
)
parsed
match
{
...
...
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala
浏览文件 @
34af3a74
...
...
@@ -48,8 +48,7 @@ import scala.collection.JavaConversions._
class
FlinkPlannerImpl
(
config
:
FrameworkConfig
,
planner
:
RelOptPlanner
,
typeFactory
:
FlinkTypeFactory
,
sqlToRelConverterConfig
:
SqlToRelConverter.Config
)
{
typeFactory
:
FlinkTypeFactory
)
{
val
operatorTable
:
SqlOperatorTable
=
config
.
getOperatorTable
/** Holds the trait definitions to be registered with planner. May be null. */
...
...
@@ -57,6 +56,7 @@ class FlinkPlannerImpl(
val
parserConfig
:
SqlParser.Config
=
config
.
getParserConfig
val
convertletTable
:
SqlRexConvertletTable
=
config
.
getConvertletTable
val
defaultSchema
:
SchemaPlus
=
config
.
getDefaultSchema
val
sqlToRelConverterConfig
:
SqlToRelConverter.Config
=
config
.
getSqlToRelConverterConfig
var
validator
:
FlinkCalciteSqlValidator
=
_
var
root
:
RelRoot
=
_
...
...
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/utils/ExpressionTestBase.scala
浏览文件 @
34af3a74
...
...
@@ -67,8 +67,7 @@ abstract class ExpressionTestBase {
private
val
planner
=
new
FlinkPlannerImpl
(
context
.
_2
.
getFrameworkConfig
,
context
.
_2
.
getPlanner
,
context
.
_2
.
getTypeFactory
,
context
.
_2
.
sqlToRelConverterConfig
)
context
.
_2
.
getTypeFactory
)
private
val
logicalOptProgram
=
Programs
.
ofRules
(
FlinkRuleSets
.
LOGICAL_OPT_RULES
)
private
val
dataSetOptProgram
=
Programs
.
ofRules
(
FlinkRuleSets
.
DATASET_OPT_RULES
)
...
...
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/match/PatternTranslatorTestBase.scala
浏览文件 @
34af3a74
...
...
@@ -49,8 +49,7 @@ abstract class PatternTranslatorTestBase extends TestLogger{
private
val
planner
=
new
FlinkPlannerImpl
(
context
.
_2
.
getFrameworkConfig
,
context
.
_2
.
getPlanner
,
context
.
_2
.
getTypeFactory
,
context
.
_2
.
sqlToRelConverterConfig
)
context
.
_2
.
getTypeFactory
)
private
def
prepareContext
(
typeInfo
:
TypeInformation
[
Row
])
:
(
RelBuilder
,
StreamTableEnvironment
,
StreamExecutionEnvironment
)
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录