Azure/pykusto

multiplying numbers and columns doesn't always work

amos-rimon opened this issue · 2 comments

examples:
Query().where(f.to_double(100 * t.numberField) > 0.2).render()
returns: TypeError: unsupported operand type(s) for *: 'int' and 'AnyTypeColumn'

Query().where(100 * f.to_double(t.numberField) > 0.2).render()
returns: TypeError: unsupported operand type(s) for *: 'int' and 'NumberExpression'

Query().where(col.of(100) * f.to_double(t.numberField) > 0.2).render()
renders as : "| where (['100'] * (todouble(numberField))) > 0.2" which doesn't compile.

I didn't have any more ideas...

ymost commented

Query().where(col.of(100) * f.to_double(t.numberField) > 0.2).render()
renders as : "| where (['100'] * (todouble(numberField))) > 0.2" which doesn't compile.

Wow, I didn't know Kusto allows a column name composed entirely of digits 😮
Anyway, I just tested this line in Kusto and it complies fine.
I did learn of one required fix: automatically quote such column names, so we won't need to use the 'of' method workaround.

Regarding the first two examples - I'm on it

of course - much faster :)