Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flink-connector-jdbc-spnner #1

Closed
wants to merge 1 commit into from

Conversation

laughingman7743
Copy link
Owner

No description provided.

@laughingman7743 laughingman7743 force-pushed the jdbc_spanner_connector branch 3 times, most recently from b4eefd9 to bbaa0ea Compare January 14, 2025 05:57
@@ -91,6 +91,8 @@ protected JdbcResultSetBuilder<Row> getResultSetBuilder() {
} else if (type.getConversionClass().equals(LocalDateTime.class)) {
ps.setTimestamp(
i + 1, Timestamp.valueOf(row.<LocalDateTime>getFieldAs(i)));
} else if (type.getConversionClass().equals(Float.class)) {
Copy link
Owner Author

@laughingman7743 laughingman7743 Jan 14, 2025

Choose a reason for hiding this comment

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

I added handling for the Float type because an error occurred.

com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory$JdbcSqlBatchUpdateException:
  Value has type FLOAT64 which cannot be inserted into column float_col, which has type FLOAT [at 1:131]
  ...double_col, timestamp9_col) VALUES (@p1, @p2, @p3, @p4, @p5, @p6)

@laughingman7743 laughingman7743 force-pushed the jdbc_spanner_connector branch 2 times, most recently from 2974caf to c6a2441 Compare January 14, 2025 16:23
@@ -120,7 +122,7 @@ public int[] getTableTypes() {
.toArray();
}

public Schema getTableSchema() {
public Schema getTableSchema(String pkConstraintName) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

In the case of Spanner, the contract name of the primary key is different, so it is possible to specify the contract name of the primary key.

Comment on lines -579 to -587
/**
* URL has to be without database, like "jdbc:dialect://localhost:1234/" or
* "jdbc:dialect://localhost:1234" rather than "jdbc:dialect://localhost:1234/db".
*/
protected static void validateJdbcUrl(String url) {
String[] parts = url.trim().split("\\/+");

checkArgument(parts.length == 2);
}
Copy link
Owner Author

Choose a reason for hiding this comment

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

In the case of Spanner, the URL is as follows, so I have deleted this validation.

jdbc:cloudspanner://hostname/projects/gcp_project_id/instances/instance_id/databases/database_id

Comment on lines -133 to -138
this.connectionProperties = Preconditions.checkNotNull(connectionProperties);
checkArgument(
!StringUtils.isNullOrWhitespaceOnly(connectionProperties.getProperty(USER_KEY)));
checkArgument(
!StringUtils.isNullOrWhitespaceOnly(
connectionProperties.getProperty(PASSWORD_KEY)));
Copy link
Owner Author

Choose a reason for hiding this comment

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

Spanner does not use password authentication.


/** Test for {@link AbstractJdbcCatalog}. */
class AbstractJdbcCatalogTest {
Copy link
Owner Author

Choose a reason for hiding this comment

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

This class is no longer needed because URL validation has been removed.

@laughingman7743
Copy link
Owner Author

apache#156

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.

None yet

1 participant