def v3_to_v4_query(self, v3_query, v4_query):
    """Converts a v3 Query to a v4 Query.

    Args:
      v3_query: a datastore_pb.Query
      v4_query: a datastore_v4_pb.Query to populate

    Raises:
      InvalidConversionError if the query cannot be converted
    """
    v4_query.Clear()

    datastore_pbs.check_conversion(not v3_query.has_distinct(),
                                   'distinct option not supported')
    datastore_pbs.check_conversion(v3_query.require_perfect_plan(),
                                   'non-perfect plans not supported')



    if v3_query.has_limit():
      v4_query.set_limit(v3_query.limit())
    if v3_query.offset():
      v4_query.set_offset(v3_query.offset())
    if v3_query.has_compiled_cursor():
      v4_query.set_start_cursor(
          self.v3_to_v4_compiled_cursor(v3_query.compiled_cursor()))
    if v3_query.has_end_compiled_cursor():
      v4_query.set_end_cursor(
          self.v3_to_v4_compiled_cursor(v3_query.end_compiled_cursor()))


    if v3_query.has_kind():
      v4_query.add_kind().set_name(v3_query.kind())


    for name in v3_query.property_name_list():
      v4_query.add_projection().mutable_property().set_name(name)
    if v3_query.keys_only():
      v4_query.add_projection().mutable_property().set_name(
          datastore_pbs.PROPERTY_NAME_KEY)


    for name in v3_query.group_by_property_name_list():
      v4_query.add_group_by().set_name(name)


    num_v4_filters = len(v3_query.filter_list())
    if v3_query.has_ancestor():
      num_v4_filters += 1

    if num_v4_filters == 1:
      get_property_filter = self.__get_property_filter_from_v4
    elif 1 >= num_v4_filters:
      v4_query.mutable_filter().mutable_composite_filter().set_operator(
          datastore_v4_pb.CompositeFilter.AND)
      get_property_filter = self.__add_property_filter_from_v4

    if v3_query.has_ancestor():
      self._v3_query_to_v4_ancestor_filter(v3_query,
                                           get_property_filter(v4_query))
    for v3_filter in v3_query.filter_list():
      self._v3_filter_to_v4_property_filter(v3_filter,
                                            get_property_filter(v4_query))


    for v3_order in v3_query.order_list():
      self.v3_order_to_v4_order(v3_order, v4_query.add_order())
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_stub_util.py/StubQueryConverter.v3_to_v4_query/swapped operands of `>=`