Skip to content

Commit dd352b1

Browse files
kszucscpcloud
authored andcommitted
refactor(ir): remove UnnamedMarker
1 parent 6f87064 commit dd352b1

File tree

7 files changed

+8
-16
lines changed

7 files changed

+8
-16
lines changed

ibis/backends/base/sql/alchemy/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def _exists_subquery(t, op):
138138
filtered = (
139139
op.foreign_table.to_expr()
140140
.filter([pred.to_expr() for pred in op.predicates])
141-
.projection([ir.literal(1).name(ir.core.unnamed)])
141+
.projection([ir.literal(1).name("")])
142142
)
143143

144144
sub_ctx = ctx.subcontext()

ibis/backends/base/sql/compiler/translator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import ibis.common.exceptions as com
99
import ibis.expr.operations as ops
1010
from ibis.backends.base.sql.registry import operation_registry, quote_identifier
11-
from ibis.expr.types.core import unnamed
1211

1312

1413
class QueryContext:
@@ -199,7 +198,7 @@ def _needs_name(self, op):
199198
# This column has been given an explicitly different name
200199
return False
201200

202-
return op.name is not unnamed
201+
return bool(op.name)
203202

204203
def name(self, translated, name, force=True):
205204
return f'{translated} AS {quote_identifier(name, force=force)}'

ibis/backends/base/sql/registry/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def table_column(translator, op):
166166
def exists_subquery(translator, op):
167167
ctx = translator.context
168168

169-
dummy = ir.literal(1).name(ir.core.unnamed)
169+
dummy = ir.literal(1).name("")
170170

171171
filtered = op.foreign_table.to_expr().filter(
172172
[pred.to_expr() for pred in op.predicates]

ibis/expr/operations/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import ibis.expr.rules as rlz
99
from ibis.common.graph import Node as Traversable
1010
from ibis.common.grounds import Concrete
11-
from ibis.util import UnnamedMarker, deprecated
11+
from ibis.util import deprecated
1212

1313
if TYPE_CHECKING:
1414
import ibis.expr.datatypes as dt
@@ -92,7 +92,7 @@ def to_expr(self):
9292
@public
9393
class Alias(Value):
9494
arg = rlz.any
95-
name = rlz.instance_of((str, UnnamedMarker))
95+
name = rlz.instance_of(str)
9696

9797
output_shape = rlz.shape_like("arg")
9898
output_dtype = rlz.dtype_like("arg")

ibis/expr/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from ibis.common.exceptions import IntegrityError
1111
from ibis.common.grounds import Concrete
1212
from ibis.common.validators import instance_of, tuple_of, validator
13-
from ibis.util import UnnamedMarker, indent
13+
from ibis.util import indent
1414

1515
if TYPE_CHECKING:
1616
import pandas as pd
@@ -46,7 +46,7 @@ def datatype(arg, **kwargs):
4646
class Schema(Concrete):
4747
"""An object for holding table schema information."""
4848

49-
names = tuple_of(instance_of((str, UnnamedMarker)))
49+
names = tuple_of(instance_of(str))
5050
"""A sequence of [`str`][str] indicating the name of each column."""
5151
types = tuple_of(datatype)
5252
"""A sequence of [DataType][ibis.expr.datatypes.DataType] objects

ibis/expr/types/core.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ibis.common.exceptions import IbisError, IbisTypeError, TranslationError
1414
from ibis.common.grounds import Immutable
1515
from ibis.config import _default_backend, options
16-
from ibis.util import UnnamedMarker, experimental
16+
from ibis.util import experimental
1717

1818
if TYPE_CHECKING:
1919
import pyarrow as pa
@@ -381,9 +381,6 @@ def as_table(self) -> ir.Table:
381381
raise NotImplementedError(type(self))
382382

383383

384-
unnamed = UnnamedMarker()
385-
386-
387384
def _binop(
388385
op_class: type[ops.Binary], left: ir.Value, right: ir.Value
389386
) -> ir.Value | NotImplemented:

ibis/util.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ def __repr__(self):
8989
return f"{self.__class__.__name__}({super().__repr__()})"
9090

9191

92-
class UnnamedMarker:
93-
pass
94-
95-
9692
def guid() -> str:
9793
"""Return a uuid4 hexadecimal value."""
9894
return uuid4().hex

0 commit comments

Comments
 (0)