Skip to content

[DISCUSSION] Reduce amount of ExprCoreTypes #1176

Closed

Description

@Yury-Fridlyand

Is your feature request related to a problem?

  1. Do we need so much numeric ExprCoreTypes?
  2. -//- datetime ExprCoreTypes?

What solution would you like?
Why not to leave only LONG and DOUBLE or LONG/INT and FLOAT/DOUBLE?
I propose to get rid of BYTE and SHORT types, map byte and short opensearch types to INT. Thus we can reduce amount of math/comparison functions registered and simplify widening rule processing. Further removing of INT and FLOAT and using only LONG and DOUBLE would increase memory usage (for storing those values only!), but increase performance.

BYTE of even BIT/BOOL uses same amount of memory in Java (SQL/JDBC) or even in C (ODBC)(unless you use pragma pack which reduces performance). Refs: one, two.

$ java -Djdk.module.illegalAccess=deny -jar jol-cli.jar internals java.lang.Byte | grep 'Instance size'
Instance size: 16 bytes
$ java -Djdk.module.illegalAccess=deny -jar jol-cli.jar internals java.lang.Integer | grep 'Instance size'
Instance size: 16 bytes
$ java -Djdk.module.illegalAccess=deny -jar jol-cli.jar internals java.lang.Long | grep 'Instance size'
Instance size: 24 byte

Also having both DATETIME and TIMESTAMP ExprCoreTypes is a bit confusing - they contain the same information. Both types don't store time zone information.

What alternatives have you considered?
N/A

Do you have any additional context?
N/A

Activity

  1. added
    maintenance
    and removed
    enhancement
    on Dec 15, 2022
  2. acarbonetto commented on Mar 6, 2023

    @acarbonetto
    Collaborator

    Also having both DATETIME and TIMESTAMP ExprCoreTypes is a bit confusing - they contain the same information. Both types don't store time zone information.

    If #126 is fixed and supports timezone, we could map to a timestamp type with timezone included. Which means we would have a reason to have both a timestamp and datatime type.

    Consider not removing datetime.

  3. Yury-Fridlyand commented on Mar 6, 2023

    @Yury-Fridlyand
    CollaboratorAuthor

    #126 is to support more date formats
    This ticket to remove duplicated types.
    DATETIME and TIMESTAMP contain completely the same info and adding extra complexity

  4. acarbonetto commented on Jun 13, 2023

    @acarbonetto
    Collaborator

    We can remove DATETIME, but there's no real benefit to removing BYTE/SHORT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions