3636from apache_beam .testing .test_pipeline import TestPipeline
3737from apache_beam .testing .util import assert_that
3838from apache_beam .testing .util import equal_to
39+ from apache_beam .typehints .schemas import FixedString
3940from apache_beam .typehints .schemas import LogicalType
4041from apache_beam .typehints .schemas import MillisInstant
4142from apache_beam .utils .timestamp import Timestamp
@@ -258,7 +259,7 @@ def test_xlang_jdbc_read_with_explicit_schema(self, database):
258259 JdbcTestRow (
259260 i ,
260261 i + 0.1 ,
261- f'Test{ i } ' ,
262+ f'Test{ i } ' + ' ' * ( 10 - len ( f'Test { i } ' )) ,
262263 f'Test{ i } ' ,
263264 f'Test{ i } ' .encode (),
264265 f'Test{ i } ' .encode (),
@@ -289,7 +290,7 @@ def test_xlang_jdbc_read_with_explicit_schema(self, database):
289290 [
290291 ("renamed_id" , int ),
291292 ("renamed_float" , float ),
292- ("renamed_char" , str ),
293+ ("renamed_char" , FixedString ( 10 ) ),
293294 ("renamed_varchar" , str ),
294295 ("renamed_bytes" , bytes ),
295296 ("renamed_varbytes" , bytes ),
@@ -316,7 +317,7 @@ def test_xlang_jdbc_read_with_explicit_schema(self, database):
316317 CustomSchemaRow (
317318 row .f_id ,
318319 row .f_float ,
319- row .f_char + ' ' * ( 10 - len ( row . f_char )) ,
320+ row .f_char ,
320321 row .f_varchar ,
321322 f_bytes ,
322323 row .f_bytes ,
@@ -332,16 +333,9 @@ def custom_equals(expected, actual):
332333 return (
333334 expected .renamed_id == actual .renamed_id and
334335 expected .renamed_float == actual .renamed_float and
335- expected .renamed_char == actual .renamed_char and
336- expected .renamed_varchar == actual .renamed_varchar and (
337- expected .renamed_bytes == actual .renamed_bytes or
338- # Handle potential padding differences in binary fields
339- expected .renamed_bytes .rstrip (b'\0 ' ) ==
340- actual .renamed_bytes .rstrip (b'\0 ' )) and (
341- expected .renamed_varbytes == actual .renamed_varbytes or
342- # Handle potential padding differences in binary fields
343- expected .renamed_varbytes .rstrip (b'\0 ' ) ==
344- actual .renamed_varbytes .rstrip (b'\0 ' )) and
336+ expected .renamed_char .rstrip () == actual .renamed_char .rstrip () and
337+ expected .renamed_varchar == actual .renamed_varchar and
338+ expected .renamed_bytes == actual .renamed_bytes and
345339 expected .renamed_timestamp == actual .renamed_timestamp and
346340 expected .renamed_decimal == actual .renamed_decimal and
347341 expected .renamed_date == actual .renamed_date and
0 commit comments