From 3de578d478873b618f12a5e9169e8f43f9354a37 Mon Sep 17 00:00:00 2001 From: Lantao Jin Date: Fri, 11 Oct 2024 15:33:06 +0800 Subject: [PATCH] add doc Signed-off-by: Lantao Jin --- docs/ppl-lang/PPL-Example-Commands.md | 5 +++++ ...lPlanBasicQueriesTranslatorTestSuite.scala | 21 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/docs/ppl-lang/PPL-Example-Commands.md b/docs/ppl-lang/PPL-Example-Commands.md index c553d483f..7d57651c3 100644 --- a/docs/ppl-lang/PPL-Example-Commands.md +++ b/docs/ppl-lang/PPL-Example-Commands.md @@ -2,6 +2,11 @@ #### **Describe** - `describe table` This command is equal to the `DESCRIBE EXTENDED table` SQL command +- `describe schema.table` +- `` describe schema.`table` `` +- `describe catalog.schema.table` +- `` describe catalog.schema.`table` `` +- `` describe `catalog`.`schema`.`table` `` #### **Explain** - `explain simple | source = table | where a = 1 | fields a,b,c` diff --git a/ppl-spark-integration/src/test/scala/org/opensearch/flint/spark/ppl/PPLLogicalPlanBasicQueriesTranslatorTestSuite.scala b/ppl-spark-integration/src/test/scala/org/opensearch/flint/spark/ppl/PPLLogicalPlanBasicQueriesTranslatorTestSuite.scala index 0c10fcb06..96176982e 100644 --- a/ppl-spark-integration/src/test/scala/org/opensearch/flint/spark/ppl/PPLLogicalPlanBasicQueriesTranslatorTestSuite.scala +++ b/ppl-spark-integration/src/test/scala/org/opensearch/flint/spark/ppl/PPLLogicalPlanBasicQueriesTranslatorTestSuite.scala @@ -37,13 +37,26 @@ class PPLLogicalPlanBasicQueriesTranslatorTestSuite thrown.getMessage === "Invalid table name: t.b.c.d Syntax: [ database_name. ] table_name") } + test("test describe with backticks") { + val context = new CatalystPlanContext + val logPlan = + planTransformer.visit(plan(pplParser, "describe t.b.`c.d`"), context) + + val expectedPlan = DescribeTableCommand( + TableIdentifier("c.d", Option("b"), Option("t")), + Map.empty[String, String].empty, + isExtended = true, + output = DescribeRelation.getOutputAttrs) + comparePlans(expectedPlan, logPlan, false) + } + test("test describe FQN table clause") { val context = new CatalystPlanContext val logPlan = - planTransformer.visit(plan(pplParser, "describe schema.default.http_logs"), context) + planTransformer.visit(plan(pplParser, "describe catalog.schema.http_logs"), context) val expectedPlan = DescribeTableCommand( - TableIdentifier("http_logs", Option("default"), Option("schema")), + TableIdentifier("http_logs", Option("schema"), Option("catalog")), Map.empty[String, String].empty, isExtended = true, output = DescribeRelation.getOutputAttrs) @@ -64,10 +77,10 @@ class PPLLogicalPlanBasicQueriesTranslatorTestSuite test("test FQN table describe table clause") { val context = new CatalystPlanContext - val logPlan = planTransformer.visit(plan(pplParser, "describe catalog.t"), context) + val logPlan = planTransformer.visit(plan(pplParser, "describe schema.t"), context) val expectedPlan = DescribeTableCommand( - TableIdentifier("t", Option("catalog")), + TableIdentifier("t", Option("schema")), Map.empty[String, String].empty, isExtended = true, output = DescribeRelation.getOutputAttrs)