Closed zhangxiang-ola closed 1 month ago
env {
parallelism = 1
job.mode = "BATCH"
}
source {
# This is a example source plugin **only for test and demonstrate the feature source plugin**
FakeSource {
result_table_name = "fake"
parallelism = 1
schema = {
fields {
name = "string"
age = "int"
id = "int"
}
}
}
}
transform {
Sql {
source_table_name = "fake"
result_table_name = "fake1"
query = "select id, COALESCE(name, '1112') as name, age+1 as age from fake where id>0"
}
}
sink {
console {
source_table_name = "fake1"
}
}
Is it convenient for you to execute this case to see if it is possible
env { parallelism = 1 job.mode = "BATCH" } source { # This is a example source plugin **only for test and demonstrate the feature source plugin** FakeSource { result_table_name = "fake" parallelism = 1 schema = { fields { name = "string" age = "int" id = "int" } } } } transform { Sql { source_table_name = "fake" result_table_name = "fake1" query = "select id, COALESCE(name, '1112') as name, age+1 as age from fake where id>0" } } sink { console { source_table_name = "fake1" } }
Is it convenient for you to execute this case to see if it is possible
I remember this is the test configuration provided by the official documentation. Yes, it can be run.
Version 2.3.7 can solve my problem. version 2.3.5 Zetaengine parse SelectExpressionItem:
SelectExpressionItem expressionItem = (SelectExpressionItem) selectItem;
Expression expression = expressionItem.getExpression();
if (expressionItem.getAlias() != null) {
fieldNames[idx] = expressionItem.getAlias().getName();
} else {
if (expression instanceof Column) {
fieldNames[idx] = ((Column) expression).getColumnName();
} else {
fieldNames[idx] = expression.toString();
}
}
version 2.3.7 Zetaengine parse SelectExpressionItem:
SelectExpressionItem expressionItem = (SelectExpressionItem) selectItem;
Expression expression = expressionItem.getExpression();
if (expressionItem.getAlias() != null) {
String aliasName = expressionItem.getAlias().getName();
if (aliasName.startsWith(ESCAPE_IDENTIFIER)
&& aliasName.endsWith(ESCAPE_IDENTIFIER)) {
aliasName = aliasName.substring(1, aliasName.length() - 1);
}
fieldNames[idx] = aliasName;
} else {
if (expression instanceof Column) {
fieldNames[idx] = ((Column) expression).getColumnName();
} else {
fieldNames[idx] = expression.toString();
}
}
Search before asking
What happened
I use SQL transform plugin to do field mapping and assign default values to null values in source table fields. But when my source table has a field named starting with a number, if my transform sql is written as
CCJSqlParserUtil will not be able to parse it. If it is written as
the task An error will be reported that
SeaTunnel Version
2.3.5
SeaTunnel Config
Running Command
Error Exception