When you create a graph as part of a CspPerspectiveTable it does not memoize nodes.
To Reproduce
Minimal repro
import csp
from datetime import datetime, timedelta
from PIL import Image
import perspective
from csp.impl.pandas_ext_type import TsDtype
from csp.impl.pandas_perspective import CspPerspectiveTable
import pandas as pd
df = pd.DataFrame()
df.insert(0, 'one1', pd.Series(csp.const(1.0), dtype=TsDtype(float)), True)
df.insert(1, 'one2', pd.Series(csp.const(1.0), dtype=TsDtype(float)), True)
table = CspPerspectiveTable(df, index_col='timestamp', keep_history=False, localize=True)
g = table.graph
# Note I use a roundabout to call show_graph since I'm in Jupyterlab
# You can replace the code below with a simple show_graph call
buffer = csp.showgraph.generate_graph(g)
image = Image.open(buffer)
display(image)
This gives an image clearly showing the const adapter is not memoized:
However, if I "manually" memoize the const nodes by only creating one and providing it both index 0 and 1 of the CspPerspectiveTable like:
Describe the bug
When you create a graph as part of a
CspPerspectiveTable
it does not memoize nodes.To Reproduce
Minimal repro
This gives an image clearly showing the
const
adapter is not memoized:However, if I "manually" memoize the const nodes by only creating one and providing it both index 0 and 1 of the
CspPerspectiveTable
like:We get what we expect:
Expected behavior
Memoization should work like it does for any other graph
Error Message
Runtime Environment
Additional context