vmware-archive / sql-to-dbsp-compiler

Compiler translating SQL view definitions into DBSP circuits (https://github.com/vmware/database-stream-processor)
Other
28 stars 4 forks source link

-js does not preserve case of table/view characters #144

Open gz opened 1 year ago

gz commented 1 year ago

Right now -js makes all tables / views characters uppercase even though they're written as lowercase in the original sql. It would be nice if it could preserve this for the -js output.

I know SQL is not case-sensitive but it's nice to represent tables/views the same way the user spelled them in the program.

mihaibudiu commented 1 year ago

This really depends on the sql dialect you use. Some are case sensitive some aren't


From: Gerd Zellweger @.> Sent: Saturday, April 1, 2023 9:37:19 AM To: vmware/sql-to-dbsp-compiler @.> Cc: Subscribed @.***> Subject: [vmware/sql-to-dbsp-compiler] -js does not preserve case of table/view characters (Issue #144)

Right now -js makes all tables / views uppercase even though they're written as lowercase in the original sql. It would be nice if it could preserve this for the -js output.

I know SQL is not case-sensitive but it's nice to represent tables/views the same way the user spelled them in the program.

— Reply to this email directly, view it on GitHubhttps://github.com/vmware/sql-to-dbsp-compiler/issues/144, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AET7TMWG63D3BPWHTDMFV4LW7BKT7ANCNFSM6AAAAAAWPXKRFI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

mihaibudiu commented 1 year ago

There are two separate questions:

Note that SQL allows using quotes around identifier names if the names are to be preserved. But not all dialects agree whether these should be single quotes or double quotes.

mihaibudiu commented 1 year ago

The default implementation in Calcite will uppercase all unquoted identifiers.

gz commented 1 year ago

Here is what my preferred solution would look like:

first question: Table T same as t? -> yes second question: -js should return whatever way the user wrote it, e.g.if tablename was tAbLe it should return tAbLe