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

[Bug]: database field definitions for integer with length = 0 are not created as integer #4268

Closed
rramthun opened this issue Sep 2, 2024 · 3 comments
Assignees
Labels
bug Database P2 Default Priority
Milestone

Comments

@rramthun
Copy link

rramthun commented Sep 2, 2024

Apache Hop version?

2.9

Java version?

17

Operating system

Linux

What happened?

There is a logical mistake in the conditions of several implementations of getFieldDefinition() from Interface org.apache.hop.core.database.IDatabase. This leads to Integer fields being generated as a different data type, usually double precision float, when no length is set. Looks like the code section containing this bug has been copy&pasted to many different database implementations inside Hop.

This bug affects components "down the line", compare e.g. #4174

Issue Priority

Priority: 2

Issue Component

Component: Database

@github-actions github-actions bot added P2 Default Priority Database labels Sep 2, 2024
@rramthun rramthun changed the title [Bug]: database field definitions for integer with length <= 0 are created as double precision [Bug]: database field definitions for integer with length = 0 are not created as integer Sep 2, 2024
@rramthun
Copy link
Author

rramthun commented Sep 2, 2024

.take-issue

@github-actions github-actions bot added this to the 2.10 milestone Sep 2, 2024
@rramthun
Copy link
Author

rramthun commented Sep 2, 2024

@hansva The code handling the creation of integer and floating point fields seems inconsistent between different database systems in Hop.

If I am going to touch these code paths, I would try to make this more consistent.

My suggestion is:
everything with a length > 18 -> Decimal type or, if not available, largest of the Floating types
Integer type, precision = 0 -> one of the Integer types
Integer type, precision > 0 -> one of the Integer types (effectively ignore the precision...)
Floating point type, precision = 0 -> Decimal type or, if not available, one of the Integer types
Floating point type, precision > 0 -> Decimal type or, if not available, one of the Floating types

What do you think?

@hansva
Copy link
Contributor

hansva commented Sep 2, 2024

that sounds right.
I have looked at PostgreSqlDatabaseMeta and length 0 is indeed a case that is not handled correctly.

rramthun pushed a commit to rramthun/hop that referenced this issue Sep 5, 2024
rramthun pushed a commit to rramthun/hop that referenced this issue Sep 5, 2024
rramthun pushed a commit to rramthun/hop that referenced this issue Sep 5, 2024
rramthun pushed a commit to rramthun/hop that referenced this issue Sep 6, 2024
rramthun pushed a commit to rramthun/hop that referenced this issue Sep 6, 2024
hansva added a commit that referenced this issue Sep 25, 2024
updated database schema generations für AS400, Cache, Clickhouse, CrateDB and DB2 from #4268
@hansva hansva closed this as completed Sep 25, 2024
Adalennis pushed a commit to Adalennis/hop that referenced this issue Oct 1, 2024
Adalennis pushed a commit to Adalennis/hop that referenced this issue Oct 1, 2024
Adalennis pushed a commit to Adalennis/hop that referenced this issue Oct 1, 2024
Adalennis pushed a commit to Adalennis/hop that referenced this issue Oct 1, 2024
Adalennis pushed a commit to Adalennis/hop that referenced this issue Oct 1, 2024
rramthun pushed a commit to rramthun/hop that referenced this issue Oct 8, 2024
rramthun pushed a commit to rramthun/hop that referenced this issue Oct 10, 2024
hansva added a commit that referenced this issue Oct 14, 2024
fix database schema generation w.r.t. #4268 for additional databases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Database P2 Default Priority
Projects
None yet
Development

No branches or pull requests

2 participants