Skip to content

Conversation

@liuxiaocs7
Copy link
Contributor

Signed-off-by:

Pre-Checklist

Note: Please complete ALL items in the following checklist.

  • I have read through the CONTRIBUTING.md documentation.
  • My code has the necessary comments and documentation (if needed).
  • I have added relevant tests.

Purpose

Some description about what this PR wants to do.

Approaches

Some description about how this PR achives the purpose.

Related Issues

Close #146

New Behavior (screenshots if needed)

N/A

@liuxiaocs7
Copy link
Contributor Author

@BlockLiu PTAL, thx.

@liuxiaocs7
Copy link
Contributor Author

07:40:59.746 [main] ERROR o.t.d.DockerClientProviderStrategy - As no valid configuration was found, execution cannot continue
07:40:59.746 [main] ERROR c.b.b.t.c.t.t.e.ElasticsearchCluster - failed to initialize Elasticsearch container.
org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=docker.elastic.co/elasticsearch/elasticsearch:7.10.2, imagePullPolicy=DefaultPullPolicy(), imageNameSubstitutor=org.testcontainers.utility.ImageNameSubstitutor$LogWrappedImageNameSubstitutor@768f9097)
	at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1371)
	at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:651)
	at org.testcontainers.elasticsearch.ElasticsearchContainer.<init>(ElasticsearchContainer.java:98)
	at com.bytedance.bitsail.test.connector.test.testcontainers.elasticsearch.ElasticsearchCluster.startService(ElasticsearchCluster.java:52)
	at com.bytedance.bitsail.connector.elasticsearch.rest.source.EsSourceRequestTest.setup(EsSourceRequestTest.java:54)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)

it works fine locally, i'll re-trigger to try.

row.setField(i, convert(typeInfo, value.toString()));
} catch (ParseException e) {
LOG.error("Parse value {} with type {} failed.", value, typeInfo);
throw new RuntimeException(e);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be replace to bitsail exception, so bitsail will make this row as dirty record.

try {
row.setField(i, convert(typeInfo, value.toString()));
} catch (ParseException e) {
LOG.error("Parse value {} with type {} failed.", value, typeInfo);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log should be sample in sometimes, it will caused many exception log when the type not correct.

return false;
}

private Object convert(TypeInfo<?> typeInfo, String value) throws ParseException {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i proposal to have a new class to store the common logic like convert, maybe we can process this proposal in next issue.


private final RestClientBuilder builder;

public EsRestClientBuilder(BitSailConfiguration jobConf) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make a new interface for the class EsRestClientBuilder. i just want to make it more flexible between the difference elasticsearch version.

@liuxiaocs7 liuxiaocs7 changed the title [BitSail][Connector] Support ElasticSearch Source connector WIP: [BitSail][Connector] Support ElasticSearch Source connector Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BitSail][Connector] Support ElasticSearch Source connector.

3 participants