enso-org / enso

Hybrid visual and textual functional programming.
https://ensoanalytics.com
Apache License 2.0
7.36k stars 324 forks source link

Dropdown for Table.join right is wrong #5055

Closed wdanilo closed 1 year ago

wdanilo commented 1 year ago

This task is automatically imported from the old Task Issue Board and it was originally created by jaroslavtulach. Original issue is here.


Discovered during book clubing.

There is a drop down for Table.join right argument! And it offers Table.Value. Table.Value is just a function which needs a parameter of java_table, so it makes no sense to offer it as tag_value.

Comments:

(jaroslavtulach - Feb 2, 2023)


jdunkerley commented 1 year ago

Please let us know how to determine what ends up in tagValues and the logic we need to control this.

JaroslavTulach commented 1 year ago

To determine what ends up in tagValues one needs to put breakpoint to buildResolvedUnionTypeName. Or better have three breakpoints:

enso$ git diff engine/runtime/src/main/scala/org/enso/compiler/context/SuggestionBuilder.scala
diff --git a/engine/runtime/src/main/scala/org/enso/compiler/context/SuggestionBuilder.scala b/engine/runtime/src/main/scala/org/enso/compiler/context/SuggestionBuilder.scala
index b2161b2d3..23d9789da 100644
--- a/engine/runtime/src/main/scala/org/enso/compiler/context/SuggestionBuilder.scala
+++ b/engine/runtime/src/main/scala/org/enso/compiler/context/SuggestionBuilder.scala
@@ -106,6 +106,9 @@ final class SuggestionBuilder[A: IndexedSource](
                   _
                 ) if !m.isStaticWrapperForInstanceMethod =>
             val typeSignature = ir.getMetadata(TypeSignatures)
+            if (methodName.toString().contains("join")) {
+                System.out.println("Found method " + methodName)
+            }
             val (selfTypeOpt, isStatic) = typePtr match {
               case Some(typePtr) =>
                 val selfType = typePtr
@@ -200,6 +203,9 @@ final class SuggestionBuilder[A: IndexedSource](
     }

     val builder: TreeBuilder = Vector.newBuilder
+    if (module.toString().endsWith("Table")) {
+      System.err.println("Processing " + module)
+    }
     builder += Tree.Node(
       buildModule(
         module,

and stop when one is processing Standard.Table.Data.Table module and join method. Then stop in the buildResolvedUnionTypeName.

Doing that one finds out there is Value java_table which is seen as:

BindingsMap$Type
  name = "Table" 
  members = [ BindingsMap$Cons name="Value" arity = 1 allFieldsDefaulted=false ]

e.g. offering Table.Value is as good as offering Filter_Condition.Equal which is what #5656 wants to offer. Alas they aren't really distinguishable from the perspective of the SuggestionBuilder.

Ideas @jdunkerley, @Frizi & co.?

hubertp commented 1 year ago

@jdunkerley Here are is a clue from Dmitry that I once got on debugging suggestions:

If you want to observe the database, the easiest way is to create a file-based one instead of in-memory https://github.com/enso-org/enso/blob/c4c35c92b7e2b53f5e4571af0e89a56eac8e7120/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala#L117 with val sqlDatabase = SqlDatabase(languageServerConfig.directories.suggestionsDatabaseFile) and then use CLI $ sqlite3 /path/to/suggestions.db

JaroslavTulach commented 1 year ago

offering Table.Value is as good as offering Filter_Condition.Equal which is what #5656 wants to offer. Alas they aren't really distinguishable from the perspective of the SuggestionBuilder.

@jdunkerley proposes to ignore tagValues with a single entry in SuggestionBuilder. Let's do it!

enso-bot[bot] commented 1 year ago

Jaroslav Tulach reports a new STANDUP for yesterday (2023-02-23):

Progress: - PR with design for Table.Value ready for discussion: https://github.com/enso-org/enso/pull/5747

Next Day: Focus on serialization of suggestion cache.

enso-bot[bot] commented 1 year ago

Jaroslav Tulach reports a new STANDUP for yesterday (2023-02-24):

Progress: - discussion about Table.Value (and now also Pair.Value) continues: https://github.com/enso-org/enso/pull/5747#issuecomment-1442768872

Next Day: Vacation on Monday.

enso-bot[bot] commented 1 year ago

Jaroslav Tulach reports a new STANDUP for yesterday (2023-02-25):

Progress: - Table.Value, Pair.Value - awaits: https://github.com/enso-org/enso/pull/5747#issuecomment-1442768872

Next Day: Vacation on Monday.

GitHub
[GR-25539] Interop support for BigInteger. by graalvmbot · Pull Request #5490 · oracle/graal
GraalVM: Run Programs Faster Anywhere :rocket:. Contribute to oracle/graal development by creating an account on GitHub.
enso-bot[bot] commented 1 year ago

Jaroslav Tulach reports a new STANDUP for yesterday (2023-02-28):

Progress: - Table.Value solved and integrated

Next Day: Cache invalidations & request timeout