Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The eval method applies the column expression even if the function is not valid. #160

Open
pestyld opened this issue May 15, 2023 · 1 comment

Comments

@pestyld
Copy link

pestyld commented May 15, 2023

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()
image

Eval method bad function

castbl.eval('NewCol = badfunction(SASData)')
image

View params

castbl.params
[output]
{'name': 'DATE_TABLE',
'caslib': 'samples',
'computedvars': ['NewCol'],
'computedvarsprogram': 'NewCol = badfunction(SASData); NewCol = NewCol; '}

@bkemper24
Copy link
Contributor

Thanks for reporting this. I will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants