Giter Site home page Giter Site logo

Comments (4)

martint avatar martint commented on May 21, 2024 3

Adding implicit casts between numbers and strings can be problematic because it may introduce ambiguities when resolving which functions and operators to call.

It also introduces usability problems. Take a look at these examples:

1 == '1' is true but 2.0 == '2' is false
9 < 10 is true but 9 < '10' or '9' < 10 is false

In the future, we plan to allow users to define implicit casts via plugins, but that's a longer term feature. We don't expect to have this feature built into the core, though, for all the reasons above and the fact that it's not standard SQL behavior.

It take huge cost changes for rewrite Hive scripts

Perhaps, what would be valuable is for someone to build a tool to translate between Hive queries and Presto queries.

from trino.

sopel39 avatar sopel39 commented on May 21, 2024

I don't think implicit number -> string cast is part of SQL standard:

A number is assignable only to sites of numeric type.
If an assignment of some number would result in a loss of its most significant digit, an exception condition is raised.
If least significant digits are lost, implementation- defined rounding or truncating occurs, with no exception condition being raised.
The rules for arithmetic are specified in Subclause 6.26, “<numeric value expression>”.

Maybe we could have a compatibility toggle for such feature? @martint ?

from trino.

hereTac avatar hereTac commented on May 21, 2024

Ye. Good idea. It is good for both.

from trino.

aniruddha-pe avatar aniruddha-pe commented on May 21, 2024

Hey, is this being taken up anytime soon ? If not as a default, probably can be provided as an option to user to set true before running a query like hive.groupby.orderby.position.alias=true

from trino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.