Add explicit truthiness semantics for constant BooleanExpressions
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia individuando BooleanExpression, AlwaysTrue e AlwaysFalse, quindi esamina i controlli sulle espressioni opzionali e la gestione dei residui/filtri REST menzionati nell’issue. Verifica che solo le espressioni costanti supportino la valutazione di verità di Python, che le espressioni non costanti la rifiutino e che i valori espliciti AlwaysFalse() vengano conservati invece di essere trattati come mancanti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
While this PR can use expression negation via __invert__, I think it may be worth supporting Python truthiness for the constant expressions in a follow-up:
class AlwaysTrue:
def __bool__(self) -> bool:
return True
class AlwaysFalse:
def __bool__(self) -> bool:
return False
That would make patterns like this behave intuitively:
if not self.visit_starts_with(term, literal):
return AlwaysTrue()
When adding this, we should also be careful that Python truthiness is for control flow, not expression construction: not expr returns a Python bool, while ~expr returns a negated BooleanExpression. It would probably be safest for non-constant BooleanExpression.__bool__ to raise, with only AlwaysTrue and AlwaysFalse overriding it. The follow-up should also audit optional-expression checks like expr or AlwaysTrue() and REST residual/filter handling so explicit AlwaysFalse() values are not treated as missing.
Originally posted by @kevinjqliu in https://github.com/apache/iceberg-python/issues/3503#issuecomment-4763176953
- Lingua principale
- Python
- Stelle
- 1.1k
- Fork
- 589
- Merge medio
- 2g 2h
- PR unite (30g)
- 70
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/iceberg-python
-
kind:bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
apache/iceberg-python#4006 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/iceberg-python#3996 ·
-
Deletion vector bitmap count is read from the blob and used as a loop bound without validation Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/iceberg-python#3979 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/iceberg-python#3885 ·
-
[Bug] PyArrowFileIO fails to propagate s3.ssl.ca-cert to pyarrow.fs.S3FileSystem tls_ca_file_path Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apache/iceberg-python#3866 · 1 commento ·
Tutte le issue di apache/iceberg-python
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·