-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java]Add LakeSoulLocalJavaWriter (#550)
* merge local_writer into merge_main MR-title: add LakeSoulLocalJavaWriter Created-by: hw_syl_zenghua Author-id: 7155563 MR-id: 7272355 Commit-by: zenghua Merged-by: hw_syl_zenghua Description: merge "local_writer" into "merge_main" add LakeSoulLocalJavaWriter Signed-off-by: zenghua <[email protected]> See merge request: 42b369588d84469d95d7b738fc58da8e/LakeSoul/for-nanhang!3 * fix pom Signed-off-by: zenghua <[email protected]> --------- Signed-off-by: zenghua <[email protected]> Co-authored-by: hw_syl_zenghua <[email protected]> Co-authored-by: zenghua <[email protected]>
- Loading branch information
1 parent
199df38
commit de9c8fa
Showing
37 changed files
with
2,584 additions
and
71 deletions.
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
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
32 changes: 32 additions & 0 deletions
32
...io/lakesoul-io-java/src/main/java/com/dmetasoul/lakesoul/lakesoul/LakeSoulArrowUtils.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,32 @@ | ||
package com.dmetasoul.lakesoul.lakesoul; | ||
|
||
import org.apache.arrow.vector.types.pojo.Field; | ||
import org.apache.arrow.vector.types.pojo.Schema; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class LakeSoulArrowUtils { | ||
public static Schema cdcColumnAlignment(Schema schema, String cdcColumn) { | ||
if (cdcColumn != null) { | ||
// set cdc column as the last field | ||
Field cdcField = null; | ||
List<Field> fields = new ArrayList<>(schema.getFields().size() + 1); | ||
for (Field field : schema.getFields()) { | ||
if (!field.getName().equals(cdcColumn)) { | ||
fields.add(field); | ||
} else { | ||
cdcField = field; | ||
} | ||
} | ||
if (cdcField != null) { | ||
fields.add(cdcField); | ||
} else { | ||
throw new RuntimeException(String.format("Invalid Schema of %s, CDC Column [%s] not found", schema, cdcColumn)); | ||
// fields.add(new Field(cdcColumn, FieldType.notNullable(new ArrowType.Utf8()), null)); | ||
} | ||
return new Schema(fields); | ||
} | ||
return schema; | ||
} | ||
} |
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.