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

Class type for Boolean #218

Open
rcronin opened this issue Oct 25, 2024 · 5 comments
Open

Class type for Boolean #218

rcronin opened this issue Oct 25, 2024 · 5 comments

Comments

@rcronin
Copy link

rcronin commented Oct 25, 2024

Hello,

I'm working with a vendor who is trying to get the debezium for as400 connector working for booleans. They have cited that it is not working properly because there is a class object for Boolean. Most data types in the connector are using a class object for the data type. For example, a char data type is using AS400Text. We've tried to utilize that for booleans but runs into issues parsing the value from the journal correctly.

Any advice here on either a direct to get a named AS400Boolean or how to proceed with the boolean type parsing from the journal in debezium?

Thanks,

Ryan

@rcronin
Copy link
Author

rcronin commented Nov 15, 2024

@ThePrez - any insights here?

@ThePrez
Copy link
Member

ThePrez commented Nov 15, 2024

@davecharron might have the best insights so deferring to him

@davecharron
Copy link

davecharron commented Nov 15, 2024

I did a quick test of a journal entry for a table with a boolean column.
Looks to me like the value is in the entry as simply a 1 or 0. So, should just be a case of casting the single character to boolean.

CAST(cast(substring(JOESD, nnn, 1) as char(1) for bit data) as BOOLEAN) as bool_val

More info:
https://www.ibm.com/support/pages/node/958529
https://www.ibm.com/support/pages/example-how-extract-and-read-entrydata-joesd-journal-receiver-field-using-displayjournal-table-function

@rcronin
Copy link
Author

rcronin commented Nov 16, 2024

@davecharron - I confirmed this as well.

I'm working with a data integration vendor to add Boolean support in debezium, specially this file: https://github.com/debezium/debezium-connector-ibmi/blob/v3.0.2.Final/journal-parsing/src/main/java/io/debezium/ibmi/db2/journal/retrieve/JdbcFileDecoder.java

The vendor cited trying the following:

It even works when generating a snapshot. And the length parameter is correctly set to 1.

It throws an ArrayOutOfBoudsException down in the pipeline when it's parsing the jornal and trying to reconstruct the before and after objects (required for cdc) in this code:

public Object[] decodeEntry(AS400Structure entryDetailStructure, byte[] data, int offset) { final Object[] result = (Object[]) entryDetailStructure.toObject(data, offset); return result; }

This is a low-level code I was talking about.

The offset parameter is typically off by tens of bytes when there is a boolean column.

We spent enough time on this trying to figure out. We did try to adjust the offset based on the actual size of the byte array: it is causing an exception in a different place.

We also tried to cast boolean to other supported types:
case "BOOLEAN": return new AS400ByteArray(1); case "BOOLEAN": return new AS400VarBin(1) case "BOOLEAN": return getVarText(1, getCcsid(schema, table, columnName));

All causing exception in various places.

@rcronin
Copy link
Author

rcronin commented Nov 28, 2024

@davecharron - was wondering if you were able to look into this anymore. Thanks!

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

No branches or pull requests

3 participants