cloudera / impyla

Python DB API 2.0 client for Impala and Hive (HiveServer2 protocol)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

concerns about sasl to pure-sasl function mapping in sasl_compat.py

mdeshmu opened this issue · comments

@nonsleepr I had some doubts w.r.t this file:
https://github.com/cloudera/impyla/blob/master/impala/sasl_compat.py

  1. since the pure-sasl wrap function is responsible for encoding outgoing data, shouldn't the corresponding function in sasl_compat.py be called encode instead of decode?

  2. since the pure-sasl unwrap function is responsible for decoding incoming data, shouldn't the corresponding function in sasl_compat.py be called decode instead of encode?

Refer sasl encode and decode definitions here: https://github.com/cloudera/python-sasl/blob/master/sasl/saslwrapper.pyx#L73 which imo, in purpose match with wrap and unwrap pure-sasl functions respectively.

Looking at the 7 year old code it does indeed looks confusing. Does it not work though?
I vaguely remember changing it from what you're saying to what it is now. Don't remember the reasons.
I guess debugging would answer that question. Feel free to dive in and open a PR with changes or comments explaining why it is that way.

@nonsleepr To close the conversation, I wrote test cases for sasl_compat.py and concluded that compatibility code you wrote is perfectly fine.