Hello Team, Has anyone aware of this problem? Thanks, Ravi
On Sun, Jun 19, 2022 at 10:59 PM Ravi Kapoor <[email protected]> wrote: > Hi Team > > I am trying writing a PCollection<TableRow> from BQ with Schema as > > > *final Schema schema = > Schema.builder().addInt64Field("user_id").addStringField("user_name").build();* > to a JDBC datasource (oracle) > having table schema as below on Oracle : > > Table_A ( user_id NUMBER(3), user_name varchar(10)) > The code flow is such that this will invoke > > > *PCollection<Void> expand(PCollection<T> input)*and internally this will > call > > > *List<SchemaUtil.FieldWithIndex> fields = > spec.getFilteredFields(input.getSchema());*which converts the > resultsetmetadata to BeamSchema and for the numeric type this is what is set > *LogicalTypes.FixedPrecisionNumeric.of* as FieldType in > jdbcTypeToBeamFieldConverter method which has baseType as Decimal > > > *SchemaUtil.compareSchemaField(tableField, f)*which subsequently compare > schemaFieldType with below method: > > > *static boolean compareSchemaFieldType(Schema.FieldType a, > Schema.FieldType b) {*The below code returns false: > > *return > a.getLogicalType().getBaseType().getTypeName().equals(b.getTypeName());* > as the base type is set as DECIMAL for the user_id field in oracle > datasource. > > And it eventually fails with > > *"Provided schema doesn't match with database schema. " + " Table has > fields: ",* > Can you please check whether it's a bug in matching BQ data type to Oracle? > Or do I require different handling in writing to Jdbc source? > > -- > Thanks, > Ravi Kapoor > +91-9818764564 > [email protected] > -- Thanks, Ravi Kapoor +91-9818764564 [email protected]
