Fetching structs containing datetimes fails silently

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
sql, typescript
領域
databases

調査の方向性

まず参照されている89行目と121行目の lib/result/JsonResult.ts から始め、created_at と updated_at の datetime 値を含む提供された struct を使って失敗を再現します。パースがどのように defaultValue にフォールバックするかを確認し、この入力をサイレントなデータ損失なしに処理できることを完了条件としたうえで、warning をログに記録すべきかどうかにも対処します。

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

説明

Component: Results Processing

In this step,
https://github.com/databricks/databricks-sql-nodejs/blob/c99dfd1762420bd50d7f244d3dcef0accf2e376b/lib/result/JsonResult.ts#L121

https://github.com/databricks/databricks-sql-nodejs/blob/c99dfd1762420bd50d7f244d3dcef0accf2e376b/lib/result/JsonResult.ts#L89

If the data being parsed contains datetimes, it fails and returns defaultValue. Example error and data are below:

SyntaxError: Unexpected number in JSON at position 39
    at JSON.parse (<anonymous>)
    at JsonResult.toJSON (./databricks-sql-nodejs/dist/result/JsonResult.js:93:25)
    at JsonResult.convertData (./databricks-sql-nodejs/dist/result/JsonResult.js:64:29)
    at ./databricks-sql-nodejs/dist/result/JsonResult.js:47:25
    at Array.map (<anonymous>)
    at JsonResult.getSchemaValues (./databricks-sql-nodejs/dist/result/JsonResult.js:43:35)
    at ./databricks-sql-nodejs/dist/result/JsonResult.js:27:62
    at Array.reduce (<anonymous>)
    at JsonResult.getRows (./databricks-sql-nodejs/dist/result/JsonResult.js:27:28)
    at ./databricks-sql-nodejs/dist/result/JsonResult.js:16:31

The string that's failing to parse is below (partially scrubbed)
'{"id":414247,"created_at":2021-12-21 21:33:59.339,"updated_at":2021-12-21 21:33:59.339,"deleted_at":null,"s3_bucket":"thebucket","s3_key":"c411f24d-1b4a-4eb0-b25b-d2287c7ba3c0"}'

Also, would it make sense to at least log a warning if parsing fails and returns the default value?

主要言語
TypeScript
スター
36
フォーク
50
平均マージ
13時間 46分
マージ済み PR(30日)
9

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

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

はじめの一歩

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

databricks/databricks-sql-nodejs のほかの issue

databricks/databricks-sql-nodejs の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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