Skip to content

Commit

Permalink
Merge branch 'master' into undx/TCOMP-1914-jdk17
Browse files Browse the repository at this point in the history
# Conflicts:
#	documentation/src/main/antora/modules/ROOT/pages/_partials/generated_contributors.adoc
#	pom.xml
  • Loading branch information
undx committed Nov 25, 2024
2 parents c5e5958 + f1cf288 commit 2c8b88b
Show file tree
Hide file tree
Showing 81 changed files with 311 additions and 130 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ documentation/rebuildpdf.bat
# direnv
.envrc
.env
*.versionsBackup
2 changes: 1 addition & 1 deletion ci/Jenkinsfile-release
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ private static ArrayList<String> get_release_info(String currentVersion,
//println get_release_info("1.65.0M1-SNAPSHOT", false, true) // milestone
// result should be: [1.65.0M1, 1.65.0M2-SNAPSHOT, none, none]
//println get_release_info("1.65.0M5-SNAPSHOT", false, false) // ga
// result should be: [1.65.0, 1.66.0M1-SNAPSHOT, 1.65.1-SNAPSHOT, maintenance/1.65]
// result should be: [1.65.0, 1.66.0-SNAPSHOT, 1.65.1-SNAPSHOT, maintenance/1.65]
//println get_release_info("1.65.3-SNAPSHOT", true, false) // maintenance
// result should be: [1.65.3, 1.65.4-SNAPSHOT, 1.65.4-SNAPSHOT, maintenance/1.65]
//println get_release_info("1.65.1M1-SNAPSHOT", true, false) // release maintenance, but version not valid
Expand Down
2 changes: 1 addition & 1 deletion component-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-form/component-form-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-form</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-form-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-form/component-form-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-form</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-form-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-form/component-uispec-mapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-form</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-uispec-mapper</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-form/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-form</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-beam/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-beam</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.avro.LogicalTypes;
import org.apache.avro.Schema;
import org.apache.avro.Schema.Field;
import org.talend.sdk.component.runtime.beam.avro.AvroSchemas;
import org.talend.sdk.component.runtime.manager.service.api.Unwrappable;
import org.talend.sdk.component.runtime.record.SchemaImpl.EntryImpl;

Expand All @@ -57,6 +58,11 @@ private static AvroSchemaCache initCache() {
}

static AvroSchema toAvroSchema(final org.talend.sdk.component.api.record.Schema schema) {
// special handling for an empty schema that matches the one in AvroSchemaBuilder for records
if (schema.getType() == Type.RECORD && schema.getAllEntries().noneMatch(it -> true)) {
return new AvroSchema(AvroSchemas.getEmptySchema());
}

return AvroSchema.SCHEMA_CACHE.find(schema);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/**
* Copyright (C) 2006-2024 Talend Inc. - www.talend.com
*
* Licensed 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.talend.sdk.component.runtime.beam.spi.record;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.List;

import org.apache.avro.Schema;
import org.apache.avro.file.DataFileWriter;
import org.apache.avro.generic.GenericDatumWriter;
import org.apache.avro.generic.IndexedRecord;
import org.apache.avro.io.DatumWriter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.talend.sdk.component.api.record.Record;
import org.talend.sdk.component.api.service.record.RecordBuilderFactory;
import org.talend.sdk.component.runtime.beam.spi.AvroRecordBuilderFactoryProvider;

public class AvroWriterTest {

private final RecordBuilderFactory recordBuilderFactory = new AvroRecordBuilderFactoryProvider()
.apply("noContainerId");

@Test
public void testAvroStorage() {
Record headers = recordBuilderFactory
.newRecordBuilder()
.withString("Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
.withString("Accept-Encoding", "gzip, deflate")
.withString("Accept-Encoding", "gzip, deflate")
.withString("Accept-Language", "en-US,en;q=0.5")
.withString("Host", "httpbin.org")
.withString("Upgrade-Insecure-Requests", "1")
.withString("User-Agent", "Mozilla")
.withString("X-Amzn-Trace-Id", "Root=")
.build();

Record args = recordBuilderFactory
.newRecordBuilder()
.build();

Record files = recordBuilderFactory
.newRecordBuilder()
.build();

Record form = recordBuilderFactory
.newRecordBuilder()
.build();

Record record = recordBuilderFactory
.newRecordBuilder()
.withRecord("args", args)
.withString("data", "")
.withRecord("files", files)
.withRecord("form", form)
.withRecord("headers", headers)
.withString("json", null)
.withString("method", "GET")
.withString("origin", "90.60.65.229")
.withString("url", "http://httpbin.org/anything")
.build();

IndexedRecord indexedRecord = ((AvroRecord) record).unwrap(IndexedRecord.class);

Schema schema = indexedRecord.getSchema();

final byte[] bytes = serializeIndexedRecords(Collections.singletonList(indexedRecord), schema);
Assertions.assertTrue(bytes.length != 0);
}

/**
* Write Records to MinIO, this method is used with the Native Runner to replace the fileIO BeamRunner
* The method throws an Avro exception when we try to write the above records :
* org.apache.avro.file.DataFileWriter$AppendWriteException: org.apache.avro.UnresolvedUnionException:
* Not in union
* ["null",{"type":"record","name":"EmptyRecord","namespace":"org.talend.sdk.component.schema.generated","fields":[]}]:
* {}
*/
private static byte[] serializeIndexedRecords(List<IndexedRecord> records, Schema schema) {
DatumWriter<IndexedRecord> datumWriter = new GenericDatumWriter<>(schema);
try (ByteArrayOutputStream buffer = new ByteArrayOutputStream(100 * records.size());
DataFileWriter<IndexedRecord> dataFileWriter = new DataFileWriter<>(datumWriter)) {
dataFileWriter.create(schema, buffer);
for (IndexedRecord record : records) {
dataFileWriter.append(record);
}
dataFileWriter.close();
return buffer.toByteArray();
} catch (IOException e) {
throw new RuntimeException("Error while serializing Avro records", e);
}
}
}
2 changes: 1 addition & 1 deletion component-runtime-design-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-design-extension</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-impl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-manager</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-beam-junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-http-junit</artifactId>
Expand Down Expand Up @@ -171,7 +171,7 @@
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
<artifactSet>
<includes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-junit-base</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-testing/component-runtime-junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-testing-spark</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-testing</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/component-server-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-parent</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-server-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/component-server-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-parent</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-server-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/component-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-parent</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>extensions</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-server-extension-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-parent</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>extensions</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-server-parent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-spi</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions component-starter-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-starter-server</artifactId>
Expand Down Expand Up @@ -335,7 +335,7 @@
<goals>
<goal>npm</goal>
</goals>
<phase/>
<phase />
<configuration>
<arguments>start</arguments>
<environmentVariables>
Expand Down
2 changes: 1 addition & 1 deletion component-studio/component-runtime-di/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-studio</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-di</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-studio/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-studio</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-tools-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M8-SNAPSHOT</version>
<version>1.66.0-SNAPSHOT</version>
</parent>

<artifactId>component-tools-webapp</artifactId>
Expand Down
Loading

0 comments on commit 2c8b88b

Please sign in to comment.