Open haggholm opened 1 month ago
Is the lz4 dependency truly optional? Will the databricks client work without it?
Is the lz4 dependency truly optional? Will the databricks client work without it?
It doesn't look truly optional to me—I don't have a repro case for this, nor do I know under exactly what conditions it's significant; but from inspection it looks like the client will just fail if it gets an LZ4 compressed response but the lz4
module isn't available: https://github.com/databricks/databricks-sql-nodejs/blob/56bd0d90d61a2bdff4e62cd55ebcb8d070fa60e2/lib/result/ArrowResultHandler.ts#L29-L31
That doesn't feel "truly optional"—it would be one thing if it gracefully fell back to a less performant JS implementation or something, but…
@haggholm the fragment you shared is intended to show meaningful error if something went really bad. In fact, lz4
is imported conditionally here https://github.com/databricks/databricks-sql-nodejs/blob/56bd0d90d61a2bdff4e62cd55ebcb8d070fa60e2/lib/utils/lz4.ts#L1-L16
Then, server is asked to return compressed results only if lz4
module is available: https://github.com/databricks/databricks-sql-nodejs/blob/56bd0d90d61a2bdff4e62cd55ebcb8d070fa60e2/lib/DBSQLSession.ts#L205
Originally shared in https://github.com/databricks/databricks-sql-nodejs/issues/245, but that issue was resolved by making the dependency optional (with reduced functionality if omitted). However, lz4 can cause install problems in another way on systems that do have all the dependencies, s.t. NPM attempts to build it, but fails. We have a CI pipeline that usually passes but occasionally fails. We have not yet invested any time into investigating this, but I'm sharing it as a kind of warning sign.
It's worth noting that the LZ4 repository