SnowflakeIO yaml - #39742
Conversation
| import org.apache.beam.sdk.values.Row; | ||
|
|
||
| /** A {@link SchemaTransformProvider} for reading rows from Snowflake. */ | ||
| @SuppressWarnings({ |
There was a problem hiding this comment.
Prefer not introducing SuppressWarnings for new code
| }) | ||
| public class SnowflakeSchemaTransformUtils { | ||
|
|
||
| public static SnowflakeIO.DataSourceConfiguration createDataSourceConfiguration( |
There was a problem hiding this comment.
Why not just make SnowflakeReadSchemaTransformProvider.Configuration as createDataSourceConfiguration's parameter?
There was a problem hiding this comment.
It is shared by both the read and write providers, which have different configuration classes. Passing the individual fields keeps this utility independent of either provider-specific configuration.
|
|
||
| String debugMode = getDebugMode(); | ||
| if (debugMode != null) { | ||
| parseStreamingLogLevel(debugMode); |
There was a problem hiding this comment.
return value is unused. I understand it's for validation. Consider add a comment noting it.
There was a problem hiding this comment.
Please check, I don't see a code change?
There was a problem hiding this comment.
Added one comment above (line 142) for the whole part:
Parse configured enum values to validate that they are supported.
|
Assigning reviewers: R: @claudevdm for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
|
Hi @Amar3tto, can you add a yaml pipeline test under yaml/tests or yaml/extended_tests with any improvements necessary in integration_tests.py? Thanks. |
Added a Snowflake YAML pipeline test under |
| dependsOn ":sdks:java:io:expansion-service:build" | ||
| dependsOn ":sdks:java:io:google-cloud-platform:expansion-service:build" | ||
| dependsOn ":sdks:java:io:debezium:expansion-service:shadowJar" | ||
| dependsOn ":sdks:java:io:snowflake:expansion-service:shadowJar" |
There was a problem hiding this comment.
Consider move this to postCommitYamlIntegrationTests. The test only need to be exercised on postsubmit time. The PreCommit becomes heavier as we are adding more expansion services (and test container). Same apply to kenesis / JmsIO / debezium
25a4801 to
27c4e63
Compare
| */ | ||
| @FunctionalInterface | ||
| public interface UserDataMapper<T> extends Serializable { | ||
| @org.checkerframework.checker.nullness.qual.Nullable |
There was a problem hiding this comment.
I kept javax.annotation.Nullable as the existing import to avoid conflicting Nullable imports. The Checker Framework annotation is only needed for this specific type-use case, so I used its fully qualified name there
There was a problem hiding this comment.
We should replace all with org.checkerframework.checker.nullness.qual.Nullable, which is Beam repo's convention. But code completion tool keeps adding javax and sometimes slipped from review
|
|
||
| String debugMode = getDebugMode(); | ||
| if (debugMode != null) { | ||
| parseStreamingLogLevel(debugMode); |
There was a problem hiding this comment.
Please check, I don't see a code change?
| implementation project(path: ":sdks:java:extensions:google-cloud-platform-core") | ||
| permitUnusedDeclared project(path: ":sdks:java:extensions:google-cloud-platform-core") | ||
| implementation library.java.slf4j_api | ||
| implementation library.java.everit_json_schema |
There was a problem hiding this comment.
Why do we need it now? Is it now a runtime dependency, or needed by the expansion service now?
There was a problem hiding this comment.
It is a runtime dependency of the new read SchemaTransform. JsonUtils.beamSchemaFromJsonSchema(...) uses Everit JSON Schema to parse the configured output schema, and the expansion service picks it up transitively from the Snowflake IO module.
There was a problem hiding this comment.
It's transient dependency shouldn't need to be added here. In fact it's a dependency of Java core:
beam/sdks/java/core/build.gradle
Line 115 in 13875fc
In general new codes should not need permitUnusedDeclared ...
There was a problem hiding this comment.
I tried removing the dependency, but :sdks:java:io:snowflake:compileJava then fails with:
class file for org.everit.json.schema.ObjectSchema not found
There was a problem hiding this comment.
I see, thanks, then consider declare it as "provided", in align with
beam/sdks/java/io/kafka/build.gradle
Line 95 in 13875fc
beam/sdks/java/io/mongodb/build.gradle
Line 35 in 13875fc
There was a problem hiding this comment.
Changed to provided, thanks
Fixes #28691
Adds Beam YAML support for Snowflake IO.
ReadFromSnowflakefor batch reads from a table or query.WriteToSnowflakefor batch writes and streaming writes via Snowpipe.Row/ Snowflake schema conversion.standard_io.yaml.https://github.com/apache/beam/actions/runs/31692701363
https://github.com/apache/beam/actions/runs/31691059139
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.