@@ -124,7 +124,7 @@ def __init__(
124124 if len (index_columns ) == 0 :
125125 warnings .warn (
126126 "Creating object with Null Index. Null Index is a preview feature." ,
127- category = bigframes .exceptions .PreviewWarning ,
127+ category = bigframes .exceptions .NullIndexPreviewWarning ,
128128 )
129129 self ._index_columns = tuple (index_columns )
130130 # Index labels don't need complicated hierarchical access so can store as tuple
@@ -1930,10 +1930,22 @@ def merge(
19301930 coalesce_labels = matching_join_labels ,
19311931 suffixes = suffixes ,
19321932 )
1933- # Constructs default index
1934- offset_index_id = guid .generate_guid ()
1935- expr = joined_expr .promote_offsets (offset_index_id )
1936- return Block (expr , index_columns = [offset_index_id ], column_labels = labels )
1933+
1934+ # Construct a default index only if this object and the other both have
1935+ # indexes. In other words, joining anything to a NULL index object
1936+ # keeps everything as a NULL index.
1937+ #
1938+ # This keeps us from generating an index if the user joins a large
1939+ # BigQuery table against small local data, for example.
1940+ if len (self ._index_columns ) > 0 and len (other ._index_columns ) > 0 :
1941+ offset_index_id = guid .generate_guid ()
1942+ expr = joined_expr .promote_offsets (offset_index_id )
1943+ index_columns = [offset_index_id ]
1944+ else :
1945+ expr = joined_expr
1946+ index_columns = []
1947+
1948+ return Block (expr , index_columns = index_columns , column_labels = labels )
19371949
19381950 def join (
19391951 self ,
0 commit comments