-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Feature][transform] transform support explode #7928
Merged
Merged
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
9b09ad8
[Feature][transform] transform support explode
CosmosNi d83c2aa
[Feature][transform] transform support explode
CosmosNi 6f7f52d
[Feature][transform] transform support explode
CosmosNi 6b80660
[Feature][transform] transform support explode
CosmosNi d30be82
[Feature][transform] explode transform support spilt list
CosmosNi 48adff1
[Feature][transform] explode transform support spilt list
CosmosNi 3a55991
[Feature][transform] explode transform support spilt list
CosmosNi 87f3bef
[Feature][transform] sql transform support lateral view explode
CosmosNi ecb676c
Merge remote-tracking branch 'refs/remotes/upstream/dev' into feature…
CosmosNi 445ccc1
[Feature][transform] sql transform support lateral view explode
CosmosNi 83f2ca7
[Feature][transform] sql transform support lateral view explode
CosmosNi 4c23649
Merge remote-tracking branch 'refs/remotes/upstream/dev' into feature…
CosmosNi 5a1d277
[Feature][transform] sql transform support lateral view explode
CosmosNi db7b403
[Feature][transform] sql transform support lateral view explode
CosmosNi caea970
[Feature][transform] sql transform support lateral view explode
CosmosNi cb0f56d
[Feature][transform] sql transform support lateral view explode
CosmosNi 4bfa386
[Feature][transform] sql transform support lateral view explode
CosmosNi 46125fe
[Feature][transform] fix cr
CosmosNi 2c440d5
[Feature][transform] sql transform support lateral view explode
CosmosNi 88d49ca
[Feature][transform] sql transform support lateral view explode
CosmosNi 873a951
[Feature][transform] sql transform support lateral view explode
CosmosNi c5c0399
[Feature][transform] sql transform support lateral view explode
CosmosNi 97ea914
[Feature][transform] sql transform support lateral view explode
CosmosNi 27f320d
[Feature][transform] sql transform support lateral view explode
CosmosNi e1c60e3
[Feature][transform] handle null
CosmosNi 5f80930
[Feature][transform] fix array type
CosmosNi fd715b9
[Feature][transform] fix error word
CosmosNi 013c284
[Feature][transform] transform support explode
CosmosNi 619cd2f
[Feature][RestAPI] Support submit job with seatunnel style hocon form…
CosmosNi 46f0857
[Feature][transform] transform support explode
CosmosNi b337b50
[Feature][transform] transform support explode
CosmosNi 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
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
...nnel-api/src/main/java/org/apache/seatunnel/api/transform/SeaTunnelMultiRowTransform.java
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.seatunnel.api.transform; | ||
|
||
import java.util.List; | ||
|
||
public interface SeaTunnelMultiRowTransform<T> extends SeaTunnelTransform<T> { | ||
|
||
/** | ||
* Transform input data to {@link this#getProducedCatalogTable().getSeaTunnelRowType()} types | ||
* data. | ||
* | ||
* @param row the data need be transformed. | ||
* @return transformed data. | ||
*/ | ||
List<T> flatMap(T row); | ||
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. cc @hailin0 |
||
|
||
default T map(T row) { | ||
throw new UnsupportedOperationException("Heads-up conversion is not supported"); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -54,8 +54,6 @@ | |
import net.sf.jsqlparser.statement.select.AllColumns; | ||
import net.sf.jsqlparser.statement.select.PlainSelect; | ||
import net.sf.jsqlparser.statement.select.Select; | ||
import net.sf.jsqlparser.statement.select.SelectBody; | ||
import net.sf.jsqlparser.statement.select.SelectExpressionItem; | ||
import net.sf.jsqlparser.statement.select.SelectItem; | ||
|
||
import java.math.BigDecimal; | ||
|
@@ -83,7 +81,7 @@ public static PlainSelect convertToPlainSelect(String query) { | |
throw new IllegalArgumentException("Only SELECT statements are supported."); | ||
} | ||
Select select = (Select) statement; | ||
SelectBody selectBody = select.getSelectBody(); | ||
Select selectBody = select.getSelectBody(); | ||
if (!(selectBody instanceof PlainSelect)) { | ||
throw new IllegalArgumentException("Only simple SELECT statements are supported."); | ||
} | ||
|
@@ -101,18 +99,15 @@ public static PlainSelect convertToPlainSelect(String query) { | |
public static int[] convertSqlSelectToPaimonProjectionIndex( | ||
String[] fieldNames, PlainSelect plainSelect) { | ||
int[] projectionIndex = null; | ||
List<SelectItem> selectItems = plainSelect.getSelectItems(); | ||
List<SelectItem<?>> selectItems = plainSelect.getSelectItems(); | ||
|
||
List<String> columnNames = new ArrayList<>(); | ||
for (SelectItem selectItem : selectItems) { | ||
if (selectItem instanceof AllColumns) { | ||
if (selectItem.getExpression() instanceof AllColumns) { | ||
return null; | ||
} else if (selectItem instanceof SelectExpressionItem) { | ||
SelectExpressionItem selectExpressionItem = (SelectExpressionItem) selectItem; | ||
String columnName = selectExpressionItem.getExpression().toString(); | ||
columnNames.add(columnName); | ||
} else { | ||
throw new IllegalArgumentException("Error encountered parsing query fields."); | ||
String columnName = ((Column) selectItem.getExpression()).getColumnName(); | ||
columnNames.add(columnName); | ||
Comment on lines
+102
to
+110
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. |
||
} | ||
} | ||
|
||
|
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
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.
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.
The split method should be string function. Please move it to https://github.com/apache/seatunnel/blob/dev/docs/en/transform-v2/sql-functions.md#string-functions