func()

in table/evaluators.go [1001:1053]


func (m *inclusiveMetricsEval) VisitIn(t iceberg.BoundTerm, s iceberg.Set[iceberg.Literal]) bool {
	field := t.Ref().Field()
	fieldID := field.ID

	if m.containsNullsOnly(fieldID) || m.containsNansOnly(fieldID) {
		return rowsCannotMatch
	}

	if s.Len() > inPredicateLimit {
		// skip evaluating the predicate if the number of values is too big
		return rowsMightMatch
	}

	if _, ok := field.Type.(iceberg.PrimitiveType); !ok {
		panic(fmt.Errorf("%w: expected iceberg.PrimitiveType, got %s",
			iceberg.ErrInvalidTypeString, field.Type))
	}

	values := s.Members()
	if lowerBoundBytes := m.lowerBounds[fieldID]; lowerBoundBytes != nil {
		lowerBound, err := iceberg.LiteralFromBytes(field.Type, lowerBoundBytes)
		if err != nil {
			panic(lowerBound)
		}

		if m.isNan(lowerBound) {
			return rowsMightMatch
		}

		values = removeBoundCheck(lowerBound, values, 1)
		if len(values) == 0 {
			return rowsCannotMatch
		}
	}

	if upperBoundBytes := m.upperBounds[fieldID]; upperBoundBytes != nil {
		upperBound, err := iceberg.LiteralFromBytes(field.Type, upperBoundBytes)
		if err != nil {
			panic(err)
		}

		if m.isNan(upperBound) {
			return rowsMightMatch
		}

		values = removeBoundCheck(upperBound, values, -1)
		if len(values) == 0 {
			return rowsCannotMatch
		}
	}

	return rowsMightMatch
}