sassoftware / sassoftware/python-swat
The eval method applies the column expression even if the function is not valid.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 159
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
Even though you get an error when adding a function that doesn't exist to a CAS table object, it still adds the computation to the object. This causes an error moving forward. You either have to reset the CAS table object, or remove just the bad expression.
I feel that if you get an error when using a SAS function it should not add the expression to the CASTable object.
Example below:
Create demo DataFrame
df = pd.DataFrame({
'SASDate':[18260,18212, 18290, 18201, 18158],
'StrDate':['2009-12-29', '2009-11-11', '2010-01-28', '2009-10-31', '2009-09-18']
})
Upload DataFrame to CAS
castbl = conn.upload_frame(df,
casout = {'name':'date_table',
'caslib':'casuser',
'replace':True})
View params of CASTable object
castbl.params
[output]: {'name': 'DATE_TABLE', 'caslib': 'CASUSER(Peter)'}
Table preview
castbl.head()
Eval method bad function
castbl.eval('NewCol = badfunction(SASData)')
View params
castbl.params
[output]
{'name': 'DATE_TABLE',
'caslib': 'samples',
'computedvars': ['NewCol'],
'computedvarsprogram': 'NewCol = badfunction(SASData); NewCol = NewCol; '}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the Python DataFrame and CASTable.eval example in the report, then inspect the CASTable eval implementation and its existing tests. Done means an invalid SAS function raises an error without leaving the computed variable or expression in castbl.params, while valid expressions continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100