File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -499,6 +499,26 @@ def test_subsequent_filter():
499499 assert f2 .op () == expected
500500
501501
502+ def test_project_dereferences_literal_expressions ():
503+ one = ibis .literal (1 )
504+ two = ibis .literal (2 )
505+ four = (one + one ) * two
506+ t1 = t .mutate (four = four )
507+ assert t1 .op () == Project (
508+ parent = t ,
509+ values = {
510+ "bool_col" : t .bool_col ,
511+ "int_col" : t .int_col ,
512+ "float_col" : t .float_col ,
513+ "string_col" : t .string_col ,
514+ "four" : four ,
515+ },
516+ )
517+
518+ t2 = t1 .select (four )
519+ assert t2 .op () == Project (parent = t1 , values = {four .get_name (): t1 .four })
520+
521+
502522def test_project_before_and_after_filter ():
503523 t1 = t .select (
504524 bool_col = ~ t .bool_col , int_col = t .int_col + 1 , float_col = t .float_col * 3
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ def dereference_mapping(parents):
163163 while isinstance (v , ops .Field ) and v not in mapping :
164164 mapping [v ] = ops .Field (parent , k )
165165 v = v .rel .values .get (v .name )
166- elif v . relations and v not in mapping :
166+ elif v not in mapping :
167167 # do not dereference literal expressions
168168 mapping [v ] = ops .Field (parent , k )
169169
You can’t perform that action at this time.
0 commit comments