Skip to content

Commit

Permalink
Changes after rebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan Altynnikov committed Mar 12, 2022
1 parent 3c87caa commit 12989f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ private static SchemaBuilder.FieldAssembler<Schema> createAvroFields(
.name(normalizeForAvro(columnName))
.doc(
provider.getFieldDoc(
columnName, String.format("From sqlType %d %s (%s)", columnType, typeName, columnClassName)))
columnName,
String.format(
"From sqlType %d %s (%s)", columnType, typeName, columnClassName)))
.prop("columnName", columnName)
.prop("sqlCode", String.valueOf(columnType))
.prop("typeName", typeName)
Expand Down Expand Up @@ -172,7 +174,6 @@ private static SchemaBuilder.FieldAssembler<Schema> createAvroFields(
* <li>{@link com.mysql.cj.MysqlType }
* <li>{@link org.h2.value.TypeInfo }
* </ul>
*
*/
private static SchemaBuilder.UnionAccumulator<SchemaBuilder.NullDefault<Schema>>
setAvroColumnType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static ResultSetMetaData create(
when(rsMetaData.getTableName(i + 1)).thenReturn(tableNames[i]);
when(rsMetaData.getColumnName(i + 1)).thenReturn(columnNames[i]);
when(rsMetaData.getColumnType(i + 1)).thenReturn(columnTypes[i]);
when(rsMetaData.getColumnClassName(i + 1)).thenReturn("dummy");
}
return rsMetaData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Optional;
import org.apache.avro.Schema;
import org.junit.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -151,9 +150,15 @@ public void shouldDefaultConversionToStringType() throws SQLException {

private Schema createAvroSchemaForSingleField(
final ResultSet resultSet, final boolean useLogicalTypes) throws SQLException {
final String avroSchemaNamespace = "namespace1";
final String connectionUrl = "url1";
final String schemaName = null;
final String avroDoc = "doc1";
AvroSchemaMetadataProvider provider =
new AvroSchemaMetadataProvider(avroSchemaNamespace, schemaName, avroDoc);
Schema avroSchema =
JdbcAvroSchema.createAvroSchema(
resultSet, "namespace1", "url1", Optional.empty(), "doc1", useLogicalTypes);
resultSet, connectionUrl, useLogicalTypes, provider);

return avroSchema.getField("column1").schema().getTypes().get(COLUMN_NUM);
}
Expand Down

0 comments on commit 12989f1

Please sign in to comment.