Пример #1
0
 def peek(self, count=10, max_block_size=30000):
     ctx = Vulkn()
     sql = self.sql
     q = f"""
         SELECT
             _i AS i,
             _v AS v
         FROM (
             SELECT
                 _i, _v
             FROM ({sql})
             ARRAY JOIN
                 arrayEnumerate(arraySlice(v, 1, {count})) AS _i,
                 arraySlice(v, 1, {count}) AS _v
         ) SETTINGS max_block_size={max_block_size}"""
     return ctx._conn.select(q).to_records()
Пример #2
0
 def _cache(self, engine=None):
     ctx = Vulkn()
     engine = engine or vulkn.engines.Memory()
     return ctx.session.cache(self.sql, engine=engine)
Пример #3
0
 def index_agg(self, agg):
     ctx = Vulkn()
     q = 'SELECT {agg}(i) AS {agg} FROM ({vector})'
     return ctx._conn.select(q.format(agg=agg,
                                      vector=self.sql)).to_records()
Пример #4
0
 def peek(self, count=10, max_block_size=30000):
     ctx = Vulkn()
     sql = self.sql
     q = f'SELECT i, v FROM ({sql}) WHERE i <= {count} ORDER BY i LIMIT {count} SETTINGS max_block_size={max_block_size}'
     return ctx._conn.select(q).to_records()
Пример #5
0
 def exec(self):
     ctx = Vulkn()
     return ctx._conn.select(self.sql)
Пример #6
0
 def index_agg(self, agg):
     ctx = Vulkn()
     vector = self.sql
     q = f"SELECT arrayReduce('{agg}', arrayEnumerate(v)) AS v FROM ({vector})"
     return ctx._conn.select(q).to_records()
Пример #7
0
 def agg(self, agg):
     ctx = Vulkn()
     vector = self.sql
     q = f"SELECT arrayReduce('{agg}', v) AS v FROM ({vector})"
     return ctx._conn.select(q).to_records()
Пример #8
0
 def _cache(self):
     ctx = Vulkn()
     return ctx.session.cache(self.sql, mode=session.CacheMode.Array)