I learned dev doc. the create table command contains usage parameters. One of them is called [ COMPRESS | NOCOMPRESS ] as this following:
CREATE [ [ GLOBAL | LOCAL ] [ TEMPORARY | TEMP ] | UNLOGGED ] TABLE table_name
[ (column_name [, ...] ) ]
[ WITH ( {storage_parameter = value} [, ... ] ) ]
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ COMPRESS | NOCOMPRESS ]
[ TABLESPACE tablespace_name ]
AS query
[ WITH [ NO ] DATA ];
So when I use it, which compression algorithm would openGauss to choose to use for different data type?
As we know. openGauss supports many kinds of compression algorithms include RLE、DELTA、BYTEPACK/BITPACK、LZ4、ZLIB、LOCAL DICTIONARY. It would find out suitable algorithm for different data type. detail information is below:
https://opengauss.org/en/docs/2.0.0/docs/CharacteristicDescription/adaptive-compression.html
Related
As a follow-up to my previous question, I am having trouble getting tags to work right in this type of output. I want to print a table with each property as a row. This is how I expect it to look:
% aws --output table ec2 describe-instances --instance-id $id --query "Reservations[].Instances[0].[{ Property: 'Type', Value: InstanceType }]"
-------------------------------
| DescribeInstances |
+-----------+-----------------+
| Property | Value |
+-----------+-----------------+
| Type | g4dn.12xlarge |
+-----------+-----------------+
But with tag names it looks like this:
% aws --output table ec2 describe-instances --instance-id $id --query "Reservations[].Instances[0].[{ Property: 'Name', Value: Tags[?Key =='Name'].Value }]"
-------------------
|DescribeInstances|
+-----------------+
| Property |
+-----------------+
| Name |
+-----------------+
|| Value ||
|+---------------+|
|| Elliott-TKD ||
|+---------------+|
The tag value is correct, but the formatting is weird, and when combined with more other rows the table gets really ugly.
The filter part of your query ([?Key == 'Name']) is creating what JMESPath is describing as a projection.
You will have to reset this projection in order to extract a single string out of it.
Resetting a projection can be achieved using pipes.
Projections are an important concept in JMESPath. However, there are times when projection semantics are not what you want. A common scenario is when you want to operate of the result of a projection rather than projecting an expression onto each element in the array.
For example, the expression people[*].first will give you an array containing the first names of everyone in the people array. What if you wanted the first element in that list? If you tried people[*].first[0] that you just evaluate first[0] for each element in the people array, and because indexing is not defined for strings, the final result would be an empty array, []. To accomplish the desired result, you can use a pipe expression, <expression> | <expression>, to indicate that a projection must stop.
Source: https://jmespath.org/tutorial.html#pipe-expressions
So your issue is very close to what they are describing here in the documentation and the reset of that projection can be achieved using:
Tags[?Key =='Name']|[0].Value
or, with:
Tags[?Key =='Name'].Value | [0]
which are two strictly identical queries.
Given the JSON:
{
"Reservations": [
{
"Instances": [
{
"Tags": [
{
"Key": "Name",
"Value": "Elliott-TKD"
},
{
"Key": "Foo",
"Value": "Bar"
}
]
}
]
}
]
}
The query
Reservations[].Instances[0].[{ Property: `Name`, Value: Tags[?Key == `Name`]|[0].Value }]
Will give the expected
[
[
{
"Property": "Name",
"Value": "Elliott-TKD"
}
]
]
So it will render properly in your table
------------------------------
| DescribeInstance |
+------------+---------------+
| Property | Value |
+------------+---------------+
| Name | Elliott-TKD |
+------------+---------------+
for one variable in my System Dynamics Model in NetLogo i would like to have more than one boolean in my ifelse-value.
I tried it with the following code that I used as the expression for the variable.
(ifelse-value
quality = 100 [ 1.1 ]
quality = 80 [ 1.4 ]
quality = 60 [ 0.8 ]
[ 0.7 ])
I got the following error:
IFELSE-VALUE expected 3 inputs, a TRUE/FALSE, a reporter block and a reporter block.
What am I doing wrong?
A list called ownList2 consists of two parameters. Flockmates are all the neighbours in a given radius of the neighbour. I tried this code in version 6.0. But it doesn't work.
Basically, I want to put a list of equal dimension into a matrix. Is there something wrong I am doing? Or someone could improve the code piece?
ask turtles[set ownList2 (list who sensed)]
;sensed is sensor value of a turtle with respect to the patch.
;ownList2 is like a message of two bytes,
;first byte mentioning the identity of the itself
;second byte mentioning the value of the sensor.
ask turtles[
foreach (list flockmates)
[
i -> set m45 matrix:to-column-list ( list [ownList2] of i )
]
]
Result:
For turtle-0 with neighbours 1, 2, 3:
ownList2 ~ [1 200]
[2 400]
[3 900]
The m43 for turtle-0 should look like
[[1 200][2 400][3 900]]
Thanks for adding that information. Here is a toy example that might do what you need:
extensions [ matrix ]
turtles-own [ ownlist2 sensed m45 ]
to setup
ca
; Setup example turtles as per question
foreach [ 100 200 400 900 ] [
n ->
crt 1 [
while [ any? other turtles-here ] [
move-to one-of neighbors4
]
set sensed n
set ownlist2 ( list who sensed )
]
]
; Get the turtles to create matrices from the ownlists of
; sorted other turtles
ask turtles [
set m45 matrix:from-column-list map [ i -> [ ownlist2] of i ] sort other turtles
]
; Example output:
ask turtle 0 [
print "Turtle 0's m45:"
print matrix:pretty-print-text m45
]
reset-ticks
end
Output example:
Turtle 0's m45:
[[ 1 2 3 ]
[ 200 400 900 ]]
Following my question yesterday, I was trying to implement the code with filter and length. I think I achieved the filter but now I need the agents to compare their list length with other agent (activities) list. Here is my code:
ask agentes [
set culture-tags n-values 17 [random 2]
set shared-culture (filter [ i -> i = 0 ] culture-tags) ;count 0s and
create shared-culture
]
end
to move-agentes
ask agentes [
let nearest-activity min-one-of (activities) [ distance myself ]
ifelse any? activities in-radius sight-radius with
[ length t-shared-culture = length shared-culture ] ;as many 0s in t-shared-culture (specified later in the setup for activities) as in shared-culture
[ face nearest-activity ]
[ rt random 40
lt random 40
fd 0.3
]
]
Netlogo prints the next error: "ACTIVITIES breed does not own variable SHARED-CULTURE error while activity 176 running SHARED-CULTURE".
I imagine the mistake must be here: [ length t-shared-culture = length shared-culture ] but I don't know how to make both lists to interact.
I have three level of ifelse command. I attempt to make an agent to do something by comparing 2 variable of different agent. A brief description about the ifelse command.
Procedure 1 & 2 attempt to compare variable of two different agent on the same patch and do something; else
Procedure 3 attempt to compare variable of two agent on different patch in radius 2, then do something ; else.
Problem :
When I run procedure 1 and 3 (disable procedure 2) OR procedure 2 and 3 (disable procedure 1), code is fine. But when I tried to run the whole procedure, it can't access [do something] command on procedure 3.
My code looks like this;
to cocreate-value1
ask capabilities-here
[ let this-resource one-of resource
ask one-of prevalues-here
[ ifelse value = this-resource
[ use-resource ]
[ cocreate-value2]
] ]
end
to cocreate-value2
ask capabilities-here
[ let this-knowledge one-of knowledge
ask one-of prevalues-here
[ ifelse value = this-knowledge
[use-knowledge ]
[cocreate-value3]
] ]
end
to cocreate-value3
ask one-of other capabilities in-radius 2
[let resource2 sentence (resource) (knowledge)
let this-resource2 one-of resource2
let new-cap capabilities with [one-of resource = this-resource2]
ask prevalues-here
[ ifelse value = this-resource2
[ask capabilities-here
[if any? other new-cap in-radius 2
[ create-link-to one-of other new-cap in-radius 2
set color white]] ;; this code is not executed
use-network ] ;; this one too
[set color yellow ]
]]
end
Can anyone find the problem? Thank you for your help
Does this expose the problem?
to cocreate-value1
ask capabilities-here [
let _resource one-of resource
let _pv one-of prevalues-here
if (_pv != nobody) [
ask _pv [
ifelse (value = _resource) [
use-resource
] [
cocreate-value2
]
]
]
]
end
to cocreate-value2
print "enter cv3"
ask capabilities-here [
let _knowledge one-of knowledge
let _pv one-of prevalues-here
if (_pv != nobody) [
ask _pv [
ifelse (value = _knowledge) [use-knowledge ] [cocreate-value3]
]
]
]
print "exit cv3"
end
to cocreate-value3
print "enter cv3"
let _oc one-of other capabilities in-radius 2
ifelse (_oc = nobody) [
print "no other capabilities"
] [
ask _oc [
let _resource2 one-of (sentence resource knowledge)
let _resource one-of resource
let _new-cap capabilities with [_resource = _resource2]
if (not any? prevalues-here) [error "no prevalues here!"]
ask prevalues-here [
ifelse (value = _resource2) [
ask capabilities-here [
let _other one-of other _new-cap in-radius 2
if (_other != nobody) [
print "found a link partner!"
create-link-to _other
set color white
]
] ;; this code is not executed
use-network
] [;; this one too
set color yellow
]
]
]
]
print "leave cv3"
end