You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "jonvex (via GitHub)" <gi...@apache.org> on 2023/02/21 17:00:10 UTC
[GitHub] [hudi] jonvex opened a new pull request, #8010: sanatize json and row conversion to avro
jonvex opened a new pull request, #8010:
URL: https://github.com/apache/hudi/pull/8010
### Change Logs
_Describe context and summary for this change. Highlight if any code was copied._
### Impact
_Describe any public API or user-facing feature change or any performance impact._
### Risk level (write none, low medium or high below)
_If medium or high, explain what verification was done to mitigate the risks._
### Documentation Update
_Describe any necessary documentation update if there is any new feature, config, or user-facing change_
- _The config description must be updated if new configs are added or the default value of the configs are changed_
- _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
changes to the website._
### Contributor's checklist
- [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1439259269
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 803e8874071c540e672f93f5a481a05ae8ec6131 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317)
* 1cb788947969f4573d5a4b2171fbedee696b73d8 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1440456938
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 1cb788947969f4573d5a4b2171fbedee696b73d8 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327)
* 7dd3bae6a568456284d48df18c0ab558d675169b Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] jonvex commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "jonvex (via GitHub)" <gi...@apache.org>.
jonvex commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1451168182
testHoodieIndexer failed in CI which is a known flakey test so I am rerunning it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1448592347
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3019831aab40e92820737f308af2846835831b6a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446)
* be4b1268fd16f19375d5c249bf8dbd0f89cc4e79 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484)
* 5bdc2ce2de13e8358a2bf8844cbde9aad7801641 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] the-other-tim-brown commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "the-other-tim-brown (via GitHub)" <gi...@apache.org>.
the-other-tim-brown commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1119408743
##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -720,10 +721,22 @@ public static Schema getNullSchema() {
* @return sanitized name
*/
public static String sanitizeName(String name) {
- if (name.substring(0, 1).matches(INVALID_AVRO_FIRST_CHAR_IN_NAMES)) {
- name = name.replaceFirst(INVALID_AVRO_FIRST_CHAR_IN_NAMES, MASK_FOR_INVALID_CHARS_IN_NAMES);
+ return sanitizeName(name, MASK_FOR_INVALID_CHARS_IN_NAMES);
Review Comment:
Do we want some basic unit tests for this to make sure that behavior is consistent before and after this change?
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/SanitizationUtils.java:
##########
@@ -0,0 +1,199 @@
+/*
+ * 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.hudi.utilities.sources.helpers;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.utilities.sources.InputBatch;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaParseException;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataType;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SanitizationUtils {
+
+ private static ObjectMapper OM = new ObjectMapper();
Review Comment:
nitpick: make this final?
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/SanitizationUtils.java:
##########
@@ -0,0 +1,199 @@
+/*
+ * 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.hudi.utilities.sources.helpers;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.utilities.sources.InputBatch;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaParseException;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataType;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SanitizationUtils {
+
+ private static ObjectMapper OM = new ObjectMapper();
+
+ public static class Config {
+ // sanitizes names of invalid schema fields both in the data read from source and also in the schema.
+ // invalid definition here goes by avro naming convention (https://avro.apache.org/docs/current/spec.html#names).
+ public static final String SANITIZE_SCHEMA_FIELD_NAMES = "hoodie.deltastreamer.source.sanitize.invalid.schema.field.names";
+
+ public static final String SCHEMA_FIELD_NAME_INVALID_CHAR_MASK = "hoodie.deltastreamer.source.sanitize.invalid.char.mask";
+ }
+
+ private static final String AVRO_FIELD_NAME_KEY = "name";
+
+ private static DataType sanitizeDataTypeForAvro(DataType dataType, String invalidCharMask) {
+ if (dataType instanceof ArrayType) {
+ ArrayType arrayType = (ArrayType) dataType;
+ DataType sanitizedDataType = sanitizeDataTypeForAvro(arrayType.elementType(), invalidCharMask);
+ return new ArrayType(sanitizedDataType, arrayType.containsNull());
+ } else if (dataType instanceof MapType) {
+ MapType mapType = (MapType) dataType;
+ DataType sanitizedKeyDataType = sanitizeDataTypeForAvro(mapType.keyType(), invalidCharMask);
+ DataType sanitizedValueDataType = sanitizeDataTypeForAvro(mapType.valueType(), invalidCharMask);
+ return new MapType(sanitizedKeyDataType, sanitizedValueDataType, mapType.valueContainsNull());
+ } else if (dataType instanceof StructType) {
+ return sanitizeStructTypeForAvro((StructType) dataType, invalidCharMask);
+ }
+ return dataType;
+ }
+
+ // TODO(HUDI-5256): Refactor this to use InternalSchema when it is ready.
+ private static StructType sanitizeStructTypeForAvro(StructType structType, String invalidCharMask) {
+ StructType sanitizedStructType = new StructType();
+ StructField[] structFields = structType.fields();
+ for (StructField s : structFields) {
+ DataType currFieldDataTypeSanitized = sanitizeDataTypeForAvro(s.dataType(), invalidCharMask);
+ StructField structFieldCopy = new StructField(HoodieAvroUtils.sanitizeName(s.name(), invalidCharMask),
+ currFieldDataTypeSanitized, s.nullable(), s.metadata());
+ sanitizedStructType = sanitizedStructType.add(structFieldCopy);
+ }
+ return sanitizedStructType;
+ }
+
+ private static Dataset<Row> sanitizeColumnNamesForAvro(Dataset<Row> inputDataset, String invalidCharMask) {
+ StructField[] inputFields = inputDataset.schema().fields();
+ Dataset<Row> targetDataset = inputDataset;
+ for (StructField sf : inputFields) {
+ DataType sanitizedFieldDataType = sanitizeDataTypeForAvro(sf.dataType(), invalidCharMask);
+ if (!sanitizedFieldDataType.equals(sf.dataType())) {
+ // Sanitizing column names for nested types can be thought of as going from one schema to another
+ // which are structurally similar except for actual column names itself. So casting is safe and sufficient.
+ targetDataset = targetDataset.withColumn(sf.name(), targetDataset.col(sf.name()).cast(sanitizedFieldDataType));
+ }
+ String possibleRename = HoodieAvroUtils.sanitizeName(sf.name(), invalidCharMask);
+ if (!sf.name().equals(possibleRename)) {
+ targetDataset = targetDataset.withColumnRenamed(sf.name(), possibleRename);
+ }
+ }
+ return targetDataset;
+ }
+
+ /**
+ * Sanitize all columns including nested ones as per Avro conventions.
+ * @param srcBatch
+ * @param shouldSanitize
+ * @param invalidCharMask
+ * @return sanitized batch.
+ */
+ public static InputBatch<Dataset<Row>> maybeSanitizeFieldNames(InputBatch<Dataset<Row>> srcBatch,
+ boolean shouldSanitize,
+ String invalidCharMask) {
+ if (!shouldSanitize || !srcBatch.getBatch().isPresent()) {
+ return srcBatch;
+ }
+ Dataset<Row> srcDs = srcBatch.getBatch().get();
+ Dataset<Row> targetDs = sanitizeColumnNamesForAvro(srcDs, invalidCharMask);
+ return new InputBatch<>(Option.ofNullable(targetDs), srcBatch.getCheckpointForNextBatch(), srcBatch.getSchemaProvider());
+ }
+
+ /*
+ * We first rely on Avro to parse and then try to rename only for those failed.
+ * This way we can improve our parsing capabilities without breaking existing functionality.
+ * For example, we don't yet support multiple named schemas defined in a file.
+ */
+ public static Schema parseAvroSchema(String schemaStr, boolean shouldSanitize, String invalidCharMask) {
+ try {
+ return new Schema.Parser().parse(schemaStr);
+ } catch (SchemaParseException spe) {
+ // if sanitizing is not enabled rethrow the exception.
+ if (!shouldSanitize) {
+ throw spe;
+ }
+ // Rename avro fields and try parsing once again.
+ Option<Schema> parseResult = parseSanitizedAvroSchemaNoThrow(schemaStr, invalidCharMask);
+ if (!parseResult.isPresent()) {
+ // throw original exception.
+ throw spe;
+ }
+ return parseResult.get();
+ }
+ }
+
+ /**
+ * Parse list for sanitizing
+ * @param src - deserialized schema
+ * @param invalidCharMask - mask to replace invalid characters with
+ */
+ private static List<Object> transformList(List<Object> src, String invalidCharMask) {
+ return src.stream().map(obj -> {
+ if (obj instanceof List) {
+ return transformList((List<Object>) obj, invalidCharMask);
+ } else if (obj instanceof Map) {
+ return transformMap((Map<String, Object>) obj, invalidCharMask);
+ } else {
+ return obj;
+ }
+ }).collect(Collectors.toList());
+ }
+
+ /**
+ * Parse map for sanitizing. If we have a string in the map, and it is an avro field name key, then we sanitize the name.
+ * Otherwise, we keep recursively going through the schema.
+ * @param src - deserialized schema
+ * @param invalidCharMask - mask to replace invalid characters with
+ */
+ private static Map<String, Object> transformMap(Map<String, Object> src, String invalidCharMask) {
+ return src.entrySet().stream()
+ .map(kv -> {
+ if (kv.getValue() instanceof List) {
+ return Pair.of(kv.getKey(), transformList((List<Object>) kv.getValue(), invalidCharMask));
+ } else if (kv.getValue() instanceof Map) {
+ return Pair.of(kv.getKey(), transformMap((Map<String, Object>) kv.getValue(), invalidCharMask));
+ } else if (kv.getValue() instanceof String) {
+ String currentStrValue = (String) kv.getValue();
+ if (kv.getKey().equals(AVRO_FIELD_NAME_KEY)) {
+ return Pair.of(kv.getKey(), HoodieAvroUtils.sanitizeName(currentStrValue, invalidCharMask));
+ }
+ return Pair.of(kv.getKey(), currentStrValue);
+ } else {
+ return Pair.of(kv.getKey(), kv.getValue());
+ }
+ }).collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
+ }
+
+ /**
+ * Sanitizes illegal field names in the schema using recursive calls to transformMap and transformList
+ */
+ private static Option<Schema> parseSanitizedAvroSchemaNoThrow(String schemaStr, String invalidCharMask) {
+ try {
+ OM.enable(JsonParser.Feature.ALLOW_COMMENTS);
Review Comment:
This will create a new instance of an objectmapper so you will want to just add this to the initial declaration at the top of the file
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/SanitizationUtils.java:
##########
@@ -0,0 +1,199 @@
+/*
+ * 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.hudi.utilities.sources.helpers;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.utilities.sources.InputBatch;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaParseException;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataType;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SanitizationUtils {
Review Comment:
Should we add some unit tests for this?
##########
hudi-utilities/src/test/java/org/apache/hudi/utilities/deltastreamer/TestSourceFormatAdapter.java:
##########
@@ -0,0 +1,339 @@
+/*
+ * 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.hudi.utilities.deltastreamer;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.exception.HoodieException;
+import org.apache.hudi.utilities.schema.SchemaProvider;
+import org.apache.hudi.utilities.sources.InputBatch;
+import org.apache.hudi.utilities.sources.Source;
+import org.apache.hudi.utilities.sources.helpers.SanitizationUtils;
+
+import org.apache.avro.Schema;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.avro.SchemaConverters;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataTypes;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.Metadata;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TestSourceFormatAdapter {
+ private static final String DUMMY_CHECKPOINT = "dummy_checkpoint";
+
+ private static SparkSession spark;
+ private static JavaSparkContext jsc;
+ private TestRowDataSource testRowDataSource;
+ private TestJsonDataSource testJsonDataSource;
+
+ @BeforeAll
+ public static void start() {
+ spark = SparkSession
+ .builder()
+ .master("local[*]")
+ .appName(TestSourceFormatAdapter.class.getName())
+ .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
+ .getOrCreate();
+ jsc = JavaSparkContext.fromSparkContext(spark.sparkContext());
+ }
+
+ @AfterAll
+ public static void shutdown() {
+ jsc.close();
+ spark.close();
+ }
+
+ // Forces to initialize object before every test.
+ @AfterEach
+ public void teardown() {
+ testRowDataSource = null;
+ testJsonDataSource = null;
+ }
+
+ private String sanitizeIfNeeded(String src, boolean shouldSanitize) {
+ return shouldSanitize ? HoodieAvroUtils.sanitizeName(src, "__") : src;
+ }
+
+ private StructType getSchemaWithProperNaming() {
+ StructType addressStruct = new StructType(new StructField[] {
+ new StructField("state", DataTypes.StringType, true, Metadata.empty()),
+ new StructField("street", DataTypes.StringType, true, Metadata.empty()),
+ new StructField("zip", DataTypes.LongType, true, Metadata.empty()),
+ });
+
+ StructType personStruct = new StructType(new StructField[] {
+ new StructField("address", addressStruct, true, Metadata.empty()),
+ new StructField("name", DataTypes.StringType, true, Metadata.empty()),
+ new StructField("occupation", DataTypes.StringType, true, Metadata.empty()),
+ new StructField("place", DataTypes.StringType, true, Metadata.empty())
+ });
+ return personStruct;
+ }
+
+ private StructType getSchemaWithBadAvroNamingForStructType(boolean shouldSanitize) {
+ StructType addressStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@state.", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@@stree@t@", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("8@_zip", shouldSanitize),
+ DataTypes.LongType, true, Metadata.empty())
+ });
+
+ StructType personStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@_addr*$ess", shouldSanitize),
+ addressStruct, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("9name", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("_occu9pation", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@plac.e.", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty())
+ });
+ return personStruct;
+ }
+
+ private StructType getSchemaWithBadAvroNamingForArrayType(boolean shouldSanitize) {
+ StructType addressStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@state.", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@@stree@t@", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("8@_zip", shouldSanitize),
+ DataTypes.LongType, true, Metadata.empty())
+ });
+
+ StructType personStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@name", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@arr@", shouldSanitize),
+ new ArrayType(addressStruct, true), true, Metadata.empty())
+ });
+ return personStruct;
+ }
+
+ private StructType getSchemaWithBadAvroNamingForMapType(boolean shouldSanitize) {
+ StructType addressStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@state.", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@@stree@t@", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("8@_zip", shouldSanitize),
+ DataTypes.LongType, true, Metadata.empty())
+ });
+
+ StructType personStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@name", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@map9", shouldSanitize),
+ new MapType(DataTypes.StringType, addressStruct, true), true, Metadata.empty()),
+ });
+ return personStruct;
+ }
+
+ private void setupRowSource(Dataset<Row> ds) {
+ SchemaProvider nullSchemaProvider = new InputBatch.NullSchemaProvider();
+ InputBatch<Dataset<Row>> batch = new InputBatch<>(Option.of(ds), DUMMY_CHECKPOINT, nullSchemaProvider);
+ testRowDataSource = new TestRowDataSource(new TypedProperties(), jsc, spark, nullSchemaProvider, batch);
+ }
+
+ private void setupJsonSource(JavaRDD<String> ds, Schema schema) {
+ SchemaProvider basicSchemaProvider = new BasicSchemaProvider(schema);
+ InputBatch<JavaRDD<String>> batch = new InputBatch<>(Option.of(ds), DUMMY_CHECKPOINT, basicSchemaProvider);
+ testJsonDataSource = new TestJsonDataSource(new TypedProperties(), jsc, spark, basicSchemaProvider, batch);
+ }
+
+ private InputBatch<Dataset<Row>> fetchRowData(JavaRDD<String> rdd, StructType inputSchema) {
+ TypedProperties typedProperties = new TypedProperties();
+ typedProperties.put(SanitizationUtils.Config.SANITIZE_SCHEMA_FIELD_NAMES, true);
+ typedProperties.put(SanitizationUtils.Config.SCHEMA_FIELD_NAME_INVALID_CHAR_MASK, "__");
+ setupRowSource(spark.read().schema(inputSchema).json(rdd));
+ SourceFormatAdapter sourceFormatAdapter = new SourceFormatAdapter(testRowDataSource, Option.of(typedProperties));
+ return sourceFormatAdapter.fetchNewDataInRowFormat(Option.of(DUMMY_CHECKPOINT), 10L);
+ }
+
+ private InputBatch<Dataset<Row>> fetchJsonData(JavaRDD<String> rdd, StructType inputSchema) {
+ TypedProperties typedProperties = new TypedProperties();
+ typedProperties.put(SanitizationUtils.Config.SANITIZE_SCHEMA_FIELD_NAMES, true);
+ typedProperties.put(SanitizationUtils.Config.SCHEMA_FIELD_NAME_INVALID_CHAR_MASK, "__");
+ setupJsonSource(rdd, SchemaConverters.toAvroType(inputSchema, false, "record", ""));
+ SourceFormatAdapter sourceFormatAdapter = new SourceFormatAdapter(testJsonDataSource, Option.of(typedProperties));
+ return sourceFormatAdapter.fetchNewDataInRowFormat(Option.of(DUMMY_CHECKPOINT), 10L);
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"row", "json"})
+ public void nestedTypeWithProperNaming(String sourceType) {
+ JavaRDD<String> rdd = jsc.textFile("src/test/resources/data/avro_sanitization.json");
+ StructType inputSchema = getSchemaWithProperNaming();
+ InputBatch<Dataset<Row>> inputBatch;
+ switch (sourceType) {
+ case "row":
+ inputBatch = fetchRowData(rdd, inputSchema);
+ break;
+ case "json":
+ inputBatch = fetchJsonData(rdd, inputSchema);
+ break;
+ default:
+ throw new HoodieException("Invalid test source");
+ }
+ assertTrue(inputBatch.getBatch().isPresent());
+ Dataset<Row> ds = inputBatch.getBatch().get();
+ assertTrue(ds.collectAsList().size() == 2);
+ assertTrue(inputSchema.equals(ds.schema()));
+ JavaRDD<String> expectedData = jsc.textFile("src/test/resources/data/avro_sanitization.json");
+ assertEquals(expectedData.collect(), ds.toJSON().collectAsList());
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"row", "json"})
+ public void structTypeAndBadNaming(String sourceType) {
+ JavaRDD<String> rdd = jsc.textFile("src/test/resources/data/avro_sanitization_bad_naming_in.json");
+ InputBatch<Dataset<Row>> inputBatch;
+ switch (sourceType) {
+ case "row":
+ inputBatch = fetchRowData(rdd, getSchemaWithBadAvroNamingForStructType(false));
+ break;
+ case "json":
+ inputBatch = fetchJsonData(rdd, getSchemaWithBadAvroNamingForStructType(true));
+ break;
+ default:
+ throw new HoodieException("Invalid test source");
+ }
+ assertTrue(inputBatch.getBatch().isPresent());
+ Dataset<Row> ds = inputBatch.getBatch().get();
+ assertTrue(ds.collectAsList().size() == 2);
+ assertTrue(getSchemaWithBadAvroNamingForStructType(true).equals(ds.schema()));
+ JavaRDD<String> expectedData = jsc.textFile("src/test/resources/data/avro_sanitization_bad_naming_out.json");
+ assertEquals(expectedData.collect(), ds.toJSON().collectAsList());
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"row", "json"})
+ public void arrayTypeAndBadNaming(String sourceType) {
+ JavaRDD<String> rdd = jsc.textFile("src/test/resources/data/avro_sanitization_bad_naming_nested_array_in.json");
+ InputBatch<Dataset<Row>> inputBatch;
+ switch (sourceType) {
+ case "row":
+ inputBatch = fetchRowData(rdd, getSchemaWithBadAvroNamingForArrayType(false));
+ break;
+ case "json":
+ inputBatch = fetchJsonData(rdd, getSchemaWithBadAvroNamingForArrayType(true));
+ break;
+ default:
+ throw new HoodieException("Invalid test source");
+ }
+ assertTrue(inputBatch.getBatch().isPresent());
+ Dataset<Row> ds = inputBatch.getBatch().get();
+ assertTrue(ds.collectAsList().size() == 2);
+ System.out.println(getSchemaWithBadAvroNamingForArrayType(true));
Review Comment:
Why print in tests?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1442308517
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7dd3bae6a568456284d48df18c0ab558d675169b Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340)
* 87cbf70ffa73ceab81349245097c830ae28ddeb5 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1440728816
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7dd3bae6a568456284d48df18c0ab558d675169b Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1438828717
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 803e8874071c540e672f93f5a481a05ae8ec6131 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1448603366
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "CANCELED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* be4b1268fd16f19375d5c249bf8dbd0f89cc4e79 Azure: [CANCELED](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484)
* 5bdc2ce2de13e8358a2bf8844cbde9aad7801641 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1451041710
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
}, {
"hash" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518",
"triggerID" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"triggerType" : "PUSH"
}, {
"hash" : "fa6b818a3213ad301f4d842207655576acd6f423",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15522",
"triggerID" : "fa6b818a3213ad301f4d842207655576acd6f423",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 8a87cc573722071e141e1bdfb791f3f2b5902a18 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518)
* fa6b818a3213ad301f4d842207655576acd6f423 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15522)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1446652221
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 87cbf70ffa73ceab81349245097c830ae28ddeb5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367)
* 3019831aab40e92820737f308af2846835831b6a Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1446638502
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 87cbf70ffa73ceab81349245097c830ae28ddeb5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367)
* 3019831aab40e92820737f308af2846835831b6a UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1122335452
##########
hudi-utilities/src/test/java/org/apache/hudi/utilities/testutils/SanitizationTestBase.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * 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.hudi.utilities.testutils;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.utilities.deltastreamer.TestSourceFormatAdapter;
+
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaBuilder;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataTypes;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.Metadata;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.provider.Arguments;
+
+import java.util.stream.Stream;
+
+public class SanitizationTestBase {
Review Comment:
I see all the methods here are static. So, may not be right choice to make it a base class. lets make it SanitizationTestUtils static class and move these there.
##########
hudi-utilities/src/test/java/org/apache/hudi/utilities/sources/helpers/TestSanitizaitonUtils.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.hudi.utilities.sources.helpers;
+
+import org.apache.hudi.common.fs.FSUtils;
+import org.apache.hudi.common.util.FileIOUtils;
+import org.apache.hudi.exception.HoodieIOException;
+import org.apache.hudi.utilities.testutils.SanitizationTestBase;
+
+import org.apache.avro.Schema;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.types.StructType;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.io.IOException;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class TestSanitizaitonUtils extends SanitizationTestBase {
+
+ @ParameterizedTest
+ @MethodSource("provideDataFiles")
+ public void testSanitizeDataset(String unsanitizedDataFile, String sanitizedDataFile, StructType unsanitizedSchema, StructType sanitizedSchema) {
+ Dataset<Row> expectedSantitizedDataset = spark.read().schema(sanitizedSchema).format("json").load(sanitizedDataFile);
+ Dataset<Row> unsanitizedDataset = spark.read().schema(unsanitizedSchema).format("json").load(unsanitizedDataFile);
+ Dataset<Row> sanitizedDataset = SanitizationUtils.sanitizeColumnNamesForAvro(unsanitizedDataset,invalidCharMask);
+ assertEquals(unsanitizedDataset.count(), sanitizedDataset.count());
+ assertEquals(expectedSantitizedDataset.schema(), sanitizedDataset.schema());
+ assertEquals(expectedSantitizedDataset.collectAsList(), sanitizedDataset.collectAsList());
+ }
+
+ private void testSanitizeSchema(String unsanitizedSchema, Schema expectedSanitizedSchema) {
+ Schema sanitizedSchema = SanitizationUtils.parseAvroSchema(unsanitizedSchema, true, invalidCharMask);
+ assertEquals(sanitizedSchema, expectedSanitizedSchema);
+ }
+
+ @Test
+ public void testGoodAvroSchema() {
+ String goodJson = getJson("src/test/resources/delta-streamer-config/file_schema_provider_valid.avsc");
+ testSanitizeSchema(goodJson,generateProperFormattedSchema());
+ }
+
+ @Test
+ public void testBadAvroSchema() {
+ String badJson = getJson("src/test/resources/delta-streamer-config/file_schema_provider_invalid.avsc");
Review Comment:
can we also test if sanitization is not enable and if bad schema is passed, exception is thrown
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] jonvex commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "jonvex (via GitHub)" <gi...@apache.org>.
jonvex commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1113557043
##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -720,10 +721,22 @@ public static Schema getNullSchema() {
* @return sanitized name
*/
public static String sanitizeName(String name) {
- if (name.substring(0, 1).matches(INVALID_AVRO_FIRST_CHAR_IN_NAMES)) {
- name = name.replaceFirst(INVALID_AVRO_FIRST_CHAR_IN_NAMES, MASK_FOR_INVALID_CHARS_IN_NAMES);
+ return sanitizeName(name, MASK_FOR_INVALID_CHARS_IN_NAMES);
+ }
+
+ /**
+ * Sanitizes Name according to Avro rule for names.
+ * Removes characters other than the ones mentioned in https://avro.apache.org/docs/current/spec.html#names .
+ *
+ * @param name input name
+ * @param invalidCharMask replacement for invalid characters.
+ * @return sanitized name
+ */
+ public static String sanitizeName(String name, String invalidCharMask) {
+ if (INVALID_AVRO_FIRST_CHAR_IN_NAMES_PATTERN.matcher(name.substring(0, 1)).matches()) {
Review Comment:
https://www3.ntu.edu.sg/home/ehchua/programming/howto/Regexe.html#zz-1.1 apparently if ^ is in brackets it inverts the match
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] jonvex commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "jonvex (via GitHub)" <gi...@apache.org>.
jonvex commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1122246699
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/SanitizationUtils.java:
##########
@@ -0,0 +1,199 @@
+/*
+ * 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.hudi.utilities.sources.helpers;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.utilities.sources.InputBatch;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaParseException;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataType;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SanitizationUtils {
Review Comment:
added
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan merged pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan merged PR #8010:
URL: https://github.com/apache/hudi/pull/8010
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1122340347
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/AvroConvertor.java:
##########
@@ -58,12 +60,24 @@ public class AvroConvertor implements Serializable {
private transient Injection<GenericRecord, byte[]> recordInjection;
public AvroConvertor(String schemaStr) {
+ this(schemaStr, false, "");
Review Comment:
StringUtils.EMPTY_STRING
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -61,16 +64,58 @@
public final class SourceFormatAdapter implements Closeable {
private final Source source;
+ private final boolean shouldSanitize;
Review Comment:
you can instantiate w/ default values here. and avoid L79 to 82
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/SanitizationUtils.java:
##########
@@ -0,0 +1,181 @@
+/*
+ * 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.hudi.utilities.sources.helpers;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.collection.Pair;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaParseException;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataType;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SanitizationUtils {
Review Comment:
java docs
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/AvroConvertor.java:
##########
@@ -58,12 +60,24 @@ public class AvroConvertor implements Serializable {
private transient Injection<GenericRecord, byte[]> recordInjection;
public AvroConvertor(String schemaStr) {
+ this(schemaStr, false, "");
+ }
+
+ public AvroConvertor(String schemaStr, boolean shouldSanitize, String invalidCharMask) {
this.schemaStr = schemaStr;
+ this.invalidCharMask = invalidCharMask;
+ this.shouldSanitize = shouldSanitize;
}
public AvroConvertor(Schema schema) {
+ this(schema, false, "");
Review Comment:
use vars for empty string
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1451036771
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
}, {
"hash" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518",
"triggerID" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"triggerType" : "PUSH"
}, {
"hash" : "fa6b818a3213ad301f4d842207655576acd6f423",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "fa6b818a3213ad301f4d842207655576acd6f423",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 8a87cc573722071e141e1bdfb791f3f2b5902a18 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518)
* fa6b818a3213ad301f4d842207655576acd6f423 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1448509699
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3019831aab40e92820737f308af2846835831b6a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446)
* be4b1268fd16f19375d5c249bf8dbd0f89cc4e79 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1449186914
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 5bdc2ce2de13e8358a2bf8844cbde9aad7801641 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1447334400
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3019831aab40e92820737f308af2846835831b6a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] jonvex commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "jonvex (via GitHub)" <gi...@apache.org>.
jonvex commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1120386218
##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -720,10 +721,22 @@ public static Schema getNullSchema() {
* @return sanitized name
*/
public static String sanitizeName(String name) {
- if (name.substring(0, 1).matches(INVALID_AVRO_FIRST_CHAR_IN_NAMES)) {
- name = name.replaceFirst(INVALID_AVRO_FIRST_CHAR_IN_NAMES, MASK_FOR_INVALID_CHARS_IN_NAMES);
+ return sanitizeName(name, MASK_FOR_INVALID_CHARS_IN_NAMES);
Review Comment:
added to TestHoodieAvroUtils
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1450813815
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
}, {
"hash" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 5bdc2ce2de13e8358a2bf8844cbde9aad7801641 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488)
* 8a87cc573722071e141e1bdfb791f3f2b5902a18 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1450822001
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
}, {
"hash" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518",
"triggerID" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 5bdc2ce2de13e8358a2bf8844cbde9aad7801641 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488)
* 8a87cc573722071e141e1bdfb791f3f2b5902a18 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] jonvex commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "jonvex (via GitHub)" <gi...@apache.org>.
jonvex commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1452006855
OK CI has passed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1439289440
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 803e8874071c540e672f93f5a481a05ae8ec6131 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317)
* 1cb788947969f4573d5a4b2171fbedee696b73d8 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1114544711
##########
hudi-common/src/main/java/org/apache/hudi/avro/MercifulJsonConverter.java:
##########
@@ -44,8 +45,14 @@ public class MercifulJsonConverter {
private static final Map<Schema.Type, JsonToAvroFieldProcessor> FIELD_TYPE_PROCESSORS = getFieldTypeProcessors();
+ // For each schema (keyed by full name), stores a mapping of schema field name to json field name to account for sanitization of fields
+ private static final Map<String, Map<String, String>> SANITIZED_FIELD_MAPPINGS = new ConcurrentHashMap<>();
Review Comment:
we should clear this for every fetch. If not, schema evolution might have issues
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] jonvex commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "jonvex (via GitHub)" <gi...@apache.org>.
jonvex commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1120391046
##########
hudi-utilities/src/test/java/org/apache/hudi/utilities/deltastreamer/TestSourceFormatAdapter.java:
##########
@@ -0,0 +1,339 @@
+/*
+ * 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.hudi.utilities.deltastreamer;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.exception.HoodieException;
+import org.apache.hudi.utilities.schema.SchemaProvider;
+import org.apache.hudi.utilities.sources.InputBatch;
+import org.apache.hudi.utilities.sources.Source;
+import org.apache.hudi.utilities.sources.helpers.SanitizationUtils;
+
+import org.apache.avro.Schema;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.avro.SchemaConverters;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataTypes;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.Metadata;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TestSourceFormatAdapter {
+ private static final String DUMMY_CHECKPOINT = "dummy_checkpoint";
+
+ private static SparkSession spark;
+ private static JavaSparkContext jsc;
+ private TestRowDataSource testRowDataSource;
+ private TestJsonDataSource testJsonDataSource;
+
+ @BeforeAll
+ public static void start() {
+ spark = SparkSession
+ .builder()
+ .master("local[*]")
+ .appName(TestSourceFormatAdapter.class.getName())
+ .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
+ .getOrCreate();
+ jsc = JavaSparkContext.fromSparkContext(spark.sparkContext());
+ }
+
+ @AfterAll
+ public static void shutdown() {
+ jsc.close();
+ spark.close();
+ }
+
+ // Forces to initialize object before every test.
+ @AfterEach
+ public void teardown() {
+ testRowDataSource = null;
+ testJsonDataSource = null;
+ }
+
+ private String sanitizeIfNeeded(String src, boolean shouldSanitize) {
+ return shouldSanitize ? HoodieAvroUtils.sanitizeName(src, "__") : src;
+ }
+
+ private StructType getSchemaWithProperNaming() {
+ StructType addressStruct = new StructType(new StructField[] {
+ new StructField("state", DataTypes.StringType, true, Metadata.empty()),
+ new StructField("street", DataTypes.StringType, true, Metadata.empty()),
+ new StructField("zip", DataTypes.LongType, true, Metadata.empty()),
+ });
+
+ StructType personStruct = new StructType(new StructField[] {
+ new StructField("address", addressStruct, true, Metadata.empty()),
+ new StructField("name", DataTypes.StringType, true, Metadata.empty()),
+ new StructField("occupation", DataTypes.StringType, true, Metadata.empty()),
+ new StructField("place", DataTypes.StringType, true, Metadata.empty())
+ });
+ return personStruct;
+ }
+
+ private StructType getSchemaWithBadAvroNamingForStructType(boolean shouldSanitize) {
+ StructType addressStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@state.", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@@stree@t@", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("8@_zip", shouldSanitize),
+ DataTypes.LongType, true, Metadata.empty())
+ });
+
+ StructType personStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@_addr*$ess", shouldSanitize),
+ addressStruct, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("9name", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("_occu9pation", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@plac.e.", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty())
+ });
+ return personStruct;
+ }
+
+ private StructType getSchemaWithBadAvroNamingForArrayType(boolean shouldSanitize) {
+ StructType addressStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@state.", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@@stree@t@", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("8@_zip", shouldSanitize),
+ DataTypes.LongType, true, Metadata.empty())
+ });
+
+ StructType personStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@name", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@arr@", shouldSanitize),
+ new ArrayType(addressStruct, true), true, Metadata.empty())
+ });
+ return personStruct;
+ }
+
+ private StructType getSchemaWithBadAvroNamingForMapType(boolean shouldSanitize) {
+ StructType addressStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@state.", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@@stree@t@", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("8@_zip", shouldSanitize),
+ DataTypes.LongType, true, Metadata.empty())
+ });
+
+ StructType personStruct = new StructType(new StructField[] {
+ new StructField(sanitizeIfNeeded("@name", shouldSanitize),
+ DataTypes.StringType, true, Metadata.empty()),
+ new StructField(sanitizeIfNeeded("@map9", shouldSanitize),
+ new MapType(DataTypes.StringType, addressStruct, true), true, Metadata.empty()),
+ });
+ return personStruct;
+ }
+
+ private void setupRowSource(Dataset<Row> ds) {
+ SchemaProvider nullSchemaProvider = new InputBatch.NullSchemaProvider();
+ InputBatch<Dataset<Row>> batch = new InputBatch<>(Option.of(ds), DUMMY_CHECKPOINT, nullSchemaProvider);
+ testRowDataSource = new TestRowDataSource(new TypedProperties(), jsc, spark, nullSchemaProvider, batch);
+ }
+
+ private void setupJsonSource(JavaRDD<String> ds, Schema schema) {
+ SchemaProvider basicSchemaProvider = new BasicSchemaProvider(schema);
+ InputBatch<JavaRDD<String>> batch = new InputBatch<>(Option.of(ds), DUMMY_CHECKPOINT, basicSchemaProvider);
+ testJsonDataSource = new TestJsonDataSource(new TypedProperties(), jsc, spark, basicSchemaProvider, batch);
+ }
+
+ private InputBatch<Dataset<Row>> fetchRowData(JavaRDD<String> rdd, StructType inputSchema) {
+ TypedProperties typedProperties = new TypedProperties();
+ typedProperties.put(SanitizationUtils.Config.SANITIZE_SCHEMA_FIELD_NAMES, true);
+ typedProperties.put(SanitizationUtils.Config.SCHEMA_FIELD_NAME_INVALID_CHAR_MASK, "__");
+ setupRowSource(spark.read().schema(inputSchema).json(rdd));
+ SourceFormatAdapter sourceFormatAdapter = new SourceFormatAdapter(testRowDataSource, Option.of(typedProperties));
+ return sourceFormatAdapter.fetchNewDataInRowFormat(Option.of(DUMMY_CHECKPOINT), 10L);
+ }
+
+ private InputBatch<Dataset<Row>> fetchJsonData(JavaRDD<String> rdd, StructType inputSchema) {
+ TypedProperties typedProperties = new TypedProperties();
+ typedProperties.put(SanitizationUtils.Config.SANITIZE_SCHEMA_FIELD_NAMES, true);
+ typedProperties.put(SanitizationUtils.Config.SCHEMA_FIELD_NAME_INVALID_CHAR_MASK, "__");
+ setupJsonSource(rdd, SchemaConverters.toAvroType(inputSchema, false, "record", ""));
+ SourceFormatAdapter sourceFormatAdapter = new SourceFormatAdapter(testJsonDataSource, Option.of(typedProperties));
+ return sourceFormatAdapter.fetchNewDataInRowFormat(Option.of(DUMMY_CHECKPOINT), 10L);
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"row", "json"})
+ public void nestedTypeWithProperNaming(String sourceType) {
+ JavaRDD<String> rdd = jsc.textFile("src/test/resources/data/avro_sanitization.json");
+ StructType inputSchema = getSchemaWithProperNaming();
+ InputBatch<Dataset<Row>> inputBatch;
+ switch (sourceType) {
+ case "row":
+ inputBatch = fetchRowData(rdd, inputSchema);
+ break;
+ case "json":
+ inputBatch = fetchJsonData(rdd, inputSchema);
+ break;
+ default:
+ throw new HoodieException("Invalid test source");
+ }
+ assertTrue(inputBatch.getBatch().isPresent());
+ Dataset<Row> ds = inputBatch.getBatch().get();
+ assertTrue(ds.collectAsList().size() == 2);
+ assertTrue(inputSchema.equals(ds.schema()));
+ JavaRDD<String> expectedData = jsc.textFile("src/test/resources/data/avro_sanitization.json");
+ assertEquals(expectedData.collect(), ds.toJSON().collectAsList());
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"row", "json"})
+ public void structTypeAndBadNaming(String sourceType) {
+ JavaRDD<String> rdd = jsc.textFile("src/test/resources/data/avro_sanitization_bad_naming_in.json");
+ InputBatch<Dataset<Row>> inputBatch;
+ switch (sourceType) {
+ case "row":
+ inputBatch = fetchRowData(rdd, getSchemaWithBadAvroNamingForStructType(false));
+ break;
+ case "json":
+ inputBatch = fetchJsonData(rdd, getSchemaWithBadAvroNamingForStructType(true));
+ break;
+ default:
+ throw new HoodieException("Invalid test source");
+ }
+ assertTrue(inputBatch.getBatch().isPresent());
+ Dataset<Row> ds = inputBatch.getBatch().get();
+ assertTrue(ds.collectAsList().size() == 2);
+ assertTrue(getSchemaWithBadAvroNamingForStructType(true).equals(ds.schema()));
+ JavaRDD<String> expectedData = jsc.textFile("src/test/resources/data/avro_sanitization_bad_naming_out.json");
+ assertEquals(expectedData.collect(), ds.toJSON().collectAsList());
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"row", "json"})
+ public void arrayTypeAndBadNaming(String sourceType) {
+ JavaRDD<String> rdd = jsc.textFile("src/test/resources/data/avro_sanitization_bad_naming_nested_array_in.json");
+ InputBatch<Dataset<Row>> inputBatch;
+ switch (sourceType) {
+ case "row":
+ inputBatch = fetchRowData(rdd, getSchemaWithBadAvroNamingForArrayType(false));
+ break;
+ case "json":
+ inputBatch = fetchJsonData(rdd, getSchemaWithBadAvroNamingForArrayType(true));
+ break;
+ default:
+ throw new HoodieException("Invalid test source");
+ }
+ assertTrue(inputBatch.getBatch().isPresent());
+ Dataset<Row> ds = inputBatch.getBatch().get();
+ assertTrue(ds.collectAsList().size() == 2);
+ System.out.println(getSchemaWithBadAvroNamingForArrayType(true));
Review Comment:
Had those in to debug. Removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1113419832
##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -720,10 +721,22 @@ public static Schema getNullSchema() {
* @return sanitized name
*/
public static String sanitizeName(String name) {
- if (name.substring(0, 1).matches(INVALID_AVRO_FIRST_CHAR_IN_NAMES)) {
- name = name.replaceFirst(INVALID_AVRO_FIRST_CHAR_IN_NAMES, MASK_FOR_INVALID_CHARS_IN_NAMES);
+ return sanitizeName(name, MASK_FOR_INVALID_CHARS_IN_NAMES);
+ }
+
+ /**
+ * Sanitizes Name according to Avro rule for names.
+ * Removes characters other than the ones mentioned in https://avro.apache.org/docs/current/spec.html#names .
+ *
+ * @param name input name
+ * @param invalidCharMask replacement for invalid characters.
+ * @return sanitized name
+ */
+ public static String sanitizeName(String name, String invalidCharMask) {
+ if (INVALID_AVRO_FIRST_CHAR_IN_NAMES_PATTERN.matcher(name.substring(0, 1)).matches()) {
Review Comment:
shouldn't this be inverse?
if first char matches ^0-9 or if first char does not match ^A-Za-z, we should replace. can you help me understand what am I missing here
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -124,6 +261,7 @@ public InputBatch<Dataset<Row>> fetchNewDataInRowFormat(Option<String> lastCkptS
r.getCheckpointForNextBatch(), r.getSchemaProvider());
}
case PROTO: {
+ //sanitizing is not done, but could be implemented if needed
Review Comment:
we can do checkArg and throw exception si sanitization is enabled for proto source.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -49,9 +57,119 @@
public final class SourceFormatAdapter implements Closeable {
private final Source source;
+ private final SourceFormatAdapterConfig config;
+
+ public static class SourceFormatAdapterConfig extends HoodieConfig {
Review Comment:
lets add config annotation.
lets move this to a separate class and not embed here.
also, may be we should name this DeltaStreamerSourceConfigs.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -60,15 +178,20 @@ public SourceFormatAdapter(Source source) {
public InputBatch<JavaRDD<GenericRecord>> fetchNewDataInAvroFormat(Option<String> lastCkptStr, long sourceLimit) {
switch (source.getSourceType()) {
case AVRO:
+ //don't need to sanitize because it's already avro
return ((Source<JavaRDD<GenericRecord>>) source).fetchNext(lastCkptStr, sourceLimit);
case JSON: {
+ //sanitizing is done inside the convertor
Review Comment:
nit. end doc with " if enabled"
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/FilebasedSchemaProvider.java:
##########
@@ -79,4 +92,80 @@ public Schema getTargetSchema() {
return super.getTargetSchema();
}
}
+
+ private static Schema readAvroSchemaFromFile(String schemaPath, FileSystem fs, boolean sanitizeSchema, String invalidCharMask) {
+ String schemaStr;
+ try (FSDataInputStream in = fs.open(new Path(schemaPath))) {
+ schemaStr = FileIOUtils.readAsUTFString(in);
+ } catch (IOException ioe) {
+ throw new HoodieIOException(String.format("Error reading schema from file %s", schemaPath), ioe);
+ }
+ return parseAvroSchema(schemaStr, sanitizeSchema, invalidCharMask);
+ }
+
+ /*
+ * We first rely on Avro to parse and then try to rename only for those failed.
+ * This way we can improve our parsing capabilities without breaking existing functionality.
+ * For example, we don't yet support multiple named schemas defined in a file.
+ */
+ private static Schema parseAvroSchema(String schemaStr, boolean sanitizeSchema, String invalidCharMask) {
Review Comment:
lets try to use the same variable name, argument name across the code base.
for eg, shouldSanitize, sanitizeSchema should be unified.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/FilebasedSchemaProvider.java:
##########
@@ -79,4 +92,80 @@ public Schema getTargetSchema() {
return super.getTargetSchema();
}
}
+
+ private static Schema readAvroSchemaFromFile(String schemaPath, FileSystem fs, boolean sanitizeSchema, String invalidCharMask) {
+ String schemaStr;
+ try (FSDataInputStream in = fs.open(new Path(schemaPath))) {
+ schemaStr = FileIOUtils.readAsUTFString(in);
+ } catch (IOException ioe) {
+ throw new HoodieIOException(String.format("Error reading schema from file %s", schemaPath), ioe);
+ }
+ return parseAvroSchema(schemaStr, sanitizeSchema, invalidCharMask);
+ }
+
+ /*
+ * We first rely on Avro to parse and then try to rename only for those failed.
+ * This way we can improve our parsing capabilities without breaking existing functionality.
+ * For example, we don't yet support multiple named schemas defined in a file.
+ */
+ private static Schema parseAvroSchema(String schemaStr, boolean sanitizeSchema, String invalidCharMask) {
+ try {
+ return new Schema.Parser().parse(schemaStr);
+ } catch (SchemaParseException spe) {
+ // if sanitizing is not enabled rethrow the exception.
+ if (!sanitizeSchema) {
+ throw spe;
+ }
+ // Rename avro fields and try parsing once again.
+ Option<Schema> parseResult = parseSanitizedAvroSchemaNoThrow(schemaStr, invalidCharMask);
+ if (!parseResult.isPresent()) {
+ // throw original exception.
+ throw spe;
+ }
+ return parseResult.get();
+ }
+ }
+
+ private static List<Object> transformList(List<Object> src, String invalidCharMask) {
Review Comment:
java docs
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -49,9 +57,119 @@
public final class SourceFormatAdapter implements Closeable {
private final Source source;
+ private final SourceFormatAdapterConfig config;
+
+ public static class SourceFormatAdapterConfig extends HoodieConfig {
+ // sanitizes names of invalid schema fields both in the data read from source and also in the schema.
+ // invalid definition here goes by avro naming convention (https://avro.apache.org/docs/current/spec.html#names).
+ public static final ConfigProperty<String> SANITIZE_SCHEMA_FIELD_NAMES = ConfigProperty
+ .key("hoodie.deltastreamer.source.sanitize.invalid.schema.field.names")
+ .defaultValue("false")
+ .withDocumentation("Sanitizes invalid schema field names both in the data and also in the schema");
+
+ public static final ConfigProperty<String> SCHEMA_FIELD_NAME_INVALID_CHAR_MASK = ConfigProperty
+ .key("hoodie.deltastreamer.source.sanitize.invalid.char.mask")
+ .defaultValue("__")
+ .withDocumentation("Character mask to be used as replacement for invalid field names");
+
+ public SourceFormatAdapterConfig() {
+ super();
+ }
+
+ public SourceFormatAdapterConfig(TypedProperties props) {
+ super(props);
+ }
+ }
public SourceFormatAdapter(Source source) {
+ this(source, Option.empty());
+ }
+
+ public SourceFormatAdapter(Source source,
+ Option<TypedProperties> props) {
this.source = source;
+ this.config = props.isPresent() ? new SourceFormatAdapterConfig((props.get())) : new SourceFormatAdapterConfig();
+ }
+
+ /**
+ * Config that automatically sanitizes the field names as per avro naming rules.
+ * @return enabled status.
+ */
+ private boolean isNameSanitizingEnabled() {
+ return config.getBooleanOrDefault(SourceFormatAdapterConfig.SANITIZE_SCHEMA_FIELD_NAMES);
+ }
+
+ /**
+ * Replacement mask for invalid characters encountered in avro names.
+ * @return sanitized value.
+ */
+ private String getInvalidCharMask() {
+ return config.getStringOrDefault(SourceFormatAdapterConfig.SCHEMA_FIELD_NAME_INVALID_CHAR_MASK);
+ }
+
+ private static DataType sanitizeDataTypeForAvro(DataType dataType, String invalidCharMask) {
+ if (dataType instanceof ArrayType) {
+ ArrayType arrayType = (ArrayType) dataType;
+ DataType sanitizedDataType = sanitizeDataTypeForAvro(arrayType.elementType(), invalidCharMask);
+ return new ArrayType(sanitizedDataType, arrayType.containsNull());
+ } else if (dataType instanceof MapType) {
+ MapType mapType = (MapType) dataType;
+ DataType sanitizedKeyDataType = sanitizeDataTypeForAvro(mapType.keyType(), invalidCharMask);
+ DataType sanitizedValueDataType = sanitizeDataTypeForAvro(mapType.valueType(), invalidCharMask);
+ return new MapType(sanitizedKeyDataType, sanitizedValueDataType, mapType.valueContainsNull());
+ } else if (dataType instanceof StructType) {
+ return sanitizeStructTypeForAvro((StructType) dataType, invalidCharMask);
+ }
+ return dataType;
+ }
+
+ // TODO(HUDI-5256): Refactor this to use InternalSchema when it is ready.
+ private static StructType sanitizeStructTypeForAvro(StructType structType, String invalidCharMask) {
+ StructType sanitizedStructType = new StructType();
+ StructField[] structFields = structType.fields();
+ for (StructField s : structFields) {
+ DataType currFieldDataTypeSanitized = sanitizeDataTypeForAvro(s.dataType(), invalidCharMask);
+ StructField structFieldCopy = new StructField(HoodieAvroUtils.sanitizeName(s.name(), invalidCharMask),
+ currFieldDataTypeSanitized, s.nullable(), s.metadata());
+ sanitizedStructType = sanitizedStructType.add(structFieldCopy);
+ }
+ return sanitizedStructType;
+ }
+
+ private static Dataset<Row> sanitizeColumnNamesForAvro(Dataset<Row> inputDataset, String invalidCharMask) {
Review Comment:
lets move these static method to some Utils. SanitizeUtils or something. and lets keep the SourceFormatAdaptor lean.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -49,9 +57,119 @@
public final class SourceFormatAdapter implements Closeable {
private final Source source;
+ private final SourceFormatAdapterConfig config;
+
+ public static class SourceFormatAdapterConfig extends HoodieConfig {
+ // sanitizes names of invalid schema fields both in the data read from source and also in the schema.
+ // invalid definition here goes by avro naming convention (https://avro.apache.org/docs/current/spec.html#names).
+ public static final ConfigProperty<String> SANITIZE_SCHEMA_FIELD_NAMES = ConfigProperty
+ .key("hoodie.deltastreamer.source.sanitize.invalid.schema.field.names")
+ .defaultValue("false")
+ .withDocumentation("Sanitizes invalid schema field names both in the data and also in the schema");
+
+ public static final ConfigProperty<String> SCHEMA_FIELD_NAME_INVALID_CHAR_MASK = ConfigProperty
+ .key("hoodie.deltastreamer.source.sanitize.invalid.char.mask")
+ .defaultValue("__")
+ .withDocumentation("Character mask to be used as replacement for invalid field names");
+
+ public SourceFormatAdapterConfig() {
+ super();
+ }
+
+ public SourceFormatAdapterConfig(TypedProperties props) {
+ super(props);
+ }
+ }
public SourceFormatAdapter(Source source) {
+ this(source, Option.empty());
+ }
+
+ public SourceFormatAdapter(Source source,
+ Option<TypedProperties> props) {
this.source = source;
+ this.config = props.isPresent() ? new SourceFormatAdapterConfig((props.get())) : new SourceFormatAdapterConfig();
+ }
+
+ /**
+ * Config that automatically sanitizes the field names as per avro naming rules.
+ * @return enabled status.
+ */
+ private boolean isNameSanitizingEnabled() {
Review Comment:
isFieldNameSanitizationEnabled
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -60,15 +178,20 @@ public SourceFormatAdapter(Source source) {
public InputBatch<JavaRDD<GenericRecord>> fetchNewDataInAvroFormat(Option<String> lastCkptStr, long sourceLimit) {
switch (source.getSourceType()) {
case AVRO:
+ //don't need to sanitize because it's already avro
return ((Source<JavaRDD<GenericRecord>>) source).fetchNext(lastCkptStr, sourceLimit);
case JSON: {
+ //sanitizing is done inside the convertor
InputBatch<JavaRDD<String>> r = ((Source<JavaRDD<String>>) source).fetchNext(lastCkptStr, sourceLimit);
- AvroConvertor convertor = new AvroConvertor(r.getSchemaProvider().getSourceSchema());
+ AvroConvertor convertor = new AvroConvertor(r.getSchemaProvider().getSourceSchema(), isNameSanitizingEnabled(), getInvalidCharMask());
return new InputBatch<>(Option.ofNullable(r.getBatch().map(rdd -> rdd.map(convertor::fromJson)).orElse(null)),
- r.getCheckpointForNextBatch(), r.getSchemaProvider());
+ r.getCheckpointForNextBatch(),
+ r.getSchemaProvider());
}
case ROW: {
- InputBatch<Dataset<Row>> r = ((Source<Dataset<Row>>) source).fetchNext(lastCkptStr, sourceLimit);
+ //we do the sanitizing here
Review Comment:
nit. end docs w/ "if enabled"
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -94,27 +218,40 @@ public InputBatch<JavaRDD<GenericRecord>> fetchNewDataInAvroFormat(Option<String
}
}
+ private InputBatch<Dataset<Row>> avroDataInRowFormat(InputBatch<JavaRDD<GenericRecord>> r) {
+ Schema sourceSchema = r.getSchemaProvider().getSourceSchema();
+ return new InputBatch<>(
+ Option
+ .ofNullable(
+ r.getBatch()
+ .map(rdd -> AvroConversionUtils.createDataFrame(JavaRDD.toRDD(rdd), sourceSchema.toString(),
+ source.getSparkSession())
+ )
+ .orElse(null)),
+ r.getCheckpointForNextBatch(), r.getSchemaProvider());
+ }
+
/**
* Fetch new data in row format. If the source provides data in different format, they are translated to Row format
*/
public InputBatch<Dataset<Row>> fetchNewDataInRowFormat(Option<String> lastCkptStr, long sourceLimit) {
switch (source.getSourceType()) {
case ROW:
- return ((Source<Dataset<Row>>) source).fetchNext(lastCkptStr, sourceLimit);
+ //we do the sanitizing here
+ return trySanitizeFieldNames(((Source<Dataset<Row>>) source).fetchNext(lastCkptStr, sourceLimit),
+ isNameSanitizingEnabled(), getInvalidCharMask());
case AVRO: {
+ //don't need to sanitize because it's already avro
InputBatch<JavaRDD<GenericRecord>> r = ((Source<JavaRDD<GenericRecord>>) source).fetchNext(lastCkptStr, sourceLimit);
- Schema sourceSchema = r.getSchemaProvider().getSourceSchema();
- return new InputBatch<>(
- Option
- .ofNullable(
- r.getBatch()
- .map(rdd -> AvroConversionUtils.createDataFrame(JavaRDD.toRDD(rdd), sourceSchema.toString(),
- source.getSparkSession())
- )
- .orElse(null)),
- r.getCheckpointForNextBatch(), r.getSchemaProvider());
+ return avroDataInRowFormat(r);
}
case JSON: {
+ if (isNameSanitizingEnabled()) {
+ //leverage the json -> avro sanitizing, If more speed is needed, then specific json -> row with sanitizing is possible
Review Comment:
can we file a follow up ticket on this.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -94,27 +218,40 @@ public InputBatch<JavaRDD<GenericRecord>> fetchNewDataInAvroFormat(Option<String
}
}
+ private InputBatch<Dataset<Row>> avroDataInRowFormat(InputBatch<JavaRDD<GenericRecord>> r) {
+ Schema sourceSchema = r.getSchemaProvider().getSourceSchema();
+ return new InputBatch<>(
+ Option
+ .ofNullable(
+ r.getBatch()
+ .map(rdd -> AvroConversionUtils.createDataFrame(JavaRDD.toRDD(rdd), sourceSchema.toString(),
+ source.getSparkSession())
+ )
+ .orElse(null)),
+ r.getCheckpointForNextBatch(), r.getSchemaProvider());
+ }
+
/**
* Fetch new data in row format. If the source provides data in different format, they are translated to Row format
*/
public InputBatch<Dataset<Row>> fetchNewDataInRowFormat(Option<String> lastCkptStr, long sourceLimit) {
switch (source.getSourceType()) {
case ROW:
- return ((Source<Dataset<Row>>) source).fetchNext(lastCkptStr, sourceLimit);
+ //we do the sanitizing here
+ return trySanitizeFieldNames(((Source<Dataset<Row>>) source).fetchNext(lastCkptStr, sourceLimit),
+ isNameSanitizingEnabled(), getInvalidCharMask());
case AVRO: {
+ //don't need to sanitize because it's already avro
InputBatch<JavaRDD<GenericRecord>> r = ((Source<JavaRDD<GenericRecord>>) source).fetchNext(lastCkptStr, sourceLimit);
- Schema sourceSchema = r.getSchemaProvider().getSourceSchema();
- return new InputBatch<>(
- Option
- .ofNullable(
- r.getBatch()
- .map(rdd -> AvroConversionUtils.createDataFrame(JavaRDD.toRDD(rdd), sourceSchema.toString(),
- source.getSparkSession())
- )
- .orElse(null)),
- r.getCheckpointForNextBatch(), r.getSchemaProvider());
+ return avroDataInRowFormat(r);
}
case JSON: {
+ if (isNameSanitizingEnabled()) {
+ //leverage the json -> avro sanitizing, If more speed is needed, then specific json -> row with sanitizing is possible
Review Comment:
nit. "if more speed is needed" -> "Its feasible to optimize this conversion directly from json to avro. More details in HUDI-XXXX"
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -49,9 +57,119 @@
public final class SourceFormatAdapter implements Closeable {
private final Source source;
+ private final SourceFormatAdapterConfig config;
+
+ public static class SourceFormatAdapterConfig extends HoodieConfig {
+ // sanitizes names of invalid schema fields both in the data read from source and also in the schema.
+ // invalid definition here goes by avro naming convention (https://avro.apache.org/docs/current/spec.html#names).
+ public static final ConfigProperty<String> SANITIZE_SCHEMA_FIELD_NAMES = ConfigProperty
+ .key("hoodie.deltastreamer.source.sanitize.invalid.schema.field.names")
+ .defaultValue("false")
+ .withDocumentation("Sanitizes invalid schema field names both in the data and also in the schema");
+
+ public static final ConfigProperty<String> SCHEMA_FIELD_NAME_INVALID_CHAR_MASK = ConfigProperty
+ .key("hoodie.deltastreamer.source.sanitize.invalid.char.mask")
+ .defaultValue("__")
+ .withDocumentation("Character mask to be used as replacement for invalid field names");
+
+ public SourceFormatAdapterConfig() {
+ super();
+ }
+
+ public SourceFormatAdapterConfig(TypedProperties props) {
+ super(props);
+ }
+ }
public SourceFormatAdapter(Source source) {
+ this(source, Option.empty());
+ }
+
+ public SourceFormatAdapter(Source source,
+ Option<TypedProperties> props) {
this.source = source;
+ this.config = props.isPresent() ? new SourceFormatAdapterConfig((props.get())) : new SourceFormatAdapterConfig();
+ }
+
+ /**
+ * Config that automatically sanitizes the field names as per avro naming rules.
+ * @return enabled status.
+ */
+ private boolean isNameSanitizingEnabled() {
+ return config.getBooleanOrDefault(SourceFormatAdapterConfig.SANITIZE_SCHEMA_FIELD_NAMES);
+ }
+
+ /**
+ * Replacement mask for invalid characters encountered in avro names.
+ * @return sanitized value.
+ */
+ private String getInvalidCharMask() {
+ return config.getStringOrDefault(SourceFormatAdapterConfig.SCHEMA_FIELD_NAME_INVALID_CHAR_MASK);
+ }
+
+ private static DataType sanitizeDataTypeForAvro(DataType dataType, String invalidCharMask) {
+ if (dataType instanceof ArrayType) {
+ ArrayType arrayType = (ArrayType) dataType;
+ DataType sanitizedDataType = sanitizeDataTypeForAvro(arrayType.elementType(), invalidCharMask);
+ return new ArrayType(sanitizedDataType, arrayType.containsNull());
+ } else if (dataType instanceof MapType) {
+ MapType mapType = (MapType) dataType;
+ DataType sanitizedKeyDataType = sanitizeDataTypeForAvro(mapType.keyType(), invalidCharMask);
+ DataType sanitizedValueDataType = sanitizeDataTypeForAvro(mapType.valueType(), invalidCharMask);
+ return new MapType(sanitizedKeyDataType, sanitizedValueDataType, mapType.valueContainsNull());
+ } else if (dataType instanceof StructType) {
+ return sanitizeStructTypeForAvro((StructType) dataType, invalidCharMask);
+ }
+ return dataType;
+ }
+
+ // TODO(HUDI-5256): Refactor this to use InternalSchema when it is ready.
+ private static StructType sanitizeStructTypeForAvro(StructType structType, String invalidCharMask) {
+ StructType sanitizedStructType = new StructType();
+ StructField[] structFields = structType.fields();
+ for (StructField s : structFields) {
+ DataType currFieldDataTypeSanitized = sanitizeDataTypeForAvro(s.dataType(), invalidCharMask);
+ StructField structFieldCopy = new StructField(HoodieAvroUtils.sanitizeName(s.name(), invalidCharMask),
+ currFieldDataTypeSanitized, s.nullable(), s.metadata());
+ sanitizedStructType = sanitizedStructType.add(structFieldCopy);
+ }
+ return sanitizedStructType;
+ }
+
+ private static Dataset<Row> sanitizeColumnNamesForAvro(Dataset<Row> inputDataset, String invalidCharMask) {
+ StructField[] inputFields = inputDataset.schema().fields();
+ Dataset<Row> targetDataset = inputDataset;
+ for (StructField sf : inputFields) {
+ DataType sanitizedFieldDataType = sanitizeDataTypeForAvro(sf.dataType(), invalidCharMask);
+ if (!sanitizedFieldDataType.equals(sf.dataType())) {
+ // Sanitizing column names for nested types can be thought of as going from one schema to another
+ // which are structurally similar except for actual column names itself. So casting is safe and sufficient.
+ targetDataset = targetDataset.withColumn(sf.name(), targetDataset.col(sf.name()).cast(sanitizedFieldDataType));
+ }
+ String possibleRename = HoodieAvroUtils.sanitizeName(sf.name(), invalidCharMask);
+ if (!sf.name().equals(possibleRename)) {
+ targetDataset = targetDataset.withColumnRenamed(sf.name(), possibleRename);
+ }
+ }
+ return targetDataset;
+ }
+
+ /**
+ * Sanitize all columns including nested ones as per Avro conventions.
+ * @param srcBatch
+ * @param shouldSanitize
+ * @param invalidCharMask
+ * @return sanitized batch.
+ */
+ private static InputBatch<Dataset<Row>> trySanitizeFieldNames(InputBatch<Dataset<Row>> srcBatch,
Review Comment:
mayBeSanitizeFeildNames
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/FilebasedSchemaProvider.java:
##########
@@ -79,4 +92,80 @@ public Schema getTargetSchema() {
return super.getTargetSchema();
}
}
+
+ private static Schema readAvroSchemaFromFile(String schemaPath, FileSystem fs, boolean sanitizeSchema, String invalidCharMask) {
+ String schemaStr;
+ try (FSDataInputStream in = fs.open(new Path(schemaPath))) {
+ schemaStr = FileIOUtils.readAsUTFString(in);
+ } catch (IOException ioe) {
+ throw new HoodieIOException(String.format("Error reading schema from file %s", schemaPath), ioe);
+ }
+ return parseAvroSchema(schemaStr, sanitizeSchema, invalidCharMask);
+ }
+
+ /*
+ * We first rely on Avro to parse and then try to rename only for those failed.
+ * This way we can improve our parsing capabilities without breaking existing functionality.
+ * For example, we don't yet support multiple named schemas defined in a file.
+ */
+ private static Schema parseAvroSchema(String schemaStr, boolean sanitizeSchema, String invalidCharMask) {
+ try {
+ return new Schema.Parser().parse(schemaStr);
+ } catch (SchemaParseException spe) {
+ // if sanitizing is not enabled rethrow the exception.
+ if (!sanitizeSchema) {
+ throw spe;
+ }
+ // Rename avro fields and try parsing once again.
+ Option<Schema> parseResult = parseSanitizedAvroSchemaNoThrow(schemaStr, invalidCharMask);
+ if (!parseResult.isPresent()) {
+ // throw original exception.
+ throw spe;
+ }
+ return parseResult.get();
+ }
+ }
+
+ private static List<Object> transformList(List<Object> src, String invalidCharMask) {
+ return src.stream().map(obj -> {
+ if (obj instanceof List) {
+ return transformList((List<Object>) obj, invalidCharMask);
+ } else if (obj instanceof Map) {
+ return transformMap((Map<String, Object>) obj, invalidCharMask);
+ } else {
+ return obj;
+ }
+ }).collect(Collectors.toList());
+ }
+
+ private static Map<String, Object> transformMap(Map<String, Object> src, String invalidCharMask) {
Review Comment:
I will leave it to take a call. lets see if it makes sense to move these also to SanitizationUtils
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1438970301
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 803e8874071c540e672f93f5a481a05ae8ec6131 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1439404811
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 1cb788947969f4573d5a4b2171fbedee696b73d8 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] jonvex commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "jonvex (via GitHub)" <gi...@apache.org>.
jonvex commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1116130380
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -124,6 +261,7 @@ public InputBatch<Dataset<Row>> fetchNewDataInRowFormat(Option<String> lastCkptS
r.getCheckpointForNextBatch(), r.getSchemaProvider());
}
case PROTO: {
+ //sanitizing is not done, but could be implemented if needed
Review Comment:
I put the check in SourceFormatAdapter constructor
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] the-other-tim-brown commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "the-other-tim-brown (via GitHub)" <gi...@apache.org>.
the-other-tim-brown commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1116422754
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/SanitizationUtils.java:
##########
@@ -0,0 +1,198 @@
+/*
+ * 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.hudi.utilities.sources.helpers;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.utilities.sources.InputBatch;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaParseException;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataType;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SanitizationUtils {
+
+ public static class Config {
+ // sanitizes names of invalid schema fields both in the data read from source and also in the schema.
+ // invalid definition here goes by avro naming convention (https://avro.apache.org/docs/current/spec.html#names).
+ public static final String SANITIZE_SCHEMA_FIELD_NAMES = "hoodie.deltastreamer.source.sanitize.invalid.schema.field.names";
+
+ public static final String SCHEMA_FIELD_NAME_INVALID_CHAR_MASK = "hoodie.deltastreamer.source.sanitize.invalid.char.mask";
+ }
+
+ private static final String AVRO_FIELD_NAME_KEY = "name";
+
+ private static DataType sanitizeDataTypeForAvro(DataType dataType, String invalidCharMask) {
+ if (dataType instanceof ArrayType) {
+ ArrayType arrayType = (ArrayType) dataType;
+ DataType sanitizedDataType = sanitizeDataTypeForAvro(arrayType.elementType(), invalidCharMask);
+ return new ArrayType(sanitizedDataType, arrayType.containsNull());
+ } else if (dataType instanceof MapType) {
+ MapType mapType = (MapType) dataType;
+ DataType sanitizedKeyDataType = sanitizeDataTypeForAvro(mapType.keyType(), invalidCharMask);
+ DataType sanitizedValueDataType = sanitizeDataTypeForAvro(mapType.valueType(), invalidCharMask);
+ return new MapType(sanitizedKeyDataType, sanitizedValueDataType, mapType.valueContainsNull());
+ } else if (dataType instanceof StructType) {
+ return sanitizeStructTypeForAvro((StructType) dataType, invalidCharMask);
+ }
+ return dataType;
+ }
+
+ // TODO(HUDI-5256): Refactor this to use InternalSchema when it is ready.
+ private static StructType sanitizeStructTypeForAvro(StructType structType, String invalidCharMask) {
+ StructType sanitizedStructType = new StructType();
+ StructField[] structFields = structType.fields();
+ for (StructField s : structFields) {
+ DataType currFieldDataTypeSanitized = sanitizeDataTypeForAvro(s.dataType(), invalidCharMask);
+ StructField structFieldCopy = new StructField(HoodieAvroUtils.sanitizeName(s.name(), invalidCharMask),
+ currFieldDataTypeSanitized, s.nullable(), s.metadata());
+ sanitizedStructType = sanitizedStructType.add(structFieldCopy);
+ }
+ return sanitizedStructType;
+ }
+
+ private static Dataset<Row> sanitizeColumnNamesForAvro(Dataset<Row> inputDataset, String invalidCharMask) {
+ StructField[] inputFields = inputDataset.schema().fields();
+ Dataset<Row> targetDataset = inputDataset;
+ for (StructField sf : inputFields) {
+ DataType sanitizedFieldDataType = sanitizeDataTypeForAvro(sf.dataType(), invalidCharMask);
+ if (!sanitizedFieldDataType.equals(sf.dataType())) {
+ // Sanitizing column names for nested types can be thought of as going from one schema to another
+ // which are structurally similar except for actual column names itself. So casting is safe and sufficient.
+ targetDataset = targetDataset.withColumn(sf.name(), targetDataset.col(sf.name()).cast(sanitizedFieldDataType));
+ }
+ String possibleRename = HoodieAvroUtils.sanitizeName(sf.name(), invalidCharMask);
+ if (!sf.name().equals(possibleRename)) {
+ targetDataset = targetDataset.withColumnRenamed(sf.name(), possibleRename);
+ }
+ }
+ return targetDataset;
+ }
+
+ /**
+ * Sanitize all columns including nested ones as per Avro conventions.
+ * @param srcBatch
+ * @param shouldSanitize
+ * @param invalidCharMask
+ * @return sanitized batch.
+ */
+ public static InputBatch<Dataset<Row>> maybeSanitizeFieldNames(InputBatch<Dataset<Row>> srcBatch,
+ boolean shouldSanitize,
+ String invalidCharMask) {
+ if (!shouldSanitize || !srcBatch.getBatch().isPresent()) {
+ return srcBatch;
+ }
+ Dataset<Row> srcDs = srcBatch.getBatch().get();
+ Dataset<Row> targetDs = sanitizeColumnNamesForAvro(srcDs, invalidCharMask);
+ return new InputBatch<>(Option.ofNullable(targetDs), srcBatch.getCheckpointForNextBatch(), srcBatch.getSchemaProvider());
+ }
+
+ /*
+ * We first rely on Avro to parse and then try to rename only for those failed.
+ * This way we can improve our parsing capabilities without breaking existing functionality.
+ * For example, we don't yet support multiple named schemas defined in a file.
+ */
+ public static Schema parseAvroSchema(String schemaStr, boolean shouldSanitize, String invalidCharMask) {
+ try {
+ return new Schema.Parser().parse(schemaStr);
+ } catch (SchemaParseException spe) {
+ // if sanitizing is not enabled rethrow the exception.
+ if (!shouldSanitize) {
+ throw spe;
+ }
+ // Rename avro fields and try parsing once again.
+ Option<Schema> parseResult = parseSanitizedAvroSchemaNoThrow(schemaStr, invalidCharMask);
+ if (!parseResult.isPresent()) {
+ // throw original exception.
+ throw spe;
+ }
+ return parseResult.get();
+ }
+ }
+
+ /**
+ * Parse list for sanitizing
+ * @param src - deserialized schema
+ * @param invalidCharMask - mask to replace invalid characters with
+ */
+ private static List<Object> transformList(List<Object> src, String invalidCharMask) {
+ return src.stream().map(obj -> {
+ if (obj instanceof List) {
+ return transformList((List<Object>) obj, invalidCharMask);
+ } else if (obj instanceof Map) {
+ return transformMap((Map<String, Object>) obj, invalidCharMask);
+ } else {
+ return obj;
+ }
+ }).collect(Collectors.toList());
+ }
+
+ /**
+ * Parse map for sanitizing. If we have a string in the map, and it is an avro field name key, then we sanitize the name.
+ * Otherwise, we keep recursively going through the schema.
+ * @param src - deserialized schema
+ * @param invalidCharMask - mask to replace invalid characters with
+ */
+ private static Map<String, Object> transformMap(Map<String, Object> src, String invalidCharMask) {
+ return src.entrySet().stream()
+ .map(kv -> {
+ if (kv.getValue() instanceof List) {
+ return Pair.of(kv.getKey(), transformList((List<Object>) kv.getValue(), invalidCharMask));
+ } else if (kv.getValue() instanceof Map) {
+ return Pair.of(kv.getKey(), transformMap((Map<String, Object>) kv.getValue(), invalidCharMask));
+ } else if (kv.getValue() instanceof String) {
+ String currentStrValue = (String) kv.getValue();
+ if (kv.getKey().equals(AVRO_FIELD_NAME_KEY)) {
+ return Pair.of(kv.getKey(), HoodieAvroUtils.sanitizeName(currentStrValue, invalidCharMask));
+ }
+ return Pair.of(kv.getKey(), currentStrValue);
+ } else {
+ return Pair.of(kv.getKey(), kv.getValue());
+ }
+ }).collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
+ }
+
+ /**
+ * Sanitizes illegal field names in the schema using recursive calls to transformMap and transformList
+ */
+ private static Option<Schema> parseSanitizedAvroSchemaNoThrow(String schemaStr, String invalidCharMask) {
+ try {
+ ObjectMapper objectMapper = new ObjectMapper();
Review Comment:
ObjectMapper instances are thread safe and it's recommended to reuse the object since it's heavy to construct. Can we make this a static instance?
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/SanitizationUtils.java:
##########
@@ -0,0 +1,198 @@
+/*
+ * 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.hudi.utilities.sources.helpers;
+
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.utilities.sources.InputBatch;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaParseException;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.types.ArrayType;
+import org.apache.spark.sql.types.DataType;
+import org.apache.spark.sql.types.MapType;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SanitizationUtils {
+
+ public static class Config {
+ // sanitizes names of invalid schema fields both in the data read from source and also in the schema.
+ // invalid definition here goes by avro naming convention (https://avro.apache.org/docs/current/spec.html#names).
+ public static final String SANITIZE_SCHEMA_FIELD_NAMES = "hoodie.deltastreamer.source.sanitize.invalid.schema.field.names";
+
+ public static final String SCHEMA_FIELD_NAME_INVALID_CHAR_MASK = "hoodie.deltastreamer.source.sanitize.invalid.char.mask";
+ }
+
+ private static final String AVRO_FIELD_NAME_KEY = "name";
+
+ private static DataType sanitizeDataTypeForAvro(DataType dataType, String invalidCharMask) {
+ if (dataType instanceof ArrayType) {
+ ArrayType arrayType = (ArrayType) dataType;
+ DataType sanitizedDataType = sanitizeDataTypeForAvro(arrayType.elementType(), invalidCharMask);
+ return new ArrayType(sanitizedDataType, arrayType.containsNull());
+ } else if (dataType instanceof MapType) {
+ MapType mapType = (MapType) dataType;
+ DataType sanitizedKeyDataType = sanitizeDataTypeForAvro(mapType.keyType(), invalidCharMask);
+ DataType sanitizedValueDataType = sanitizeDataTypeForAvro(mapType.valueType(), invalidCharMask);
+ return new MapType(sanitizedKeyDataType, sanitizedValueDataType, mapType.valueContainsNull());
+ } else if (dataType instanceof StructType) {
+ return sanitizeStructTypeForAvro((StructType) dataType, invalidCharMask);
+ }
+ return dataType;
+ }
+
+ // TODO(HUDI-5256): Refactor this to use InternalSchema when it is ready.
+ private static StructType sanitizeStructTypeForAvro(StructType structType, String invalidCharMask) {
+ StructType sanitizedStructType = new StructType();
+ StructField[] structFields = structType.fields();
+ for (StructField s : structFields) {
+ DataType currFieldDataTypeSanitized = sanitizeDataTypeForAvro(s.dataType(), invalidCharMask);
+ StructField structFieldCopy = new StructField(HoodieAvroUtils.sanitizeName(s.name(), invalidCharMask),
+ currFieldDataTypeSanitized, s.nullable(), s.metadata());
+ sanitizedStructType = sanitizedStructType.add(structFieldCopy);
+ }
+ return sanitizedStructType;
+ }
+
+ private static Dataset<Row> sanitizeColumnNamesForAvro(Dataset<Row> inputDataset, String invalidCharMask) {
+ StructField[] inputFields = inputDataset.schema().fields();
+ Dataset<Row> targetDataset = inputDataset;
+ for (StructField sf : inputFields) {
+ DataType sanitizedFieldDataType = sanitizeDataTypeForAvro(sf.dataType(), invalidCharMask);
+ if (!sanitizedFieldDataType.equals(sf.dataType())) {
+ // Sanitizing column names for nested types can be thought of as going from one schema to another
+ // which are structurally similar except for actual column names itself. So casting is safe and sufficient.
+ targetDataset = targetDataset.withColumn(sf.name(), targetDataset.col(sf.name()).cast(sanitizedFieldDataType));
+ }
+ String possibleRename = HoodieAvroUtils.sanitizeName(sf.name(), invalidCharMask);
+ if (!sf.name().equals(possibleRename)) {
+ targetDataset = targetDataset.withColumnRenamed(sf.name(), possibleRename);
+ }
+ }
+ return targetDataset;
+ }
+
+ /**
+ * Sanitize all columns including nested ones as per Avro conventions.
+ * @param srcBatch
+ * @param shouldSanitize
+ * @param invalidCharMask
+ * @return sanitized batch.
+ */
+ public static InputBatch<Dataset<Row>> maybeSanitizeFieldNames(InputBatch<Dataset<Row>> srcBatch,
+ boolean shouldSanitize,
+ String invalidCharMask) {
+ if (!shouldSanitize || !srcBatch.getBatch().isPresent()) {
+ return srcBatch;
+ }
+ Dataset<Row> srcDs = srcBatch.getBatch().get();
+ Dataset<Row> targetDs = sanitizeColumnNamesForAvro(srcDs, invalidCharMask);
+ return new InputBatch<>(Option.ofNullable(targetDs), srcBatch.getCheckpointForNextBatch(), srcBatch.getSchemaProvider());
+ }
+
+ /*
+ * We first rely on Avro to parse and then try to rename only for those failed.
+ * This way we can improve our parsing capabilities without breaking existing functionality.
+ * For example, we don't yet support multiple named schemas defined in a file.
+ */
+ public static Schema parseAvroSchema(String schemaStr, boolean shouldSanitize, String invalidCharMask) {
+ try {
+ return new Schema.Parser().parse(schemaStr);
+ } catch (SchemaParseException spe) {
+ // if sanitizing is not enabled rethrow the exception.
+ if (!shouldSanitize) {
+ throw spe;
+ }
+ // Rename avro fields and try parsing once again.
+ Option<Schema> parseResult = parseSanitizedAvroSchemaNoThrow(schemaStr, invalidCharMask);
+ if (!parseResult.isPresent()) {
+ // throw original exception.
+ throw spe;
+ }
+ return parseResult.get();
+ }
+ }
+
+ /**
+ * Parse list for sanitizing
+ * @param src - deserialized schema
+ * @param invalidCharMask - mask to replace invalid characters with
+ */
+ private static List<Object> transformList(List<Object> src, String invalidCharMask) {
+ return src.stream().map(obj -> {
+ if (obj instanceof List) {
+ return transformList((List<Object>) obj, invalidCharMask);
+ } else if (obj instanceof Map) {
+ return transformMap((Map<String, Object>) obj, invalidCharMask);
+ } else {
+ return obj;
+ }
+ }).collect(Collectors.toList());
+ }
+
+ /**
+ * Parse map for sanitizing. If we have a string in the map, and it is an avro field name key, then we sanitize the name.
+ * Otherwise, we keep recursively going through the schema.
+ * @param src - deserialized schema
+ * @param invalidCharMask - mask to replace invalid characters with
+ */
+ private static Map<String, Object> transformMap(Map<String, Object> src, String invalidCharMask) {
+ return src.entrySet().stream()
+ .map(kv -> {
+ if (kv.getValue() instanceof List) {
+ return Pair.of(kv.getKey(), transformList((List<Object>) kv.getValue(), invalidCharMask));
+ } else if (kv.getValue() instanceof Map) {
+ return Pair.of(kv.getKey(), transformMap((Map<String, Object>) kv.getValue(), invalidCharMask));
+ } else if (kv.getValue() instanceof String) {
+ String currentStrValue = (String) kv.getValue();
+ if (kv.getKey().equals(AVRO_FIELD_NAME_KEY)) {
+ return Pair.of(kv.getKey(), HoodieAvroUtils.sanitizeName(currentStrValue, invalidCharMask));
+ }
+ return Pair.of(kv.getKey(), currentStrValue);
+ } else {
+ return Pair.of(kv.getKey(), kv.getValue());
+ }
+ }).collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
+ }
+
+ /**
+ * Sanitizes illegal field names in the schema using recursive calls to transformMap and transformList
+ */
+ private static Option<Schema> parseSanitizedAvroSchemaNoThrow(String schemaStr, String invalidCharMask) {
+ try {
+ ObjectMapper objectMapper = new ObjectMapper();
Review Comment:
ObjectMapper instances are thread safe and it's recommended to reuse the object since it's heavy to construct. Can we make this a static instance?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1448498460
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3019831aab40e92820737f308af2846835831b6a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446)
* be4b1268fd16f19375d5c249bf8dbd0f89cc4e79 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] jonvex commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "jonvex (via GitHub)" <gi...@apache.org>.
jonvex commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1118919827
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -97,6 +101,7 @@ public InputBatch<JavaRDD<GenericRecord>> fetchNewDataInAvroFormat(Option<String
case JSON: {
//sanitizing is done inside the convertor if enabled
InputBatch<JavaRDD<String>> r = ((Source<JavaRDD<String>>) source).fetchNext(lastCkptStr, sourceLimit);
+ MercifulJsonConverter.clearCache(r.getSchemaProvider().getSourceSchema().getFullName());
Review Comment:
In fecthNewDataInRowFormat, if sanitizing is enabled, it will call fetchNewDataInAvroFormat so that will hit this and clear the cache. Otherwise it isn't sanitizing so the map isn't used
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1448617511
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "CANCELED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* be4b1268fd16f19375d5c249bf8dbd0f89cc4e79 Azure: [CANCELED](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484)
* 5bdc2ce2de13e8358a2bf8844cbde9aad7801641 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1442495928
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 87cbf70ffa73ceab81349245097c830ae28ddeb5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1440441875
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 1cb788947969f4573d5a4b2171fbedee696b73d8 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327)
* 7dd3bae6a568456284d48df18c0ab558d675169b UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1438839117
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 803e8874071c540e672f93f5a481a05ae8ec6131 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8010:
URL: https://github.com/apache/hudi/pull/8010#discussion_r1116416387
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/SourceFormatAdapter.java:
##########
@@ -97,6 +101,7 @@ public InputBatch<JavaRDD<GenericRecord>> fetchNewDataInAvroFormat(Option<String
case JSON: {
//sanitizing is done inside the convertor if enabled
InputBatch<JavaRDD<String>> r = ((Source<JavaRDD<String>>) source).fetchNext(lastCkptStr, sourceLimit);
+ MercifulJsonConverter.clearCache(r.getSchemaProvider().getSourceSchema().getFullName());
Review Comment:
don't we need to clear cache for the other method? fetchNewDataInRowFormat
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1442316263
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7dd3bae6a568456284d48df18c0ab558d675169b Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340)
* 87cbf70ffa73ceab81349245097c830ae28ddeb5 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1451149603
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
}, {
"hash" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518",
"triggerID" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"triggerType" : "PUSH"
}, {
"hash" : "fa6b818a3213ad301f4d842207655576acd6f423",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15522",
"triggerID" : "fa6b818a3213ad301f4d842207655576acd6f423",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* fa6b818a3213ad301f4d842207655576acd6f423 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15522)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8010: [HUDI-4442] [HUDI-5001] Sanitize JsonConversion and RowSource
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8010:
URL: https://github.com/apache/hudi/pull/8010#issuecomment-1451029516
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15317",
"triggerID" : "803e8874071c540e672f93f5a481a05ae8ec6131",
"triggerType" : "PUSH"
}, {
"hash" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15327",
"triggerID" : "1cb788947969f4573d5a4b2171fbedee696b73d8",
"triggerType" : "PUSH"
}, {
"hash" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15340",
"triggerID" : "7dd3bae6a568456284d48df18c0ab558d675169b",
"triggerType" : "PUSH"
}, {
"hash" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15367",
"triggerID" : "87cbf70ffa73ceab81349245097c830ae28ddeb5",
"triggerType" : "PUSH"
}, {
"hash" : "3019831aab40e92820737f308af2846835831b6a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15446",
"triggerID" : "3019831aab40e92820737f308af2846835831b6a",
"triggerType" : "PUSH"
}, {
"hash" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15484",
"triggerID" : "be4b1268fd16f19375d5c249bf8dbd0f89cc4e79",
"triggerType" : "PUSH"
}, {
"hash" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15488",
"triggerID" : "5bdc2ce2de13e8358a2bf8844cbde9aad7801641",
"triggerType" : "PUSH"
}, {
"hash" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518",
"triggerID" : "8a87cc573722071e141e1bdfb791f3f2b5902a18",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 8a87cc573722071e141e1bdfb791f3f2b5902a18 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15518)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org