You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "JeffBolle (via GitHub)" <gi...@apache.org> on 2023/06/20 17:52:51 UTC
[GitHub] [pulsar] JeffBolle opened a new pull request, #20623: [improve][connector] Elastic Search Sink can now handle raw Record ty…
JeffBolle opened a new pull request, #20623:
URL: https://github.com/apache/pulsar/pull/20623
<!--
### Contribution Checklist
- PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://pulsar.apache.org/contribute/develop-semantic-title/)*.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Each pull request should address only one issue, not mix up code from multiple issues.
- Each commit in the pull request has a meaningful commit message
- Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
-->
<!-- Either this PR fixes an issue, -->
Fixes #20619
### Motivation
Sink pre-processing functions introduced in PIP 193 (#16739) can allow for producing a Record from the function that does not have a `GenericObject`, and instead is a `String` or `byte[]`. The current implementation of the ElasticSearch sink doesn't handle this situation cleanly. Additionally, the setting of the id of the ElasticSearch document from the Record key is incomplete in some cases.
### Modifications
Modified the `extractIdAndDocument` method to create a `GenericObject` from the `Record` value if it isn't already.
### Verifying this change
- [x] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- *Added unit tests in ElasticSearchRawRecordTests*
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: [https://github.com/Q6Cyber/pulsar/pull/1]
<!--
After opening this PR, the build in apache/pulsar will fail and instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed in
a forked repository.
The tests will be run in the forked repository until all PR review comments have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] JeffBolle commented on pull request #20623: [improve][connector] Elastic Search Sink can now handle raw Record
Posted by "JeffBolle (via GitHub)" <gi...@apache.org>.
JeffBolle commented on PR #20623:
URL: https://github.com/apache/pulsar/pull/20623#issuecomment-1624301826
@michaeljmarshall @nicoloboschi @eolivelli @cbornet
Have I missed a step in the process? Please let me know what I need to do to get the changes reviewed. Thank you.
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codecov-commenter commented on pull request #20623: [improve][io] Elastic Search Sink can now handle raw Record
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #20623:
URL: https://github.com/apache/pulsar/pull/20623#issuecomment-1634147460
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/20623?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#20623](https://app.codecov.io/gh/apache/pulsar/pull/20623?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (3556617) into [master](https://app.codecov.io/gh/apache/pulsar/commit/677d160148afc935c34a072fb62b765a8a65045c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (677d160) will **increase** coverage by `41.18%`.
> The diff coverage is `74.07%`.
[](https://app.codecov.io/gh/apache/pulsar/pull/20623?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #20623 +/- ##
=============================================
+ Coverage 31.93% 73.11% +41.18%
- Complexity 11779 32039 +20260
=============================================
Files 1498 1866 +368
Lines 114595 139072 +24477
Branches 12428 15302 +2874
=============================================
+ Hits 36591 101689 +65098
+ Misses 73158 29323 -43835
- Partials 4846 8060 +3214
```
| Flag | Coverage Δ | |
|---|---|---|
| inttests | `24.16% <ø> (?)` | |
| systests | `24.92% <0.00%> (?)` | |
| unittests | `72.41% <74.07%> (+40.47%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://app.codecov.io/gh/apache/pulsar/pull/20623?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...che/pulsar/io/elasticsearch/ElasticSearchSink.java](https://app.codecov.io/gh/apache/pulsar/pull/20623?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWlvL2VsYXN0aWMtc2VhcmNoL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9wdWxzYXIvaW8vZWxhc3RpY3NlYXJjaC9FbGFzdGljU2VhcmNoU2luay5qYXZh) | `74.61% <74.07%> (ø)` | |
... and [1566 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/20623/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] lhotari merged pull request #20623: [improve][io] Elastic Search Sink can now handle raw Record
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #20623:
URL: https://github.com/apache/pulsar/pull/20623
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] lhotari closed pull request #20623: [improve][connector] Elastic Search Sink can now handle raw Record
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari closed pull request #20623: [improve][connector] Elastic Search Sink can now handle raw Record
URL: https://github.com/apache/pulsar/pull/20623
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] JeffBolle commented on pull request #20623: [improve][io] Elastic Search Sink can now handle raw Record
Posted by "JeffBolle (via GitHub)" <gi...@apache.org>.
JeffBolle commented on PR #20623:
URL: https://github.com/apache/pulsar/pull/20623#issuecomment-1682317556
@Technoboy- What additional steps do I need to take to have this PR make it into a release? My organization was expecting that after it was merged to master it would be in the 3.1 release. However it does not appear to be, though a similar PR #20741 was included. This issue impacts both 3.1.X and 3.0.X. Thank you.
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] JeffBolle commented on a diff in pull request #20623: [improve][io] Elastic Search Sink can now handle raw Record
Posted by "JeffBolle (via GitHub)" <gi...@apache.org>.
JeffBolle commented on code in PR #20623:
URL: https://github.com/apache/pulsar/pull/20623#discussion_r1261742776
##########
pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchRawRecordTests.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.pulsar.io.elasticsearch;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.pulsar.client.api.Schema;
+import org.apache.pulsar.functions.api.Record;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Optional;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
+public class ElasticSearchRawRecordTests {
+ String json = "{\"c\":\"1\",\"d\":1,\"e\":{\"a\":\"a\",\"b\":true,\"d\":1.0,\"f\":1.0,\"i\":1,\"l\":10}}";
+
+ @DataProvider(name = "rawRecordSchema")
+ public Object[] stripNonPrintableCharacters() {
Review Comment:
Got it. Sorry. Copied the test without looking too closely at that part of it. Thank you for catching this.
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] JeffBolle commented on pull request #20623: [improve][io] Elastic Search Sink can now handle raw Record
Posted by "JeffBolle (via GitHub)" <gi...@apache.org>.
JeffBolle commented on PR #20623:
URL: https://github.com/apache/pulsar/pull/20623#issuecomment-1634484762
> @JeffBolle Please rebase (or merge origin/master) to your PR branch and resolve the conflict.
Roger, taking care of it now.
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] eolivelli commented on a diff in pull request #20623: [improve][connector] Elastic Search Sink can now handle raw Record
Posted by "eolivelli (via GitHub)" <gi...@apache.org>.
eolivelli commented on code in PR #20623:
URL: https://github.com/apache/pulsar/pull/20623#discussion_r1261255244
##########
pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchRawRecordTests.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.pulsar.io.elasticsearch;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.pulsar.client.api.Schema;
+import org.apache.pulsar.functions.api.Record;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Optional;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
+public class ElasticSearchRawRecordTests {
+ String json = "{\"c\":\"1\",\"d\":1,\"e\":{\"a\":\"a\",\"b\":true,\"d\":1.0,\"f\":1.0,\"i\":1,\"l\":10}}";
+
+ @DataProvider(name = "rawRecordSchema")
+ public Object[] stripNonPrintableCharacters() {
Review Comment:
nit: rename to "rawRecordSchema"
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] lhotari commented on pull request #20623: [improve][connector] Elastic Search Sink can now handle raw Record
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #20623:
URL: https://github.com/apache/pulsar/pull/20623#issuecomment-1632620836
closing and reopening to trigger a fresh test run
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] lhotari commented on pull request #20623: [improve][io] Elastic Search Sink can now handle raw Record
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #20623:
URL: https://github.com/apache/pulsar/pull/20623#issuecomment-1634397306
@JeffBolle Please rebase (or merge origin/master) to your PR branch and resolve the conflict.
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org