Skip to content

Conversation

@ScrapCodes
Copy link
Contributor

@ScrapCodes ScrapCodes commented Jul 2, 2025

Description

Currently varchar(len) is mapped to either tinytext, text, mediumtext or longtext of singlestore types. However now singlestore supports varchar with length upto varchar(21844). So, we do not convert varchar length < 21844 into tiny text or text.
More details: https://docs.singlestore.com/cloud/reference/sql-reference/data-types/string-types/

Motivation and Context

We can preserve original table's varchar length as long as they are within the limit of 21844.

Impact

Improved compatibility with singlestore with more accurate type mapping.

Test Plan

Added and fixed existing tests.

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

Singlestore connector Changes
* Improved string type mapping, now supports varchar(len) where len <= 21844

@ScrapCodes ScrapCodes requested a review from a team as a code owner July 2, 2025 10:54
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Jul 2, 2025
@prestodb-ci prestodb-ci requested review from a team, BryanCutler and pramodsatya and removed request for a team July 2, 2025 10:54
@steveburnett
Copy link
Contributor

Consider adding documentation to https://github.com/prestodb/presto/blob/master/presto-docs/src/main/sphinx/connector/singlestore.rst similar to the Type Mapping topic in the Iceberg Connector doc.

@ScrapCodes ScrapCodes force-pushed the singlestore_type_mapping_fix branch from 135b6bc to c5368ae Compare July 7, 2025 11:09
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thanks for the doc! A formatting nit, and a question.

@ScrapCodes ScrapCodes force-pushed the singlestore_type_mapping_fix branch from c5368ae to 5f6913e Compare July 8, 2025 09:34
steveburnett
steveburnett previously approved these changes Jul 8, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull updated branch, new local doc build. Thanks!

Copy link
Contributor

@BryanCutler BryanCutler left a comment

Choose a reason for hiding this comment

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

LGTM, just a question about the commented test case

steveburnett
steveburnett previously approved these changes Jul 15, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull updated branch, new local doc build, looks good.

Thanks for the doc!

Copy link
Contributor

@pratyakshsharma pratyakshsharma left a comment

Choose a reason for hiding this comment

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

Couple of minor comments, thank you for the PR.

* - ``CHAR(len)``
- ``CHAR(len)``
* - ``MEDIUMTEXT``
- ``VARCHAR(len) 21845 < len < 5592405``
Copy link
Contributor

@pratyakshsharma pratyakshsharma Jul 16, 2025

Choose a reason for hiding this comment

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

What if the length is exactly 21845? Similarly for 5592045?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @pratyakshsharma, this needs to be fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still a little confused about the numbers above? Shouldn't it be VARCHAR(len) 21845 <= len < 5592405?

.row("orderkey", "bigint", "", "")
.row("custkey", "bigint", "", "")
.row("orderstatus", "varchar(85)", "", "")//utf8
.row("orderstatus", "varchar(1)", "", "")//utf8
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we changing these lengths?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the actual lengths of those columns, previously it was taking a default length for all varchars lower than 85 represented by tiny text.

@pratyakshsharma
Copy link
Contributor

Can we add a test case to cover the scenario of max length supported for varchar/longtext, if possible?

@ScrapCodes
Copy link
Contributor Author

Can we add a test case to cover the scenario of max length supported for varchar/longtext, if possible?

Does presto support that much length for a varchar as of today?

Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thanks for the doc! One suggestion of restructuring the doc for you to consider. Let me know what you think!

Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thanks for the doc! Just a nit of formatting.

@steveburnett
Copy link
Contributor

Thanks for the release note entry! Minor suggestions:

== RELEASE NOTES ==

Singlestore Connector Changes
* Improved string type mapping, now supports ``varchar(len)`` where ``len <= 21844``.

@ScrapCodes ScrapCodes changed the title Fixed singlestore varchar type mapping. fix: singlestore varchar type mapping. Oct 30, 2025
@ScrapCodes ScrapCodes force-pushed the singlestore_type_mapping_fix branch from 669c84d to b5c79e2 Compare October 30, 2025 17:00
@ScrapCodes ScrapCodes changed the title fix: singlestore varchar type mapping. fix: singlestore varchar type mapping Oct 31, 2025
@ScrapCodes ScrapCodes changed the title fix: singlestore varchar type mapping Fix: singlestore varchar type mapping Oct 31, 2025
@ScrapCodes ScrapCodes changed the title Fix: singlestore varchar type mapping fix: singlestore varchar type mapping Oct 31, 2025
@ScrapCodes ScrapCodes changed the title fix: singlestore varchar type mapping fix: Singlestore varchar type mapping Oct 31, 2025
@ScrapCodes
Copy link
Contributor Author

@steveburnett and @pratyakshsharma can you give me a final approval

steveburnett
steveburnett previously approved these changes Oct 31, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull updated branch, new local doc build. Thanks!

Copy link
Contributor

@BryanCutler BryanCutler left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull updated branch, new local doc build.

Copy link
Contributor

@pratyakshsharma pratyakshsharma left a comment

Choose a reason for hiding this comment

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

Thank you for the fix and clarifying all my doubts.

@pratyakshsharma
Copy link
Contributor

Please check the failures and squash the commits, thanks.

Currently varchar(len) is mapped to either tinytext, text, mediumtext or
longtext of singlestore types. However now singlestore supports varchar
with length upto varchar(21844). So we need not convert it into tiny
text or text.
@ScrapCodes ScrapCodes force-pushed the singlestore_type_mapping_fix branch from e76223f to bc3c1e6 Compare November 20, 2025 16:39
@tdcmeehan tdcmeehan changed the title fix: Singlestore varchar type mapping fix(plugin-singlestore): Varchar type mapping Nov 21, 2025
@ScrapCodes ScrapCodes merged commit 6240b16 into prestodb:master Nov 22, 2025
115 of 118 checks passed
@ScrapCodes ScrapCodes deleted the singlestore_type_mapping_fix branch November 22, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants