You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Select or remove columns by providing an index-vector. Positive selections are done with [with] and negative selections with [without]. Both methods implement a [builder][https://en.wikipedia.org/wiki/Builder_pattern] to construct more complex selectors.
108
110
*/
109
111
fun Sequence<Row>.select(varargcolIndices:Int): Sequence<Row> {
110
112
val isPositive = colIndices.all { it >0 }
111
-
stopIfNot(isPositive || colIndices.all { it <0 }) {
112
-
" Can not mix positive and negative selections"
113
+
val isNegative = colIndices.all { it <0 }
114
+
115
+
stopIfNot(isPositive xor isNegative) {
116
+
"Can not mix positive and negative selections"
113
117
}
114
118
115
119
val selector =if (isPositive) PosSelect(arrayOf(*colIndices.toTypedArray())) elseNegSelect(arrayOf(*colIndices.toTypedArray()))
@@ -121,12 +125,14 @@ fun Sequence<Row>.select(columns: ColSelect): Sequence<Row> {
121
125
// more efficient but does not allow to change the order
0 commit comments