3 ms·
This seems like a really hard problem to solve - but it's some pretty cool progress. I do wonder how Mongo decided building a high-level transpiler was worth th
by geewee 7y ago
This seems like a really hard problem to solve - but it's some pretty cool progress. I do wonder how Mongo decided building a high-level transpiler was worth their time though. Is the business value of translating those queries really that high?
- PaulHoule 7y agoI think potentially very high. There's a subset of operators that are similar (but not identical) between programming languages. For instance you can add numbers like const a = b + c in javascript int a = b + c in java, etc, you can even write (b+c) as a in the select statement of a SQL query. If you look at basic operations on numbers and strings it is not hard to translate expressions between conventional languages and query languages. Now query languages have different ideas about control structures, but working at the expression level you can mostly avoid that. Now there are issues around data types (are we adding ints or floats, what to do about overflow, when you index the Nth element of a string is it 8 bits (maybe part of a Unicode char), is it a basic plane unicode char, or could it be any codepoint, or something else...) but those problems don't turn up 100% of the time when you try to translate.
- nradov 7y agoThe data type and edge case issues have to be considered 100% of the time unless the transpiler can reliably determine through static analysis that they aren't a factor.