Skip to content

Commit

Permalink
[BugFix] fix show data from temporary table (StarRocks#48215)
Browse files Browse the repository at this point in the history
Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com>
  • Loading branch information
silverbullet233 authored Jul 11, 2024
1 parent ce080e4 commit 5de7f8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ public ShowResultSet visitShowDataStatement(ShowDataStmt statement, ConnectConte
PrivilegeType.ANY.name(), ObjectType.TABLE.name(), tableName);
}

Table table = db.getTable(tableName);
Table table = MetaUtils.getSessionAwareTable(context, db, new TableName(dbName, tableName));
if (table == null) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_BAD_TABLE_ERROR, tableName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.List;

public class TemporaryTableTest {
private static ConnectContext connectContext;
private static StarRocksAssert starRocksAssert;
Expand Down Expand Up @@ -335,4 +337,14 @@ public void testDropTable() throws Exception {

}

@Test
public void testShowData() throws Exception {
starRocksAssert.withTemporaryTable("create temporary table t1(c1 int,c2 int, c3 int) " +
"engine=olap duplicate key(`c1`) distributed by hash(`c1`) " +
"properties('replication_num'='1')");
List<List<String>> showDataResult = starRocksAssert.show("show data from t1");
Assert.assertEquals(showDataResult.get(0).get(0), "t1");

}

}

0 comments on commit 5de7f8a

Please sign in to comment.