probcomp / bayeslite

BayesDB on SQLite. A Bayesian database table for querying the probable implications of data as easily as SQL databases query the data itself.
http://probcomp.csail.mit.edu/software/bayesdb
Apache License 2.0
922 stars 64 forks source link

Remove unneeded casefolds in LoomBackend.simulate_joint #618

Closed fsaad closed 6 years ago

fsaad commented 6 years ago

https://github.com/probcomp/bayeslite/blob/2a305b1e8020f3a725141abd5b7d23837cec412c/src/backends/loom_backend.py#L730-L743

Since the bayeslite schema uses COLLATE NOCSAE the return variable names are always lower case. Even if they were not, Loom will expect variables to be of the same that was used to create the models, which is the same capitalization that appears in the bayesdb table:

https://github.com/probcomp/bayeslite/blob/2a305b1e8020f3a725141abd5b7d23837cec412c/src/backends/loom_backend.py#L192-L209

fsaad commented 6 years ago

Since the bayeslite schema uses COLLATE NOCASE the return variable names are always lower case

Not sure where I obtained this bizarre statement from. It is false, the COLLATE NOCASE indicates to ignore case for comparison purposes, but stores the entry in whatever case was indicated in the INSERT INTO statement.

Nevertheless, the function bayesdb_variable_name always returns lower case variable names, since variable names in the bayesdb_variable table are always stored in lowercase by the interpreter (discussion #546): https://github.com/probcomp/bayeslite/blob/01638d2f97706ea21ac23a5b1f61f9ddce8b61c7/src/bql.py#L915-L921 So we should be able to remove the casefolds nevertheless.