Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaowei
dlink
Commits
d5ea3676
Commit
d5ea3676
authored
May 17, 2022
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix-503][client] Remove initFunctions
parent
514fd459
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
72 deletions
+2
-72
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+0
-17
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+0
-17
FlinkInterceptor.java
...src/main/java/com/dlink/interceptor/FlinkInterceptor.java
+2
-38
No files found.
dlink-client/dlink-client-1.13/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
d5ea3676
...
@@ -278,23 +278,6 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -278,23 +278,6 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
return
record
;
return
record
;
}
}
public
<
T
>
void
registerFunction
(
String
name
,
TableFunction
<
T
>
tableFunction
)
{
TypeInformation
<
T
>
typeInfo
=
UserDefinedFunctionHelper
.
getReturnTypeOfTableFunction
(
tableFunction
);
this
.
functionCatalog
.
registerTempSystemTableFunction
(
name
,
tableFunction
,
typeInfo
);
}
public
<
T
,
ACC
>
void
registerFunction
(
String
name
,
AggregateFunction
<
T
,
ACC
>
aggregateFunction
)
{
TypeInformation
<
T
>
typeInfo
=
UserDefinedFunctionHelper
.
getReturnTypeOfAggregateFunction
(
aggregateFunction
);
TypeInformation
<
ACC
>
accTypeInfo
=
UserDefinedFunctionHelper
.
getAccumulatorTypeOfAggregateFunction
(
aggregateFunction
);
this
.
functionCatalog
.
registerTempSystemAggregateFunction
(
name
,
aggregateFunction
,
typeInfo
,
accTypeInfo
);
}
public
<
T
,
ACC
>
void
registerFunction
(
String
name
,
TableAggregateFunction
<
T
,
ACC
>
tableAggregateFunction
)
{
TypeInformation
<
T
>
typeInfo
=
UserDefinedFunctionHelper
.
getReturnTypeOfAggregateFunction
(
tableAggregateFunction
);
TypeInformation
<
ACC
>
accTypeInfo
=
UserDefinedFunctionHelper
.
getAccumulatorTypeOfAggregateFunction
(
tableAggregateFunction
);
this
.
functionCatalog
.
registerTempSystemAggregateFunction
(
name
,
tableAggregateFunction
,
typeInfo
,
accTypeInfo
);
}
public
boolean
parseAndLoadConfiguration
(
String
statement
,
StreamExecutionEnvironment
environment
,
Map
<
String
,
Object
>
setMap
)
{
public
boolean
parseAndLoadConfiguration
(
String
statement
,
StreamExecutionEnvironment
environment
,
Map
<
String
,
Object
>
setMap
)
{
List
<
Operation
>
operations
=
getParser
().
parse
(
statement
);
List
<
Operation
>
operations
=
getParser
().
parse
(
statement
);
for
(
Operation
operation
:
operations
)
{
for
(
Operation
operation
:
operations
)
{
...
...
dlink-client/dlink-client-1.14/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
d5ea3676
...
@@ -286,23 +286,6 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -286,23 +286,6 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
return
record
;
return
record
;
}
}
public
<
T
>
void
registerFunction
(
String
name
,
TableFunction
<
T
>
tableFunction
)
{
TypeInformation
<
T
>
typeInfo
=
UserDefinedFunctionHelper
.
getReturnTypeOfTableFunction
(
tableFunction
);
this
.
functionCatalog
.
registerTempSystemTableFunction
(
name
,
tableFunction
,
typeInfo
);
}
public
<
T
,
ACC
>
void
registerFunction
(
String
name
,
AggregateFunction
<
T
,
ACC
>
aggregateFunction
)
{
TypeInformation
<
T
>
typeInfo
=
UserDefinedFunctionHelper
.
getReturnTypeOfAggregateFunction
(
aggregateFunction
);
TypeInformation
<
ACC
>
accTypeInfo
=
UserDefinedFunctionHelper
.
getAccumulatorTypeOfAggregateFunction
(
aggregateFunction
);
this
.
functionCatalog
.
registerTempSystemAggregateFunction
(
name
,
aggregateFunction
,
typeInfo
,
accTypeInfo
);
}
public
<
T
,
ACC
>
void
registerFunction
(
String
name
,
TableAggregateFunction
<
T
,
ACC
>
tableAggregateFunction
)
{
TypeInformation
<
T
>
typeInfo
=
UserDefinedFunctionHelper
.
getReturnTypeOfAggregateFunction
(
tableAggregateFunction
);
TypeInformation
<
ACC
>
accTypeInfo
=
UserDefinedFunctionHelper
.
getAccumulatorTypeOfAggregateFunction
(
tableAggregateFunction
);
this
.
functionCatalog
.
registerTempSystemAggregateFunction
(
name
,
tableAggregateFunction
,
typeInfo
,
accTypeInfo
);
}
public
boolean
parseAndLoadConfiguration
(
String
statement
,
StreamExecutionEnvironment
environment
,
Map
<
String
,
Object
>
setMap
)
{
public
boolean
parseAndLoadConfiguration
(
String
statement
,
StreamExecutionEnvironment
environment
,
Map
<
String
,
Object
>
setMap
)
{
List
<
Operation
>
operations
=
getParser
().
parse
(
statement
);
List
<
Operation
>
operations
=
getParser
().
parse
(
statement
);
for
(
Operation
operation
:
operations
)
{
for
(
Operation
operation
:
operations
)
{
...
...
dlink-executor/src/main/java/com/dlink/interceptor/FlinkInterceptor.java
View file @
d5ea3676
package
com
.
dlink
.
interceptor
;
package
com
.
dlink
.
interceptor
;
import
org.apache.flink.table.api.TableResult
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.catalog.function.FunctionManager
;
import
com.dlink.catalog.function.UDFunction
;
import
com.dlink.executor.CustomTableEnvironmentImpl
;
import
com.dlink.executor.Executor
;
import
com.dlink.executor.Executor
;
import
com.dlink.trans.Operation
;
import
com.dlink.trans.Operation
;
import
com.dlink.trans.Operations
;
import
com.dlink.trans.Operations
;
import
com.dlink.utils.SqlUtil
;
import
com.dlink.utils.SqlUtil
;
import
org.apache.flink.table.api.TableResult
;
import
org.apache.flink.table.functions.AggregateFunction
;
import
org.apache.flink.table.functions.ScalarFunction
;
import
org.apache.flink.table.functions.TableAggregateFunction
;
import
org.apache.flink.table.functions.TableFunction
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* FlinkInterceptor
* FlinkInterceptor
...
@@ -31,7 +21,6 @@ public class FlinkInterceptor {
...
@@ -31,7 +21,6 @@ public class FlinkInterceptor {
if
(
executor
.
isUseSqlFragment
())
{
if
(
executor
.
isUseSqlFragment
())
{
statement
=
executor
.
getSqlManager
().
parseVariable
(
statement
);
statement
=
executor
.
getSqlManager
().
parseVariable
(
statement
);
}
}
// initFunctions(executor.getCustomTableEnvironmentImpl(), statement);
return
statement
.
trim
();
return
statement
.
trim
();
}
}
...
@@ -46,29 +35,4 @@ public class FlinkInterceptor {
...
@@ -46,29 +35,4 @@ public class FlinkInterceptor {
}
}
return
FlinkInterceptorResult
.
build
(
noExecute
,
tableResult
);
return
FlinkInterceptorResult
.
build
(
noExecute
,
tableResult
);
}
}
@Deprecated
private
static
void
initFunctions
(
CustomTableEnvironmentImpl
stEnvironment
,
String
statement
)
{
Map
<
String
,
UDFunction
>
usedFunctions
=
FunctionManager
.
getUsedFunctions
(
statement
);
String
[]
udfs
=
stEnvironment
.
listUserDefinedFunctions
();
List
<
String
>
udflist
=
Arrays
.
asList
(
udfs
);
for
(
Map
.
Entry
<
String
,
UDFunction
>
entry
:
usedFunctions
.
entrySet
())
{
if
(!
udflist
.
contains
(
entry
.
getKey
()))
{
if
(
entry
.
getValue
().
getType
()
==
UDFunction
.
UDFunctionType
.
Scalar
)
{
stEnvironment
.
registerFunction
(
entry
.
getKey
(),
(
ScalarFunction
)
entry
.
getValue
().
getFunction
());
}
else
if
(
entry
.
getValue
().
getType
()
==
UDFunction
.
UDFunctionType
.
Table
)
{
stEnvironment
.
registerFunction
(
entry
.
getKey
(),
(
TableFunction
)
entry
.
getValue
().
getFunction
());
}
else
if
(
entry
.
getValue
().
getType
()
==
UDFunction
.
UDFunctionType
.
Aggregate
)
{
stEnvironment
.
registerFunction
(
entry
.
getKey
(),
(
AggregateFunction
)
entry
.
getValue
().
getFunction
());
}
else
if
(
entry
.
getValue
().
getType
()
==
UDFunction
.
UDFunctionType
.
TableAggregate
)
{
stEnvironment
.
registerFunction
(
entry
.
getKey
(),
(
TableAggregateFunction
)
entry
.
getValue
().
getFunction
());
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment