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

DataFrame select: fails when no rows are selected #91

Closed
AtharvaKhare opened this issue May 5, 2019 · 6 comments
Closed

DataFrame select: fails when no rows are selected #91

AtharvaKhare opened this issue May 5, 2019 · 6 comments
Labels

Comments

@AtharvaKhare
Copy link
Contributor

Running the following block:

df := DataFrame withRows: #((1) (2) (3) (4)).
df select: [ :row | (row at: 1) >= 5 ].

leads to SubscriptOutOfBounds: 1, due to first in DataFrameInternal withRows::

numberOfColumns := anArrayOfArrays first size.

Shouldn't it return an empty Dataframe instead?

@olekscode
Copy link
Member

Yes, that's definitely a bug!
I think, we can fix it by making sure that DataFrame >> withRows: and all related messages return an empty data frame when given an empty array of rows.

DataFrame withRows: #(). "a DataFrame(0@0)"

@AtharvaKhare
Copy link
Contributor Author

Same is true for reject:

df := DataFrame withRows: #((1) (2) (3) (4)).
df reject: [ :row | (row at: 1) <= 5 ].

@olekscode olekscode added the bug label May 5, 2019
@AtharvaKhare
Copy link
Contributor Author

Can I take this up and adding related tests?

@olekscode
Copy link
Member

I have created a related issue #92 for it

@olekscode
Copy link
Member

But don't work on this issue now, because I want to plan and organize all tasks and issues first.
We can discuss it tomorrow evening.

@AtharvaKhare
Copy link
Contributor Author

Fixed with #100.

github-actions bot pushed a commit to mabdi/DataFrame that referenced this issue Mar 4, 2022
…nOrient_amp_U1

		SmallAmp has derived this test from `DataFrameJsonReaderTest>>#testReadFromJsonOrient` by applying some transformations and regenerating its assertions.
	This test can cover this part:
	*	In `DataFrameJsonReader>> #read:` from 91 to 148:
		Operation: ReplaceIfTrueReceiverWithTrueOperator
		Code snippet: `orient = 'auto' ifTrue: [ self inferOrientFromJson: json ]`
		Dynamic state: {#orient->'auto'}
		Mutant id: ReplaceIfTrueReceiverWithTrueOperator#DataFrameJsonReader#read:PolyMathOrg#91#148
github-actions bot pushed a commit to mabdi/DataFrame that referenced this issue Mar 10, 2022
…nOrient_amp_L8

		SmallAmp has derived this test from `DataFrameJsonReaderTest>>#testReadFromJsonOrient` by applying some transformations and regenerating its assertions.
	This test can cover this part:
	*	In `DataFrameJsonReader>> #read:` from 91 to 148:
		Operation: ReplaceIfTrueReceiverWithTrueOperator
		Code snippet: `orient = 'auto' ifTrue: [ self inferOrientFromJson: json ]`
		Dynamic state: {#orient->'auto'}
		Mutant id: ReplaceIfTrueReceiverWithTrueOperator#DataFrameJsonReader#read:PolyMathOrg#91#148
github-actions bot pushed a commit to mabdi/DataFrame that referenced this issue Mar 14, 2022
…nOrient_amp_U1

		SmallAmp has derived this test from `DataFrameJsonReaderTest>>#testReadFromJsonOrient` by applying some transformations and regenerating its assertions.
	This test can cover this part:
	*	In `DataFrameJsonReader>> #read:` from 91 to 148:
		Operation: ReplaceIfTrueReceiverWithTrueOperator
		Code snippet: `orient = 'auto' ifTrue: [ self inferOrientFromJson: json ]`
		Dynamic state: {#orient->'auto'}
		Mutant id: ReplaceIfTrueReceiverWithTrueOperator#DataFrameJsonReader#read:PolyMathOrg#91#148
github-actions bot pushed a commit to mabdi/DataFrame that referenced this issue Mar 23, 2022
…nOrient_amp_N1

		SmallAmp has derived this test from `DataFrameJsonReaderTest>>#testReadFromJsonOrient` by applying some transformations and regenerating its assertions.
	This test can cover this part:
	*	In `DataFrameJsonReader>> #read:` from 91 to 148:
		Operation: ReplaceIfTrueReceiverWithTrueOperator
		Code snippet: `orient = 'auto' ifTrue: [ self inferOrientFromJson: json ]`
		Dynamic state: {#orient->'auto'}
		Mutant id: ReplaceIfTrueReceiverWithTrueOperator#DataFrameJsonReader#read:PolyMathOrg#91#148
github-actions bot pushed a commit to mabdi/DataFrame that referenced this issue Mar 24, 2022
…nOrient_amp_L7

		SmallAmp has derived this test from `DataFrameJsonReaderTest>>#testReadFromJsonOrient` by applying some transformations and regenerating its assertions.
	This test can cover this part:
	*	In `DataFrameJsonReader>> #read:` from 91 to 148:
		Operation: ReplaceIfTrueReceiverWithTrueOperator
		Code snippet: `orient = 'auto' ifTrue: [ self inferOrientFromJson: json ]`
		Dynamic state: {#orient->'auto'}
		Mutant id: ReplaceIfTrueReceiverWithTrueOperator#DataFrameJsonReader#read:PolyMathOrg#91#148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants