Skip to content

fix: only return usable column metadata types - #1031

Closed
IanChokS wants to merge 22 commits into
tediousjs:masterfrom
IanChokS:886-metadata-deprecated-types
Closed

IanChokS wants to merge 22 commits into
tediousjs:masterfrom
IanChokS:886-metadata-deprecated-types

Conversation

@IanChokS

@IanChokS IanChokS commented Jan 6, 2020 •

Copy link
Copy Markdown
Member

A fix for #886, #1050

chore: recover package-lock.json

chore: removed diff file
@IanChokS
IanChokS force-pushed the 886-metadata-deprecated-types branch from 79886c1 to 96881d9 Compare January 6, 2020 22:41
@IanChokS IanChokS changed the title refactor: return specific data type to users A fix for #886 Jan 6, 2020
@IanChokS IanChokS changed the title A fix for #886 Fix for #886 Jan 6, 2020
@codecov

codecov Bot commented Jan 6, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #1031 (a416b6e) into master (236b9c2) will decrease coverage by 24.01%.
The diff coverage is 60.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1031       +/-   ##
===========================================
- Coverage   81.36%   57.34%   -24.02%     
===========================================
  Files          86       86               
  Lines        4432     4487       +55     
  Branches      812      831       +19     
===========================================
- Hits         3606     2573     -1033     
- Misses        558     1554      +996     
- Partials      268      360       +92     
Impacted Files Coverage Δ
src/token/nbcrow-token-parser.ts 3.70% <0.00%> (-72.16%) ⬇️
src/token/token.ts 64.10% <ø> (-27.36%) ⬇️
src/token/colmetadata-token-parser.ts 55.55% <59.25%> (-31.29%) ⬇️
src/token/stream-parser.ts 65.15% <60.00%> (-9.24%) ⬇️
src/connection.ts 57.24% <100.00%> (-8.70%) ⬇️
src/token/row-token-parser.ts 100.00% <100.00%> (ø)
src/ntlm-payload.ts 1.00% <0.00%> (-97.00%) ⬇️
src/token/sspi-token-parser.ts 5.26% <0.00%> (-94.74%) ⬇️
src/data-types/time.ts 5.55% <0.00%> (-91.67%) ⬇️
src/ntlm.ts 3.44% <0.00%> (-86.21%) ⬇️
... and 51 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 236b9c2...a416b6e. Read the comment docs.

@IanChokS IanChokS changed the title Fix for #886 ColumnMetadata delivers proper TYPES Feb 19, 2020
@IanChokS IanChokS changed the title ColumnMetadata delivers proper TYPES Refactor: ColumnMetadata delivers proper TYPES Feb 19, 2020

@arthurschreiber arthurschreiber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked over this, and there's a few suggestions I have. 😄

  • The columnMetadata event is not the only place where these types are exposed. They are also exposed via row events. We'd have to do the same mapping there, but we need to make sure this mapping only happens once upfront, and not for each individual row event, as that could impact performance too much.

  • I'm not super happy about having another optional property on the getDataType interface. What do you think of moving the logic of which type maps to which other type maybe into the specifyDataType function instead?

@IanChokS

IanChokS commented Mar 9, 2020

Copy link
Copy Markdown
Member Author

Yup sounds good for both. I'll go over the changes and refactor them.

@arthurschreiber

Copy link
Copy Markdown
Collaborator

@IanChokS I pushed some additional changes to your PR. I moved the mapping into the parser, where we now map the internal types to external types whenever a new column metadata list is assigned to the parser. This way, the mapping only happens once (after we parsed the column metadata).

When we parse RowTokens or NBCRowTokens, we use the internal column metadata when parsing the data, put use the external column metadata when building the tokens. This should fix all cases where we previously returned types like IntN in a consistent fashion.

What do you think?

@IanChokS

Copy link
Copy Markdown
Member Author

Sounds good 👍

Thanks!

@arthurschreiber
arthurschreiber force-pushed the 886-metadata-deprecated-types branch 2 times, most recently from f1e15c3 to 8bc8553 Compare June 23, 2020 19:29
@arthurschreiber arthurschreiber changed the title Refactor: ColumnMetadata delivers proper TYPES fix: only return usable column metadata types Jun 27, 2020
@arthurschreiber
arthurschreiber force-pushed the 886-metadata-deprecated-types branch from 8bc8553 to 283d3c8 Compare June 27, 2020 12:15
@arthurschreiber
arthurschreiber force-pushed the 886-metadata-deprecated-types branch 2 times, most recently from 55a6f70 to 9c581f7 Compare June 27, 2020 13:03
BREAKING CHANGE: Column metadata could sometimes return internal,
variable length data types like `IntN`, `BitN`, `FloatN` and similar.
These types were not intended for external use, and should never have
been exposed in the first place.

We now map these internal types to proper external types e.g. `IntN` is
now mapped to `TinyInt`, `SmallInt`, `Int` or `BigInt`, based on the
datalength of the variable length type.
@IanChokS

Copy link
Copy Markdown
Member Author

@arthurschreiber Any plans on dropping node.js 6 or 8 support soon?

Copy link
Copy Markdown
Collaborator

Thanks @IanChokS. The underlying problem (#886) is still valid. Column metadata still exposes internal types like IntN and BitN. But the parsers this touches have been rewritten since, and this branch can't be rebased. Since it's also a breaking change, it would need to be redone against current master for a future major release. Closing this branch; #886 stays open to track it.


Generated by Claude Code

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants