GithubHelp home page GithubHelp logo

Comments (7)

killme2008 avatar killme2008 commented on June 27, 2024 1

Hi Dennis @killme2008 Do I get it right that the exception comes from the DataFusion?

If that's the case is there any established way of "intercepting" the AST before sending it to plan? Thank you!

I think we can transform the Expr just like type alias:

https://github.com/GreptimeTeam/greptimedb/blob/main/src/sql/src/statements/transform/type_alias.rs

Adds a new transform rule and add it to

static ref RULES: Vec<Arc<dyn TransformRule>> = vec![

from greptimedb.

killme2008 avatar killme2008 commented on June 27, 2024 1

@etolbakov Looks like compound signed number case not processed properly:

mysql> SELECT INTERVAL '-1h5m';
+----------------------------------------------+
| IntervalMonthDayNano("18446740773709551616") |
+----------------------------------------------+
| P0Y0M0DT0H-55M0S                             |
+----------------------------------------------+

mysql> SELECT INTERVAL '-1h-5m';
ERROR 1815 (HY000): Failed to plan SQL: Parser error: Invalid input syntax for type interval: "-1 h- 5 minutes"

Would you like to fix it?

from greptimedb.

etolbakov avatar etolbakov commented on June 27, 2024 1

ohhh....my bad, yeah, let me give it a go

from greptimedb.

killme2008 avatar killme2008 commented on June 27, 2024 1

I have crafted a document detailing the interval type. Would you kindly provide feedback upon review?

GreptimeTeam/docs#1021

from greptimedb.

killme2008 avatar killme2008 commented on June 27, 2024 1

@etolbakov I have an idea. Maybe we can apply this transform rule to the cast(string as interval) expression too? Then it can be applied to the interval in the form of '3y2mon'::interval. What do you think about it?

https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.Expr.html#variant.Cast

https://docs.rs/datafusion/latest/datafusion/logical_expr/struct.TryCast.html

from greptimedb.

etolbakov avatar etolbakov commented on June 27, 2024 1

It's a great idea! Let me make an assessment (and reopen the ticket 😁)

from greptimedb.

etolbakov avatar etolbakov commented on June 27, 2024

Hi Dennis @killme2008
Do I get it right that the exception comes from the DataFusion?

If that's the case is there any established way of "intercepting" the AST before sending it to plan?
Thank you!

from greptimedb.

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.