Left join entity is never null

オープン
#697 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
静か
技術スタック
fsharp, sql
領域
databases

調査の方向性

ソースファイルもテストも指定されていません。まず、issue にある 2 つのクエリ形式を SQLProvider v1.1.93 に対して再現し、leftOuterJoin、DefaultIfEmpty()、および報告されているデフォルト値のエンティティに焦点を当ててください。サポートされている構文と、エンティティが存在しない場合に予想される動作を文書化またはテストできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug
I am trying to left join "sheets" entity but I can't get it to work properly.

The documentation says that leftOuterJoin is not supported, but I see examples on stackoverflow of people saying this works.
For me it does not.

query {
        for e in ctx.Dbo.TimeEntries do
        join t in ctx.Dbo.ProjectTasks on (e.TaskId = t.Id)
        leftOuterJoin sheet in ctx.Dbo.DrawingLogSheets on (e.SheetId = Some sheet.Id) into sheetResults
        for s in sheetResults.DefaultIfEmpty() do
        where (e.Email = Some email && e.Date = dateOnly)
        select (toTimeEntry(e, t, s))
    }

This fails with an error.

I also tried this approach:

query {
        for e in ctx.Dbo.TimeEntries do
        join t in ctx.Dbo.ProjectTasks on (e.TaskId = t.Id)
        join s in (!!) ctx.Dbo.DrawingLogSheets on (e.SheetId = Some s.Id)
        where (e.Email = Some email && e.Date = dateOnly)
        select (toTimeEntry(e, t, s))
    }

This kind of works, but sheet is never null when it is missing; instead, it has all its values defaulted. For example, its ID field is a new guid (all zeros), and its string values are all empty string. I suppose I could check for defaulted guid, but this just feels like something is not right.

To Reproduce

Expected behavior
In the first example (leftOuterJoin), I just want to verify whether this syntax is supposed to be supported or not.
In the second example (!!), I would expect the sheet entity to be null when no sheet is joined, but instead it is instantiated with all default values.

Screenshots

Desktop (please complete the following information):

  • Windows
  • SQLProvider is v1.1.93

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

主要言語
F#
スター
627
フォーク
147
平均マージ
2時間 2分
マージ済み PR(30日)
1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fsprojects/SQLProvider のほかの issue

fsprojects/SQLProvider の issue をすべて見る

似ている issue

Databases の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。