forked from apache/seatunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][core] support arrow transfers data to SeatunnelRow in arrow…
… format
- Loading branch information
Showing
59 changed files
with
2,475 additions
and
1,204 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
33 changes: 33 additions & 0 deletions
33
seatunnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/BigIntConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.BigIntVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class BigIntConverter implements Converter<BigIntVector> { | ||
@Override | ||
public Object convert(int rowIndex, BigIntVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.BIGINT == type; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
seatunnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/BitConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.BitVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class BitConverter implements Converter<BitVector> { | ||
@Override | ||
public Object convert(int rowIndex, BitVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.BIT == type; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
seatunnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/Converter.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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.FieldVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
import java.util.List; | ||
import java.util.function.Function; | ||
|
||
public interface Converter<T extends FieldVector> { | ||
|
||
Object convert(int rowIndex, T fieldVector); | ||
|
||
default Object convert(int rowIndex, T fieldVector, List<Function> genericsConvert) { | ||
throw new UnsupportedOperationException("Unsupported generics convert"); | ||
} | ||
|
||
boolean support(Types.MinorType type); | ||
} |
33 changes: 33 additions & 0 deletions
33
seatunnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/DateDayConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.DateDayVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class DateDayConverter implements Converter<DateDayVector> { | ||
@Override | ||
public Object convert(int rowIndex, DateDayVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.DATEDAY == type; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
seatunnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/DateMilliConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.DateMilliVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class DateMilliConverter implements Converter<DateMilliVector> { | ||
@Override | ||
public Object convert(int rowIndex, DateMilliVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.DATEMILLI == type; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...unnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/Decimal256Converter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.Decimal256Vector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class Decimal256Converter implements Converter<Decimal256Vector> { | ||
@Override | ||
public Object convert(int rowIndex, Decimal256Vector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.DECIMAL256 == type; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
seatunnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/DecimalConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.DecimalVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class DecimalConverter implements Converter<DecimalVector> { | ||
@Override | ||
public Object convert(int rowIndex, DecimalVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.DECIMAL == type; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...unnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/DenseUnionConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.complex.DenseUnionVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class DenseUnionConverter implements Converter<DenseUnionVector> { | ||
@Override | ||
public Object convert(int rowIndex, DenseUnionVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.DENSEUNION == type; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
seatunnel-api/src/main/java/org/apache/seatunnel/api/arrow/converter/DurationConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.DurationVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class DurationConverter implements Converter<DurationVector> { | ||
@Override | ||
public Object convert(int rowIndex, DurationVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.DURATION == type; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...el-api/src/main/java/org/apache/seatunnel/api/arrow/converter/ExtensionTypeConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.ExtensionTypeVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class ExtensionTypeConverter implements Converter<ExtensionTypeVector> { | ||
@Override | ||
public Object convert(int rowIndex, ExtensionTypeVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.EXTENSIONTYPE == type; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...-api/src/main/java/org/apache/seatunnel/api/arrow/converter/FixedSizeBinaryConverter.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,33 @@ | ||
/* | ||
* 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.arrow.converter; | ||
|
||
import org.apache.arrow.vector.FixedSizeBinaryVector; | ||
import org.apache.arrow.vector.types.Types; | ||
|
||
public class FixedSizeBinaryConverter implements Converter<FixedSizeBinaryVector> { | ||
@Override | ||
public Object convert(int rowIndex, FixedSizeBinaryVector fieldVector) { | ||
return fieldVector.isNull(rowIndex) ? null : fieldVector.getObject(rowIndex); | ||
} | ||
|
||
@Override | ||
public boolean support(Types.MinorType type) { | ||
return Types.MinorType.FIXEDSIZEBINARY == type; | ||
} | ||
} |
Oops, something went wrong.