Add technical doc for dynamic fields#5078
Add technical doc for dynamic fields#5078ykmr1224 wants to merge 3 commits intoopensearch-project:mainfrom
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a new developer guide Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@docs/dev/dynamic-fields.md`:
- Around line 6-7: Edit the sentence in docs/dev/dynamic-fields.md so it reads:
"The key idea is to map fields that are directly referred to static fields, and
others to dynamic fields. Most of the command implementations only consider
static fields, while a very few commands such as join need to handle dynamic
fields." Replace "which is directly referred" with "that are directly referred",
change "most of the command implementation" to "Most of the command
implementations", and change "very few command such as join needs" to "a very
few commands such as join need" to fix subject-verb agreement and clarity.
- Line 34: Update the documentation entry that incorrectly references
DynamicFieldsHelper: replace the wrong file path
`core/src/main/java/org/opensearch/sql/calcite/plan/DynamicFieldsConstants.java`
with the correct component path
`core/src/main/java/org/opensearch/sql/calcite/DynamicFieldsHelper.java`,
ensuring the term DynamicFieldsHelper remains and not DynamicFieldsConstants so
the doc points to the actual class.
🧹 Nitpick comments (2)
docs/dev/dynamic-fields.md (2)
49-65: Consider adding language identifiers to code blocks.Several code blocks are missing language identifiers (lines 49, 147, 283). While not critical, adding identifiers improves syntax highlighting and readability.
💡 Suggested language identifiers
For line 49 (workflow/pseudo-code):
-``` +```text Query: source=logs | spath input=data | fields a, b, prefix*For line 147 (table example):
-``` +```text Before expansion (internal representation):For line 283 (execution plan):
-``` +```text Project(a, b, _MAP)Also applies to: 147-159, 283-289
205-206: Fix list indentation for consistency.The bullet points are indented with 2 spaces instead of 0, which is inconsistent with markdown standards.
🔧 Proposed indentation fix
**Note**: Command implementation does not need to handle dynamic fields unless: - - The command takes multiple inputs (e.g. join, append) - - The command works against all the fields +- The command takes multiple inputs (e.g. join, append) +- The command works against all the fields
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@docs/dev/dynamic-fields.md`:
- Line 10: Fix the grammatical error in the “Field Resolution” bullet by
correcting subject-verb agreement. In the docs section labeled “Field
Resolution,” replace the phrase “Analyze query and determines” with “Analyzes
query and determines” to maintain consistency in the description.
- Line 34: The file path for DynamicFieldsHelper in the References section is
incorrect; it includes an extra /plan subdirectory. Locate the Reference section
where DynamicFieldsHelper is mentioned and update the path from
core/src/main/java/org/opensearch/sql/calcite/plan/DynamicFieldsHelper.java to
core/src/main/java/org/opensearch/sql/calcite/DynamicFieldsHelper.java to
reflect the correct file location.
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@docs/dev/dynamic-fields.md`:
- Around line 42-44: The docs mix "STRING" and "VARCHAR" for dynamic field
values; standardize terminology to "VARCHAR" (to match Calcite/PPL SQL type)
across the document — update the phrases in the "Converts dynamic field values
to STRING type for consistency" and "Creates expanded schema with both static
and dynamic fields" sections and the occurrences referenced (around lines
143-144 and 253), and run a global search in docs/dev/dynamic-fields.md to
replace any remaining "STRING" or "VARCHAR" mismatches so all references to
dynamic field value types consistently use "VARCHAR".
- Around line 49-65: Update the documentation examples that reference the
non-existent test indices 'logs', 'logs1', and 'logs2' so they use canonical
test indices (e.g., 'accounts', 'people', or 'events') or add matching test
fixtures; specifically, change the example queries and any accompanying sample
output in dynamic-fields.md to use an existing index name or create
corresponding integ-test/sample data for 'logs*' entries and ensure tests cover
the examples so they run against the repo's fixture set.
Description
Related Issues
#4984
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.