You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "gabrywu (via GitHub)" <gi...@apache.org> on 2023/08/15 06:50:29 UTC
[GitHub] [beam] gabrywu opened a new pull request, #28007: remove fastjson library
gabrywu opened a new pull request, #28007:
URL: https://github.com/apache/beam/pull/28007
fix https://github.com/apache/beam/issues/24154,
hi @apilloud can you help to review this PR?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on pull request #28007: remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1681002476
There are test failures:
```
org.apache.beam.sdk.extensions.sql.meta.provider.kafka.KafkaTableProviderIT.testFake2[0]
Error Message
java.lang.RuntimeException: illegal table properties: { "format" : "json",}
at org.apache.beam.sdk.extensions.sql.TableUtils.parseProperties(TableUtils.java:50)
at org.apache.beam.sdk.extensions.sql.meta.provider.kafka.KafkaTableProviderIT.testFake2(KafkaTableProviderIT.java:156)
...
```
Previously a ill-formed json `{ "format" : "json",}` works, now it does not.
Similarly, it is nice to tolerant trailing comma
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on a diff in pull request #28007: remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #28007:
URL: https://github.com/apache/beam/pull/28007#discussion_r1295294400
##########
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryTableProviderTest.java:
##########
@@ -67,7 +67,7 @@ public void testDefaultMethod_whenPropertiesAreNotSet() {
public void testSelectDefaultMethodExplicitly() {
Table table =
fakeTableWithProperties(
- "hello", "{ " + METHOD_PROPERTY + ": " + "\"" + Method.DEFAULT.toString() + "\" }");
+ "hello", "{\"" + METHOD_PROPERTY + "\": " + "\"" + Method.DEFAULT.toString() + "\" }");
Review Comment:
there are multiple changes of adding quotes here. Do they mean a breaking change (SQL statements worked before now need to add quotes) / is there any chance keep the original semantics?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on a diff in pull request #28007: Remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #28007:
URL: https://github.com/apache/beam/pull/28007#discussion_r1297540194
##########
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/TableUtils.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.beam.sdk.extensions.sql;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.util.Map;
+import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.annotations.VisibleForTesting;
+
+public class TableUtils {
+ private static ObjectMapper objectMapper =
+ new ObjectMapper()
+ .configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
+ .configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true);
Review Comment:
```suggestion
private static ObjectMapper objectMapper =
sonMapper.builder().enable(
JsonReadFeature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER,
JsonReadFeature.ALLOW_JAVA_COMMENTS,
JsonReadFeature.ALLOW_MISSING_VALUES,
JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS,
JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS,
JsonReadFeature.ALLOW_SINGLE_QUOTES,
JsonReadFeature.ALLOW_TRAILING_COMMA,
JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS,
JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES)
.build();
```
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] github-actions[bot] commented on pull request #28007: remove fastjson library
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1678533936
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] github-actions[bot] commented on pull request #28007: remove fastjson library
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1678662104
Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
R: @bvolpato for label java.
R: @damccorm for label build.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on a diff in pull request #28007: remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #28007:
URL: https://github.com/apache/beam/pull/28007#discussion_r1296014562
##########
CHANGES.md:
##########
@@ -89,6 +89,7 @@
* Python SDK: Legacy runner support removed from Dataflow, all pipelines must use runner v2.
* [Python] Dataflow Runner will no longer stage Beam SDK from PyPI in the `--staging_location` at pipeline submission. Custom container images that are not based on Beam's default image must include Apache Beam installation.([#26996](https://github.com/apache/beam/issues/26996))
+* SDK Java Extensions SQL: remove fastjson library, table property is changed to ObjectNode which belongs to jackson library. ([#24154](https://github.com/apache/beam/issues/24154))
Review Comment:
This will actually go to 2.51.0, fine for now, could fix later as part of adding 2.51.0 section
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] gabrywu commented on pull request #28007: remove fastjson library
Posted by "gabrywu (via GitHub)" <gi...@apache.org>.
gabrywu commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1681546196
>
I will add `ALLOW_TRAILING_COMMA` flag
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on pull request #28007: Remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1682584077
Thanks again for the fix. It appears fastjson parser in general is more relax than the default jackson mapper. Let me do some small experiments regarding the default behavior of two parsers, specifically, the list in https://fasterxml.github.io/jackson-core/javadoc/2.9/com/fasterxml/jackson/core/JsonParser.Feature.html
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on pull request #28007: remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1680738902
Run SQL PostCommit
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] gabrywu commented on pull request #28007: remove fastjson library
Posted by "gabrywu (via GitHub)" <gi...@apache.org>.
gabrywu commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1680011445
> Thanks for working on this! There are merge conflicts - could you please rebase onto the current master? Also, consider add this change to CHANGES.md.
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on pull request #28007: remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1679837988
Thanks for working on this! There are merge conflicts - could you please rebase onto the current master? Also, consider add this change to CHANGES.md.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on pull request #28007: Remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1682682663
Experiment result shows fastjson in general is much more relax in non-standard syntax. We may need to add other configs, see below.
| config | fastjson default | jackson default | jackson relaxed |
|---|---|---|---|
| normal | o | o | o |
| ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER | o | x | o |
| ALLOW_COMMENTS | o | x | o |
| ALLOW_MISSING_VALUES | o | x | o |
| ALLOW_NON_NUMERIC_NUMBERS | o | x | o |
| ALLOW_NUMERIC_LEADING_ZEROS | o | x | o |
| ALLOW_SINGLE_QUOTES | o | x | o |
| ALLOW_TRAILING_COMMA | o | x | o |
| ALLOW_UNQUOTED_CONTROL_CHARS | o | x | o |
| ALLOW_UNQUOTED_FIELD_NAMES | o | x | o |
| ALLOW_YAML_COMMENTS | x | x | o |
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn merged pull request #28007: Remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn merged PR #28007:
URL: https://github.com/apache/beam/pull/28007
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] gabrywu commented on a diff in pull request #28007: remove fastjson library
Posted by "gabrywu (via GitHub)" <gi...@apache.org>.
gabrywu commented on code in PR #28007:
URL: https://github.com/apache/beam/pull/28007#discussion_r1296629045
##########
CHANGES.md:
##########
@@ -89,6 +89,7 @@
* Python SDK: Legacy runner support removed from Dataflow, all pipelines must use runner v2.
* [Python] Dataflow Runner will no longer stage Beam SDK from PyPI in the `--staging_location` at pipeline submission. Custom container images that are not based on Beam's default image must include Apache Beam installation.([#26996](https://github.com/apache/beam/issues/26996))
+* SDK Java Extensions SQL: remove fastjson library, table property is changed to ObjectNode which belongs to jackson library. ([#24154](https://github.com/apache/beam/issues/24154))
Review Comment:
OK
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] Abacn commented on pull request #28007: Remove fastjson library
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #28007:
URL: https://github.com/apache/beam/pull/28007#issuecomment-1683981738
Run SQL PostCommit
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] gabrywu commented on a diff in pull request #28007: remove fastjson library
Posted by "gabrywu (via GitHub)" <gi...@apache.org>.
gabrywu commented on code in PR #28007:
URL: https://github.com/apache/beam/pull/28007#discussion_r1295371517
##########
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryTableProviderTest.java:
##########
@@ -67,7 +67,7 @@ public void testDefaultMethod_whenPropertiesAreNotSet() {
public void testSelectDefaultMethodExplicitly() {
Table table =
fakeTableWithProperties(
- "hello", "{ " + METHOD_PROPERTY + ": " + "\"" + Method.DEFAULT.toString() + "\" }");
+ "hello", "{\"" + METHOD_PROPERTY + "\": " + "\"" + Method.DEFAULT.toString() + "\" }");
Review Comment:
I will fix it, with JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES true
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org