Git Product home page Git Product logo

Comments (7)

laysakura avatar laysakura commented on June 1, 2024

Record, ImmutableRow に FFR (や TCR) を持たせる構成だと、「SELECTの(aliasがある)ときだけFFRにエイリアスをセット」ということが型レベルで守られない。

Record, ImmutableRow はシンプルな Vec にしてカラムのラベル情報は持たず、

FieldIndex -> Set<FullFieldReference> -> (TableName, ColumnName) -> Schema -> 添字

という解決pathを通るのが良いんじゃないかな

from apllodb.

laysakura avatar laysakura commented on June 1, 2024

FFRは、本来DMLにしか出てこないもの(エイリアスが存在するのはDMLなので)。
そう考えると query-processor にFFRを閉じ込める発想も出てくるが、Recordがinstantiateされた段階でFieldIndexによるgetをしたいのも事実。

from apllodb.

laysakura avatar laysakura commented on June 1, 2024

RecordIterator を read 専用にした上で、

  • RecordIterator が Vec を持つ
  • RecordはRecordIterator中の Vec を参照する
  • Record::get(FieldIndex) において、Vec の添字が解決される
  • Recordの内部構造の添字が↑に一致

という感じでgetを実現するかな

from apllodb.

laysakura avatar laysakura commented on June 1, 2024

ExpressionがFFRを持つのは良いのか。

INSERT INTO t (id, c1, c2) SELECT t2.t_id, t2.c1 * 100, t2.c2 FROM s AS t2;

UPDATE t AS t1 set c1 = t1.c2 * 5;

みたいなSQLもあるから、ExpressionにはFFR持たせるべき。

from apllodb.

laysakura avatar laysakura commented on June 1, 2024

FFRの生成経路

SQL with Expression (DML) -> Parser -> AST -> AstTranslator

のみ。

Recordの生成経路

SELECT -> ... -> RecordIterator -> Record

のみ。read-only。

INSERTようには別途ValueList的なものを作ってあげる。

from apllodb.

laysakura avatar laysakura commented on June 1, 2024

クソデカリファクタになるので...

作業ロードマップ

  1. INSERT用に使う構造をRecordじゃないやつにする。ただし、 INSERT ... SELECT に将来対応できるよう、Recordからの変換余地は残す。
  2. Record / RecordIterator 改造
  3. ImmutableRow / SqliteRowIterator 改造
  4. FFR::new の禁止

from apllodb.

laysakura avatar laysakura commented on June 1, 2024

Record / RecordIterator 改造
ImmutableRow / SqliteRowIterator 改造

を分けて取り組むと、RowIter -> RecordIter の変換で余計なロジックを書く必要があるので、これは一緒くたに取り組むしかなさそう

from apllodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.